]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ether.c
Pointers into packet data should usually be pointers to unsigned 1-byte
[tcpdump] / print-ether.c
index 71c28a5f1a8d15c9826bbf9996b04da370870db9..13c06174fa1931f8b2056936bd77926c0be0e847 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.88 2004-02-18 14:23:27 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.99 2005-07-10 14:41:34 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -38,8 +38,6 @@ static const char rcsid[] _U_ =
 
 #include "ether.h"
 
 
 #include "ether.h"
 
-const u_char *snapend;
-
 const struct tok ethertype_values[] = { 
     { ETHERTYPE_IP,            "IPv4" },
     { ETHERTYPE_MPLS,          "MPLS unicast" },
 const struct tok ethertype_values[] = { 
     { ETHERTYPE_IP,            "IPv4" },
     { ETHERTYPE_MPLS,          "MPLS unicast" },
@@ -67,11 +65,14 @@ const struct tok ethertype_values[] = {
     { ETHERTYPE_AARP,           "Appletalk ARP" },
     { ETHERTYPE_IPX,            "IPX" },
     { ETHERTYPE_PPP,            "PPP" },
     { ETHERTYPE_AARP,           "Appletalk ARP" },
     { ETHERTYPE_IPX,            "IPX" },
     { ETHERTYPE_PPP,            "PPP" },
+    { ETHERTYPE_SLOW,           "Slow Protocols" },
     { ETHERTYPE_PPPOED,         "PPPoE D" },
     { ETHERTYPE_PPPOES,         "PPPoE S" },
     { ETHERTYPE_PPPOED,         "PPPoE D" },
     { ETHERTYPE_PPPOES,         "PPPoE S" },
+    { ETHERTYPE_EAPOL,          "EAPOL" },
     { ETHERTYPE_JUMBO,          "Jumbo" },
     { ETHERTYPE_LOOPBACK,       "Loopback" },
     { ETHERTYPE_ISO,            "OSI" },
     { ETHERTYPE_JUMBO,          "Jumbo" },
     { ETHERTYPE_LOOPBACK,       "Loopback" },
     { ETHERTYPE_ISO,            "OSI" },
+    { ETHERTYPE_GRE_ISO,        "GRE-OSI" },
     { 0, NULL}
 };
 
     { 0, NULL}
 };
 
@@ -136,7 +137,7 @@ ether_print(const u_char *p, u_int length, u_int caplen)
                        if (!eflag)
                                ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
 
                        if (!eflag)
                                ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
 
-                       if (!xflag && !qflag)
+                       if (!suppress_default_print)
                                default_print(p, caplen);
                }
        } else if (ether_encap_print(ether_type, p, length, caplen,
                                default_print(p, caplen);
                }
        } else if (ether_encap_print(ether_type, p, length, caplen,
@@ -145,7 +146,7 @@ ether_print(const u_char *p, u_int length, u_int caplen)
                if (!eflag)
                        ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
 
                if (!eflag)
                        ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
 
-               if (!xflag && !qflag)
+               if (!suppress_default_print)
                        default_print(p, caplen);
        } 
 }
                        default_print(p, caplen);
        } 
 }
@@ -153,7 +154,7 @@ ether_print(const u_char *p, u_int length, u_int caplen)
 /*
  * This is the top level routine of the printer.  'p' points
  * to the ether header of the packet, 'h->ts' is the timestamp,
 /*
  * This is the top level routine of the printer.  'p' points
  * to the ether header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
  * is the number of bytes actually captured.
  */
 u_int
  * is the number of bytes actually captured.
  */
 u_int
@@ -186,7 +187,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
        switch (ether_type) {
 
        case ETHERTYPE_IP:
        switch (ether_type) {
 
        case ETHERTYPE_IP:
-               ip_print(p, length);
+               ip_print(gndo, p, length);
                return (1);
 
 #ifdef INET6
                return (1);
 
 #ifdef INET6
@@ -197,7 +198,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
 
        case ETHERTYPE_ARP:
        case ETHERTYPE_REVARP:
 
        case ETHERTYPE_ARP:
        case ETHERTYPE_REVARP:
-               arp_print(p, length, caplen);
+               arp_print(gndo, p, length, caplen);
                return (1);
 
        case ETHERTYPE_DN:
                return (1);
 
        case ETHERTYPE_DN:
@@ -245,7 +246,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
                                ether_hdr_print(p - 18, length + 4);
                }
 
                                ether_hdr_print(p - 18, length + 4);
                }
 
-               if (!xflag && !qflag)
+               if (!suppress_default_print)
                        default_print(p - 18, caplen + 4);
 
                return (1);
                        default_print(p - 18, caplen + 4);
 
                return (1);
@@ -270,7 +271,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
                     ether_hdr_print(p - 16, length + 2);
                 }
 
                     ether_hdr_print(p - 16, length + 2);
                 }
 
-                if (!xflag && !qflag)
+                if (!suppress_default_print)
                     default_print(p - 16, caplen + 2);
 
                 return (1);
                     default_print(p - 16, caplen + 2);
 
                 return (1);
@@ -284,6 +285,10 @@ ether_encap_print(u_short ether_type, const u_char *p,
                pppoe_print(p, length);
                return (1);
 
                pppoe_print(p, length);
                return (1);
 
+       case ETHERTYPE_EAPOL:
+               eap_print(gndo, p, length);
+               return (1);
+
        case ETHERTYPE_PPP:
                if (length) {
                        printf(": ");
        case ETHERTYPE_PPP:
                if (length) {
                        printf(": ");
@@ -291,8 +296,12 @@ ether_encap_print(u_short ether_type, const u_char *p,
                }
                return (1);
 
                }
                return (1);
 
+       case ETHERTYPE_SLOW:
+               slow_print(p, length);
+               return (1);
+
         case ETHERTYPE_LOOPBACK:
         case ETHERTYPE_LOOPBACK:
-                return (0);
+                return (1);
 
        case ETHERTYPE_MPLS:
        case ETHERTYPE_MPLS_MULTI:
 
        case ETHERTYPE_MPLS:
        case ETHERTYPE_MPLS_MULTI:
@@ -308,3 +317,12 @@ ether_encap_print(u_short ether_type, const u_char *p,
                return (0);
        }
 }
                return (0);
        }
 }
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
+