aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2015-10-30 10:48:13 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2015-11-05 07:42:35 +0000
commit9c0d550a4afdafa31e76e0eecd14f8721e90e599 (patch)
tree2b30e52cd532f0a1b9e329ff474cb982244389bb
parent51dcd59d2d89da2aae6dc5bd028c98e41575623f (diff)
extcap: Provide capture filter to extcap binary
Added the option --extcap-capture-filter to extcap to send the capture filter from the main screen to the extcap binary. Change-Id: I75f0d7dbec810551225377f9221053298488cdd5 Reviewed-on: https://code.wireshark.org/review/11423 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
-rw-r--r--doc/README.extcap5
-rwxr-xr-xdoc/extcap_example.py3
-rw-r--r--extcap.c4
-rw-r--r--extcap.h1
-rw-r--r--extcap/androiddump.c5
5 files changed, 15 insertions, 3 deletions
diff --git a/doc/README.extcap b/doc/README.extcap
index 1bba11821f..d861e62bdc 100644
--- a/doc/README.extcap
+++ b/doc/README.extcap
@@ -108,9 +108,10 @@ There are two kind of options available:
STEP4: the capture. Once the interfaces are listed and configuration is customized
by the user, the capture is run.
-extcapbin --extcap-interface IFACE [params] --capture --fifo FIFO
+extcapbin --extcap-interface IFACE [params] --capture [--extcap-capture-filter CFILTER] --fifo FIFO
-To run the capture, the extcap must implement the --capture and --fifo option.
+To run the capture, the extcap must implement the --capture, --extcap-capture-filter
+and --fifo option.
They are automatically added by wireshark that opens the fifo for reading. All
the other options are automatically added to run the capture. The extcap interface
is used like all other interfaces (meaning that capture on multiple interfaces, as
diff --git a/doc/extcap_example.py b/doc/extcap_example.py
index dcd7ebbd41..f49a129f66 100755
--- a/doc/extcap_example.py
+++ b/doc/extcap_example.py
@@ -208,7 +208,7 @@ def extcap_capture(interface, fifo, delay, verify, message, remote):
####
def usage():
- print ( "Usage: %s <--extcap-interfaces | --extcap-dlts | --extcap-interface | --extcap-config | --capture | --fifo>" % sys.argv[0] )
+ print ( "Usage: %s <--extcap-interfaces | --extcap-dlts | --extcap-interface | --extcap-config | --capture | --extcap-capture-filter | --fifo>" % sys.argv[0] )
if __name__ == '__main__':
interface = ""
@@ -228,6 +228,7 @@ if __name__ == '__main__':
parser.add_argument("--extcap-interface", help="Provide the interface to capture from")
parser.add_argument("--extcap-dlts", help="Provide a list of dlts for the given interface", action="store_true")
parser.add_argument("--extcap-config", help="Provide a list of configurations for the given interface", action="store_true")
+ parser.add_argument("--extcap-capture-filter", help="Used together with capture to provide a capture filter")
parser.add_argument("--fifo", help="Use together with capture to provide the fifo to dump data to")
# Interface Arguments
diff --git a/extcap.c b/extcap.c
index 013389c0fc..1e89a5ce41 100644
--- a/extcap.c
+++ b/extcap.c
@@ -583,6 +583,10 @@ extcaps_init_initerfaces(capture_options *capture_opts)
add_arg(EXTCAP_ARGUMENT_RUN_CAPTURE);
add_arg(EXTCAP_ARGUMENT_INTERFACE);
add_arg(interface_opts.name);
+ if (interface_opts.cfilter) {
+ add_arg(EXTCAP_ARGUMENT_CAPTURE_FILTER);
+ add_arg(interface_opts.cfilter);
+ }
add_arg(EXTCAP_ARGUMENT_RUN_PIPE);
add_arg(interface_opts.extcap_fifo);
if (interface_opts.extcap_args == NULL)
diff --git a/extcap.h b/extcap.h
index 60f3904ce0..47c6511dc5 100644
--- a/extcap.h
+++ b/extcap.h
@@ -46,6 +46,7 @@
#define EXTCAP_ARGUMENT_LIST_DLTS "--extcap-dlts"
#define EXTCAP_ARGUMENT_RUN_CAPTURE "--capture"
+#define EXTCAP_ARGUMENT_CAPTURE_FILTER "--extcap-capture-filter"
#define EXTCAP_ARGUMENT_RUN_PIPE "--fifo"
#ifdef __cplusplus
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index 6d3736cadf..ccce803869 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -143,6 +143,7 @@ enum {
OPT_INTERFACE,
OPT_CONFIG,
OPT_CAPTURE,
+ OPT_CAPTURE_FILTER,
OPT_FIFO,
OPT_CONFIG_ADB_SERVER_IP,
OPT_CONFIG_ADB_SERVER_TCP_PORT,
@@ -164,6 +165,7 @@ static struct option longopts[] = {
{ "extcap-interface", required_argument, NULL, OPT_INTERFACE},
{ "extcap-config", no_argument, NULL, OPT_CONFIG},
{ "capture", no_argument, NULL, OPT_CAPTURE},
+ { "extcap-capture-filter", required_argument, NULL, OPT_CAPTURE_FILTER},
{ "fifo", required_argument, NULL, OPT_FIFO},
/* Interfaces options */
{ "adb-server-ip", required_argument, NULL, OPT_CONFIG_ADB_SERVER_IP},
@@ -2560,6 +2562,9 @@ int main(int argc, char **argv) {
case OPT_CAPTURE:
do_capture = 1;
break;
+ case OPT_CAPTURE_FILTER:
+ /* currently unused */
+ break;
case OPT_FIFO:
fifo = strdup(optarg);
break;