summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-02-20 19:02:09 -0800
committerGuy Harris <guy@alum.mit.edu>2015-02-25 17:30:22 -0800
commit323b161ab45c55aad1c3e3c4d2674a86a90c0178 (patch)
treee18e8a1f763d1da2cf026ab8a9a2e05cdf1411e0
parent5d87fbcae2c2f45276b848848b22fc585a894910 (diff)
downloadlibpcap-323b161ab45c55aad1c3e3c4d2674a86a90c0178.tar.gz
Fix previous change.
-rw-r--r--pcap-linux.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index 62c8020f..17824d26 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -286,7 +286,7 @@ typedef int socklen_t;
/*
* Prototypes for internal functions and methods.
*/
-static void map_arphrd_to_dlt(pcap_t *, int, const char *, int);
+static void map_arphrd_to_dlt(pcap_t *, int, int, const char *, int);
#ifdef HAVE_PF_PACKET_SOCKETS
static short int map_packet_type_to_sll_type(short int);
#endif
@@ -2467,8 +2467,12 @@ map_packet_type_to_sll_type(short int sll_pkttype)
*
* Sets the link type to -1 if unable to map the type.
*/
-static void map_arphrd_to_dlt(pcap_t *handle, int arptype, const char *device,
- int cooked_ok)
+static void map_arphrd_to_dlt(pcap_t *handle, int sock_fd
+#ifndef IW_MODE_MONITOR
+_U_
+#endif
+,
+ int arptype, const char *device, int cooked_ok)
{
static const char cdma_rmnet[] = "cdma_rmnet";
@@ -2511,7 +2515,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, const char *device,
* pcap_can_set_rfmon_linux(); are there any others??
*/
#ifdef IW_MODE_MONITOR
- if (has_wext(handle->fd, device, handle->errbuf) != 1) {
+ if (has_wext(sock_fd, device, handle->errbuf) == 1) {
/*
* It supports the wireless extensions, so it's a Wi-Fi
* device; don't offer DOCSIS.
@@ -2928,7 +2932,7 @@ activate_new(pcap_t *handle)
close(sock_fd);
return arptype;
}
- map_arphrd_to_dlt(handle, arptype, device, 1);
+ map_arphrd_to_dlt(handle, sock_fd, arptype, device, 1);
if (handle->linktype == -1 ||
handle->linktype == DLT_LINUX_SLL ||
handle->linktype == DLT_LINUX_IRDA ||
@@ -5039,7 +5043,7 @@ activate_old(pcap_t *handle)
* Try to find the DLT_ type corresponding to that
* link-layer type.
*/
- map_arphrd_to_dlt(handle, arptype, device, 0);
+ map_arphrd_to_dlt(handle, handle->fd, arptype, device, 0);
if (handle->linktype == -1) {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"unknown arptype %d", arptype);