diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-01-06 21:56:45 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-01-07 05:57:16 +0000 |
commit | 51a99ca2b393d5709274822b92c97aebc7934fd0 (patch) | |
tree | fbec18c34dc7c8620c0463e8b8dc352f95e18eb8 /caputils/capture-pcap-util.c | |
parent | 88b6c768b50e5aabca9dd105dd4219dda4872d41 (diff) |
Clean up #ifdeffed code.
We only need is_linux_bonding_device() if we have pcap_create(). We
need get_data_link_types() regardless of whether we have pcap_create()
or not.
Change-Id: I035f8ddcd57c0424662a2029f928bffa969a3f6c
Reviewed-on: https://code.wireshark.org/review/13099
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'caputils/capture-pcap-util.c')
-rw-r--r-- | caputils/capture-pcap-util.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/caputils/capture-pcap-util.c b/caputils/capture-pcap-util.c index 8a498f6b9c..f7757ea8a5 100644 --- a/caputils/capture-pcap-util.c +++ b/caputils/capture-pcap-util.c @@ -864,46 +864,6 @@ create_data_link_info(int dlt) return data_link_info; } -#ifdef HAVE_PCAP_CREATE -#if defined(HAVE_BONDING) && defined(HAVE_PCAP_CREATE) -static gboolean -is_linux_bonding_device(const char *ifname) -{ - int fd; - struct ifreq ifr; - ifbond ifb; - - fd = socket(PF_INET, SOCK_DGRAM, 0); - if (fd == -1) - return FALSE; - - memset(&ifr, 0, sizeof ifr); - g_strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); - memset(&ifb, 0, sizeof ifb); - ifr.ifr_data = (caddr_t)&ifb; -#if defined(SIOCBONDINFOQUERY) - if (ioctl(fd, SIOCBONDINFOQUERY, &ifr) == 0) { - close(fd); - return TRUE; - } -#else - if (ioctl(fd, BOND_INFO_QUERY_OLD, &ifr) == 0) { - close(fd); - return TRUE; - } -#endif - - close(fd); - return FALSE; -} -#elif defined(HAVE_PCAP_CREATE) -static gboolean -is_linux_bonding_device(const char *ifname _U_) -{ - return FALSE; -} -#endif - static GList * get_data_link_types(pcap_t *pch, interface_options *interface_opts, char **err_str) @@ -977,6 +937,46 @@ get_data_link_types(pcap_t *pch, interface_options *interface_opts, return data_link_types; } +#ifdef HAVE_PCAP_CREATE +#ifdef HAVE_BONDING +static gboolean +is_linux_bonding_device(const char *ifname) +{ + int fd; + struct ifreq ifr; + ifbond ifb; + + fd = socket(PF_INET, SOCK_DGRAM, 0); + if (fd == -1) + return FALSE; + + memset(&ifr, 0, sizeof ifr); + g_strlcpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); + memset(&ifb, 0, sizeof ifb); + ifr.ifr_data = (caddr_t)&ifb; +#if defined(SIOCBONDINFOQUERY) + if (ioctl(fd, SIOCBONDINFOQUERY, &ifr) == 0) { + close(fd); + return TRUE; + } +#else + if (ioctl(fd, BOND_INFO_QUERY_OLD, &ifr) == 0) { + close(fd); + return TRUE; + } +#endif + + close(fd); + return FALSE; +} +#else +static gboolean +is_linux_bonding_device(const char *ifname _U_) +{ + return FALSE; +} +#endif + if_capabilities_t * get_if_capabilities_pcap_create(interface_options *interface_opts, char **err_str) |