]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-arp.c
Allow tcpdump to work with earlier libpcaps.
[tcpdump] / print-arp.c
index 1ef2505f941a830b1defcde4fd0b1734f605e621..3ba8a7e6c598388454e92ed4abd1487f0f188824 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.46 2000-09-23 08:03:31 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.49 2000-10-10 05:05:07 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -30,11 +30,6 @@ static const char rcsid[] =
 
 #include <sys/param.h>
 #include <sys/time.h>
-#include <sys/socket.h>
-
-struct mbuf;
-struct rtentry;
-#include <net/if.h>
 
 #include <netinet/in.h>
 
@@ -84,6 +79,8 @@ struct        arphdr {
 #endif
 };
 
+#define ARP_HDRLEN     8
+
 /*
  * Ethernet Address Resolution Protocol.
  *
@@ -104,6 +101,8 @@ struct      ether_arp {
 #define        arp_pln ea_hdr.ar_pln
 #define        arp_op  ea_hdr.ar_op
 
+#define ETHER_ARP_HDRLEN       (ARP_HDRLEN + 6 + 4 + 6 + 4)    
+
 #define SHA(ap) ((ap)->arp_sha)
 #define THA(ap) ((ap)->arp_tha)
 #define SPA(ap) ((ap)->arp_spa)
@@ -131,7 +130,7 @@ arp_print(register const u_char *bp, u_int length, u_int caplen)
                printf("[|arp]");
                return;
        }
-       if (length < sizeof(struct ether_arp)) {
+       if (length < ETHER_ARP_HDRLEN) {
                (void)printf("truncated-arp");
                default_print((u_char *)ap, length);
                return;