diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-05-07 08:06:25 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-05-07 08:06:25 +0000 |
commit | cc05b9250d271bf75d814d6880b11a4fc4a0540a (patch) | |
tree | 211917813f771c8c7799bf5cc322e7a61f7bac39 /gtk | |
parent | 1bcecb4bcd77d8ae938f7d92993a3586a576c65b (diff) |
For TShark and Wireshark, get the list of link-layer types for an
interface by running dumpcap, so that if you need privileges to open an
interface, and dumpcap has those privileges, neither TShark nor
Wireshark need them.
svn path=/trunk/; revision=32710
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/main.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gtk/main.c b/gtk/main.c index 528970606b..83046dd19a 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -108,6 +108,7 @@ #ifdef HAVE_LIBPCAP #include "../capture-pcap-util.h" +#include "../capture_ifinfo.h" #include "../capture.h" #include "../capture_sync.h" #endif @@ -2703,8 +2704,24 @@ main(int argc, char *argv[]) } if (list_link_layer_types) { - status = capture_opts_list_link_layer_types(&global_capture_opts, FALSE); - exit(status); + /* Get the list of link-layer types for the capture device. */ + GList *lt_list; + gchar *err_str; + + lt_list = capture_pcap_linktype_list(global_capture_opts.iface, &err_str); + if (lt_list == NULL) { + if (err_str != NULL) { + cmdarg_err("The list of data link types for the capture device \"%s\" could not be obtained (%s)." + "Please check to make sure you have sufficient permissions, and that\n" + "you have the proper interface or pipe specified.\n", global_capture_opts.iface, err_str); + g_free(err_str); + } else + cmdarg_err("The capture device \"%s\" has no data link types.", global_capture_opts.iface); + exit(2); + } + capture_opts_print_link_layer_types(lt_list); + free_pcap_linktype_list(lt_list); + exit(0); } capture_opts_trim_snaplen(&global_capture_opts, MIN_PACKET_SIZE); |