diff options
author | Michael Tüxen <tuexen@fh-muenster.de> | 2011-07-08 13:47:16 +0000 |
---|---|---|
committer | Michael Tüxen <tuexen@fh-muenster.de> | 2011-07-08 13:47:16 +0000 |
commit | 0472f42af7fa3a18f986158c0be264dd75953ee2 (patch) | |
tree | 53e6ca5e9227af38c85140388a8fc3e96ae63cb4 /gtk/main.c | |
parent | b2ab9d134aebea64b7b1df266626a39b7bc96dd8 (diff) |
If no interface is specified on the command line, use the default
capture interface if given.
This patch is provided by Irene Ruengeler.
svn path=/trunk/; revision=37939
Diffstat (limited to 'gtk/main.c')
-rw-r--r-- | gtk/main.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gtk/main.c b/gtk/main.c index dcdad8b8a0..e56b9b07fa 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -2754,6 +2754,41 @@ main(int argc, char *argv[]) line that their preferences have changed. */ prefs_apply_all(); +#ifdef HAVE_LIBPCAP + if ((global_capture_opts.ifaces->len == 0) && + (prefs.capture_device != NULL)) { + interface_options interface_opts; + + interface_opts.name = g_strdup(get_if_name(prefs.capture_device)); + interface_opts.descr = get_interface_descriptive_name(interface_opts.name); + interface_opts.monitor_mode = prefs_capture_device_monitor_mode(interface_opts.name); + interface_opts.linktype = capture_dev_user_linktype_find(interface_opts.name); + interface_opts.cfilter = g_strdup(global_capture_opts.default_options.cfilter); + interface_opts.snaplen = global_capture_opts.default_options.snaplen; + interface_opts.has_snaplen = global_capture_opts.default_options.has_snaplen; + interface_opts.promisc_mode = global_capture_opts.default_options.promisc_mode; +#if defined(_WIN32) || defined(HAVE_PCAP_CREATE) + interface_opts.buffer_size = global_capture_opts.default_options.buffer_size; +#endif +#ifdef HAVE_PCAP_REMOTE + interface_opts.src_type = global_capture_opts.default_options.src_type; + interface_opts.remote_host = g_strdup(global_capture_opts.default_options.remote_host); + interface_opts.remote_port = g_strdup(global_capture_opts.default_options.remote_port); + interface_opts.auth_type = global_capture_opts.default_options.auth_type; + interface_opts.auth_username = g_strdup(global_capture_opts.default_options.auth_username); + interface_opts.auth_password = g_strdup(global_capture_opts.default_options.auth_password); + interface_opts.datatx_udp = global_capture_opts.default_options.datatx_udp; + interface_opts.nocap_rpcap = global_capture_opts.default_options.nocap_rpcap; + interface_opts.nocap_local = global_capture_opts.default_options.nocap_local; + #endif + #ifdef HAVE_PCAP_SETSAMPLING + interface_opts.sampling_method = global_capture_opts.default_options.sampling_method; + interface_opts.sampling_param = global_capture_opts.default_options.sampling_param; + #endif + g_array_insert_val(global_capture_opts.ifaces, 0, interface_opts); + } +#endif + /* disabled protocols as per configuration file */ if (gdp_path == NULL && dp_path == NULL) { set_disabled_protos_list(); |