diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-03-17 13:35:55 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-03-17 20:36:28 +0000 |
commit | 29bccdbd12a9e0cd3eaacb0f50d5f18a3a18d7a5 (patch) | |
tree | dfadd05383f60d452afce3568cfb82569f235fed /dumpcap.c | |
parent | 7a14f89f12f72bf14b4fc69f9a0c4a4974bae089 (diff) | |
download | wireshark-29bccdbd12a9e0cd3eaacb0f50d5f18a3a18d7a5.tar.gz wireshark-29bccdbd12a9e0cd3eaacb0f50d5f18a3a18d7a5.tar.bz2 wireshark-29bccdbd12a9e0cd3eaacb0f50d5f18a3a18d7a5.zip |
Don't say "Capturing on..." if we're not capturing on.
Only print the "Capturing on..." message if we're actually capturing,
not if we're printing link-layer types.
Change-Id: Icc554776a6a2826276893acb38f7d700effd5f78
Reviewed-on: https://code.wireshark.org/review/7726
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 77 |
1 files changed, 39 insertions, 38 deletions
@@ -4851,6 +4851,44 @@ DIAG_ON(cast-qual) exit_main(status); } + if (list_link_layer_types) { + /* Get the list of link-layer types for the capture device. */ + if_capabilities_t *caps; + gchar *err_str; + guint ii; + + for (ii = 0; ii < global_capture_opts.ifaces->len; ii++) { + interface_options interface_opts; + + interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, ii); + + caps = get_if_capabilities(interface_opts.name, + interface_opts.monitor_mode, &err_str); + if (caps == NULL) { + cmdarg_err("The capabilities of the capture device \"%s\" could not be obtained (%s).\n" + "Please check to make sure you have sufficient permissions, and that\n" + "you have the proper interface or pipe specified.", interface_opts.name, err_str); + g_free(err_str); + exit_main(2); + } + if (caps->data_link_types == NULL) { + cmdarg_err("The capture device \"%s\" has no data link types.", interface_opts.name); + exit_main(2); + } + if (machine_readable) /* tab-separated values to stdout */ + /* XXX: We need to change the format and adopt consumers */ + print_machine_readable_if_capabilities(caps); + else + /* XXX: We might want to print also the interface name */ + capture_opts_print_if_capabilities(caps, interface_opts.name, + interface_opts.monitor_mode); + free_if_capabilities(caps); + } + exit_main(0); + } + + /* We're supposed to do a capture, or print the BPF code for a filter. */ + /* Let the user know what interfaces were chosen. */ if (capture_child) { for (j = 0; j < global_capture_opts.ifaces->len; j++) { @@ -4890,44 +4928,7 @@ DIAG_ON(cast-qual) g_string_free(str, TRUE); } - if (list_link_layer_types) { - /* Get the list of link-layer types for the capture device. */ - if_capabilities_t *caps; - gchar *err_str; - guint ii; - - for (ii = 0; ii < global_capture_opts.ifaces->len; ii++) { - interface_options interface_opts; - - interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, ii); - - caps = get_if_capabilities(interface_opts.name, - interface_opts.monitor_mode, &err_str); - if (caps == NULL) { - cmdarg_err("The capabilities of the capture device \"%s\" could not be obtained (%s).\n" - "Please check to make sure you have sufficient permissions, and that\n" - "you have the proper interface or pipe specified.", interface_opts.name, err_str); - g_free(err_str); - exit_main(2); - } - if (caps->data_link_types == NULL) { - cmdarg_err("The capture device \"%s\" has no data link types.", interface_opts.name); - exit_main(2); - } - if (machine_readable) /* tab-separated values to stdout */ - /* XXX: We need to change the format and adopt consumers */ - print_machine_readable_if_capabilities(caps); - else - /* XXX: We might want to print also the interface name */ - capture_opts_print_if_capabilities(caps, interface_opts.name, - interface_opts.monitor_mode); - free_if_capabilities(caps); - } - exit_main(0); - } - - /* We're supposed to do a capture, or print the BPF code for a filter. - Process the snapshot length, as that affects the generated BPF code. */ + /* Process the snapshot length, as that affects the generated BPF code. */ capture_opts_trim_snaplen(&global_capture_opts, MIN_PACKET_SIZE); #ifdef HAVE_BPF_IMAGE |