diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-03-04 01:12:04 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-03-04 01:12:04 +0000 |
commit | 167ab3a98c4583344f8b95d81b079b7a5df7e5ff (patch) | |
tree | c2af1e714cc510427cdd87a9b63979038cfc40ac /capture_opts.c | |
parent | 98d800bae8939f6edaf4aa54f02787148da48c0f (diff) | |
download | wireshark-167ab3a98c4583344f8b95d81b079b7a5df7e5ff.tar.gz wireshark-167ab3a98c4583344f8b95d81b079b7a5df7e5ff.tar.bz2 wireshark-167ab3a98c4583344f8b95d81b079b7a5df7e5ff.zip |
In Wireshark and TShark, run dumpcap to get interface lists and lists of
link-layer header types for interfaces; if special privileges are
necessary to open capture devices, Wireshark and TShark shouldn't have
those privileges, but dumpcap should.
svn path=/trunk/; revision=32104
Diffstat (limited to 'capture_opts.c')
-rw-r--r-- | capture_opts.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/capture_opts.c b/capture_opts.c index 243b6919ce..c61b5061df 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -68,6 +68,7 @@ #include "clopts_common.h" #include "cmdarg_err.h" +#include "capture_ifinfo.h" #include "capture-pcap-util.h" #include <wsutil/file_util.h> @@ -403,7 +404,7 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str cmdarg_err("There is no interface with that adapter index"); return 1; } - if_list = get_interface_list(&err, &err_str); + if_list = capture_interface_list(&err, &err_str); if (if_list == NULL) { switch (err) { @@ -624,11 +625,11 @@ capture_opts_list_interfaces(gboolean machine_readable) int err; gchar *err_str; int i; - GSList *ip_addr; + GSList *addr; if_addr_t *if_addr; char addr_str[ADDRSTRLEN]; - if_list = get_interface_list(&err, &err_str); + if_list = capture_interface_list(&err, &err_str); if (if_list == NULL) { switch (err) { case CANT_GET_INTERFACE_LIST: @@ -645,7 +646,7 @@ capture_opts_list_interfaces(gboolean machine_readable) i = 1; /* Interface id number */ for (if_entry = g_list_first(if_list); if_entry != NULL; - if_entry = g_list_next(if_entry)) { + if_entry = g_list_next(if_entry)) { if_info = if_entry->data; printf("%d. %s", i++, if_info->name); @@ -665,23 +666,23 @@ capture_opts_list_interfaces(gboolean machine_readable) else printf("\t\t"); - for(ip_addr = g_slist_nth(if_info->ip_addr, 0); ip_addr != NULL; - ip_addr = g_slist_next(ip_addr)) { - if (ip_addr != g_slist_nth(if_info->ip_addr, 0)) + for(addr = g_slist_nth(if_info->addrs, 0); addr != NULL; + addr = g_slist_next(addr)) { + if (addr != g_slist_nth(if_info->addrs, 0)) printf(","); - if_addr = ip_addr->data; - switch(if_addr->type) { - case AT_IPv4: - if (inet_ntop(AF_INET, &if_addr->ip_addr.ip4_addr, addr_str, + if_addr = addr->data; + switch(if_addr->ifat_type) { + case IF_AT_IPv4: + if (inet_ntop(AF_INET, &if_addr->addr.ip4_addr, addr_str, ADDRSTRLEN)) { printf("%s", addr_str); } else { printf("<unknown IPv4>"); } break; - case AT_IPv6: - if (inet_ntop(AF_INET6, &if_addr->ip_addr.ip6_addr, + case IF_AT_IPv6: + if (inet_ntop(AF_INET6, &if_addr->addr.ip6_addr, addr_str, ADDRSTRLEN)) { printf("%s", addr_str); } else { @@ -689,7 +690,7 @@ capture_opts_list_interfaces(gboolean machine_readable) } break; default: - printf("<type unknown %u>", if_addr->type); + printf("<type unknown %u>", if_addr->ifat_type); } } @@ -748,7 +749,7 @@ gboolean capture_opts_trim_iface(capture_options *capture_opts, const char *capt */ } else { /* No - pick the first one from the list of interfaces. */ - if_list = get_interface_list(&err, &err_str); + if_list = capture_interface_list(&err, &err_str); if (if_list == NULL) { switch (err) { |