Linux has defined a large number of values for dummy ARP
header types (<net/if_arp.h>) that are not present in the
official IANA listing. See the hardware type table here:

http://www.iana.org/assignments/arp-parameters/arp-parameters.xhtml

and compare it with the list found in pcap-linux.c.

One of my current goals is to get pcap-linux.c to compile
and function on Solaris using PF_PACKET in Solaris and
after internal discussion, we're not entirely keen on
defining all of the extra symbols found on Linux given
that they have no actual basis.

The attached diff introduces complimentary #ifdef's for
all of the Linux extras, of which there is already some
present. This should also make pcap-linux.c friendlier
to all Linuxes.

btw, the above table also suggests that the Linux
handling of type 15, frame relay, is incorrect.

Darren

diff --git a/pcap-linux.c b/pcap-linux.c
index 70068b5..d1d2335 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -2389,6 +2389,9 @@ static void map_arphrd_to_dlt(pcap_t *handle, int 
arptype, int cooked_ok)
                /* FALLTHROUGH */
 
        case ARPHRD_METRICOM:
+#ifndef ARPHRD_LOOPBACK
+#define ARPHRD_LOOPBACK 772
+#endif
        case ARPHRD_LOOPBACK:
                handle->linktype = DLT_EN10MB;
                handle->offset = 2;
@@ -2409,6 +2412,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int 
arptype, int cooked_ok)
        case ARPHRD_CHAOS:
                handle->linktype = DLT_CHAOS;
                break;
+
 #ifndef ARPHRD_CAN
 #define ARPHRD_CAN 280
 #endif
@@ -2437,7 +2441,7 @@ static void map_arphrd_to_dlt(pcap_t *handle, int 
arptype, int cooked_ok)
                handle->offset = 3;
                break;
 
-#ifndef ARPHRD_ATM  /* FIXME: How to #include this? */
+#ifndef ARPHRD_ATM  /* FIXME: How to #include this? Values: 16, 19, 21 */
 #define ARPHRD_ATM 19
 #endif
        case ARPHRD_ATM:
@@ -2504,6 +2508,9 @@ static void map_arphrd_to_dlt(pcap_t *handle, int 
arptype, int cooked_ok)
                handle->linktype = DLT_IEEE802_11_RADIO;
                break;
 
+#ifndef ARPHRD_PPP
+#define ARPHRD_PPP 512
+#endif
        case ARPHRD_PPP:
                /*
                 * Some PPP code in the kernel supplies no link-layer
@@ -2561,10 +2568,25 @@ static void map_arphrd_to_dlt(pcap_t *handle, int 
arptype, int cooked_ok)
 #define ARPHRD_SIT 776 /* From Linux 2.2.13 */
 #endif
        case ARPHRD_SIT:
+#ifndef ARPHRD_CSLIP
+#define ARPHRD_CSLIP 257
+#endif
        case ARPHRD_CSLIP:
+#ifndef ARPHRD_SLIP6
+#define ARPHRD_SLIP6 258
+#endif
        case ARPHRD_SLIP6:
+#ifndef ARPHRD_CSLIP6
+#define ARPHRD_CSLIP6 259
+#endif
        case ARPHRD_CSLIP6:
+#ifndef ARPHRD_ADAPT
+#define ARPHRD_ADAPT 264
+#endif
        case ARPHRD_ADAPT:
+#ifndef ARPHRD_SLIP
+#define ARPHRD_SLIP 256
+#endif
        case ARPHRD_SLIP:
 #ifndef ARPHRD_RAWHDLC
 #define ARPHRD_RAWHDLC 518
@@ -2588,6 +2610,9 @@ static void map_arphrd_to_dlt(pcap_t *handle, int 
arptype, int cooked_ok)
                handle->linktype = DLT_FRELAY;
                break;
 
+#ifndef ARPHRD_LOCALTLK
+#define ARPHRD_LOCALTLK 773    /* IANA defines this as 11 */
+#endif
        case ARPHRD_LOCALTLK:
                handle->linktype = DLT_LTALK;
                break;
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.

Reply via email to