diff options
author | Guy Harris <guy@alum.mit.edu> | 2020-03-12 13:16:24 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2020-03-13 00:05:07 +0000 |
commit | 0c889d6f5cfdbf008a345fa3292ee468931ab49a (patch) | |
tree | 10a858d36541aa0eb6abd767f1251130bfd1bf95 /caputils/capture-pcap-util.c | |
parent | f77c677f186cae1e687767b7766cfdef62c533a1 (diff) |
Require at least libpcap 0.8/WinPcap 3.1.
2004 called, they want their libpcap/WinPcap back.
RHEL 6 initially shipped with libpcap 1.0; even old Enterprise(TM)
versions of OSes ship with something shinier than 0.7.x these days.
This lets us get rid of a bunch of #ifdefs and workaround code for
missing APIs.
Change-Id: I862cb027418b0a0c0f45a26979acea82f93f833b
Reviewed-on: https://code.wireshark.org/review/36383
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'caputils/capture-pcap-util.c')
-rw-r--r-- | caputils/capture-pcap-util.c | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/caputils/capture-pcap-util.c b/caputils/capture-pcap-util.c index d0b55c9ff7..6fb1eb4dd5 100644 --- a/caputils/capture-pcap-util.c +++ b/caputils/capture-pcap-util.c @@ -570,7 +570,6 @@ if_info_add_address(if_info_t *if_info, struct sockaddr *addr) } } -#ifdef HAVE_PCAP_FINDALLDEVS /* * Get all IP address information for the given interface. */ @@ -669,7 +668,6 @@ get_interface_list_findalldevs(int *err, char **err_str) return il; } -#endif /* HAVE_PCAP_FINDALLDEVS */ static void free_if_cb(gpointer data, gpointer user_data _U_) @@ -684,95 +682,6 @@ free_interface_list(GList *if_list) g_list_free(if_list); } -#if !defined(HAVE_PCAP_DATALINK_NAME_TO_VAL) || !defined(HAVE_PCAP_DATALINK_VAL_TO_NAME) || !defined(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION) -struct dlt_choice { - const char *name; - const char *description; - int dlt; -}; - -#define DLT_CHOICE(code, description) { #code, description, code } -#define DLT_CHOICE_SENTINEL { NULL, NULL, 0 } - -static struct dlt_choice dlt_choices[] = { - DLT_CHOICE(DLT_NULL, "BSD loopback"), - DLT_CHOICE(DLT_EN10MB, "Ethernet"), - DLT_CHOICE(DLT_IEEE802, "Token ring"), - DLT_CHOICE(DLT_ARCNET, "ARCNET"), - DLT_CHOICE(DLT_SLIP, "SLIP"), - DLT_CHOICE(DLT_PPP, "PPP"), - DLT_CHOICE(DLT_FDDI, "FDDI"), - DLT_CHOICE(DLT_ATM_RFC1483, "RFC 1483 IP-over-ATM"), - DLT_CHOICE(DLT_RAW, "Raw IP"), - DLT_CHOICE(DLT_SLIP_BSDOS, "BSD/OS SLIP"), - DLT_CHOICE(DLT_PPP_BSDOS, "BSD/OS PPP"), - DLT_CHOICE(DLT_ATM_CLIP, "Linux Classical IP-over-ATM"), - DLT_CHOICE(DLT_PPP_SERIAL, "PPP over serial"), - DLT_CHOICE(DLT_PPP_ETHER, "PPPoE"), - DLT_CHOICE(DLT_C_HDLC, "Cisco HDLC"), - DLT_CHOICE(DLT_IEEE802_11, "802.11"), - DLT_CHOICE(DLT_FRELAY, "Frame Relay"), - DLT_CHOICE(DLT_LOOP, "OpenBSD loopback"), - DLT_CHOICE(DLT_ENC, "OpenBSD encapsulated IP"), - DLT_CHOICE(DLT_LINUX_SLL, "Linux cooked"), - DLT_CHOICE(DLT_LTALK, "Localtalk"), - DLT_CHOICE(DLT_PFLOG, "OpenBSD pflog file"), - DLT_CHOICE(DLT_PRISM_HEADER, "802.11 plus Prism header"), - DLT_CHOICE(DLT_IP_OVER_FC, "RFC 2625 IP-over-Fibre Channel"), - DLT_CHOICE(DLT_SUNATM, "Sun raw ATM"), - DLT_CHOICE(DLT_IEEE802_11_RADIO, "802.11 plus BSD radio information header"), - DLT_CHOICE(DLT_APPLE_IP_OVER_IEEE1394, "Apple IP-over-IEEE 1394"), - DLT_CHOICE(DLT_ARCNET_LINUX, "Linux ARCNET"), - DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"), - DLT_CHOICE(DLT_IEEE802_11_RADIO_AVS, "802.11 plus AVS radio information header"), - DLT_CHOICE_SENTINEL -}; - -#if !defined(HAVE_PCAP_DATALINK_NAME_TO_VAL) -static int -pcap_datalink_name_to_val(const char *name) -{ - int i; - - for (i = 0; dlt_choices[i].name != NULL; i++) { - if (g_ascii_strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1, - name) == 0) - return (dlt_choices[i].dlt); - } - return (-1); -} -#endif /* defined(HAVE_PCAP_DATALINK_NAME_TO_VAL) */ - -#if !defined(HAVE_PCAP_DATALINK_VAL_TO_NAME) -static const char * -pcap_datalink_val_to_name(int dlt) -{ - int i; - - for (i = 0; dlt_choices[i].name != NULL; i++) { - if (dlt_choices[i].dlt == dlt) - return (dlt_choices[i].name + sizeof("DLT_") - 1); - } - return (NULL); -} -#endif /* defined(HAVE_PCAP_DATALINK_VAL_TO_NAME) */ - -#if !defined(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION) -const char * -pcap_datalink_val_to_description(int dlt) -{ - int i; - - for (i = 0; dlt_choices[i].name != NULL; i++) { - if (dlt_choices[i].dlt == dlt) - return (dlt_choices[i].description); - } - return (NULL); -} -#endif /* defined(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION) */ - -#endif /* !defined(HAVE_PCAP_DATALINK_VAL_TO_NAME) || !defined(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION) */ - static void free_linktype_cb(gpointer data, gpointer user_data _U_) { @@ -953,17 +862,9 @@ set_pcap_datalink(pcap_t *pcap_h, int datalink, char *name, if (datalink == -1) return TRUE; /* just use the default */ -#ifdef HAVE_PCAP_SET_DATALINK if (pcap_set_datalink(pcap_h, datalink) == 0) return TRUE; /* no error */ set_datalink_err_str = pcap_geterr(pcap_h); -#else - /* Let them set it to the type it is; reject any other request. */ - if (get_pcap_datalink(pcap_h, name) == datalink) - return TRUE; /* no error */ - set_datalink_err_str = - "That DLT isn't one of the DLTs supported by this device"; -#endif g_snprintf(errmsg, (gulong) errmsg_len, "Unable to set data link type on interface '%s' (%s).", name, set_datalink_err_str); /* @@ -1002,14 +903,11 @@ get_data_link_types(pcap_t *pch, interface_options *interface_opts, { GList *data_link_types; int deflt; -#ifdef HAVE_PCAP_LIST_DATALINKS int *linktypes; int i, nlt; -#endif data_link_info_t *data_link_info; deflt = get_pcap_datalink(pch, interface_opts->name); -#ifdef HAVE_PCAP_LIST_DATALINKS nlt = pcap_list_datalinks(pch, &linktypes); if (nlt < 0) { /* @@ -1082,11 +980,6 @@ get_data_link_types(pcap_t *pch, interface_options *interface_opts, xx_free(linktypes); #endif /* _WIN32 */ #endif /* HAVE_PCAP_FREE_DATALINKS */ -#else /* HAVE_PCAP_LIST_DATALINKS */ - - data_link_info = create_data_link_info(deflt); - data_link_types = g_list_append(data_link_types, data_link_info); -#endif /* HAVE_PCAP_LIST_DATALINKS */ *err_str = NULL; return data_link_types; |