]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix previous change.
authorGuy Harris <[email protected]>
Sat, 21 Feb 2015 03:02:09 +0000 (19:02 -0800)
committerGuy Harris <[email protected]>
Thu, 26 Feb 2015 01:31:51 +0000 (17:31 -0800)
pcap-linux.c

index cae755f5e9ade2bedf336082af58628ce9262b52..f186af2efc1f2cbca8748ca8e20b9f5613c40b0c 100644 (file)
@@ -318,7 +318,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
@@ -2605,8 +2605,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";
 
@@ -2649,7 +2653,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.
@@ -3066,7 +3070,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 ||
@@ -5183,7 +5187,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);