]> The Tcpdump Group git mirrors - tcpdump/commitdiff
add support for DLT_JUNIPER_PPPOE, fix zero-length cookies
authorhannes <hannes>
Tue, 3 May 2005 20:35:41 +0000 (20:35 +0000)
committerhannes <hannes>
Tue, 3 May 2005 20:35:41 +0000 (20:35 +0000)
interface.h
print-juniper.c
tcpdump.c

index 7b182a74a848bf1d52d2dc616cc159c631a815a8..a48500c06d0d40db4d1ede490219a52d593b7620 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.248 2005-04-26 07:26:33 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.249 2005-05-03 20:35:41 hannes Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -253,6 +253,7 @@ extern u_int juniper_atm2_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_mfr_print(const struct pcap_pkthdr *, register const u_char *);
 extern u_int juniper_mlfr_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int juniper_mlppp_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_pppoe_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
 extern void snmp_print(const u_char *, u_int);
 extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
index 1f9cd12130c7c2736b4263af9a2f1d305a79b855..6853be731bb6aea9378c20306ba1ce2b3e9eb26e 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.11 2005-04-25 18:53:27 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.12 2005-05-03 20:35:42 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -51,7 +51,8 @@ enum {
     JUNIPER_ATM2,
     JUNIPER_MLPPP,
     JUNIPER_MLFR,
-    JUNIPER_MFR
+    JUNIPER_MFR,
+    JUNIPER_PPPOE
 };
 
 enum {
@@ -71,6 +72,7 @@ static struct juniper_cookie_table_t juniper_cookie_table[] = {
     { JUNIPER_MLPPP, 2, "MLPPP"},
     { JUNIPER_MLFR,  2, "MLFR"},
     { JUNIPER_MFR,   4, "MFR"},
+    { JUNIPER_PPPOE, 0, "PPPoE"},
 };
 
 struct juniper_l2info_t {
@@ -100,6 +102,22 @@ int ip_heuristic_guess(register const u_char *, u_int);
 int juniper_ppp_heuristic_guess(register const u_char *, u_int);
 static int juniper_parse_header (const u_char *, const struct pcap_pkthdr *, struct juniper_l2info_t *);
 
+u_int
+juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+        struct juniper_l2info_t l2info;
+
+        l2info.pictype = JUNIPER_PPPOE;
+        if(juniper_parse_header(p, h, &l2info) == 0)
+            return l2info.header_len;
+
+        p+=l2info.header_len;
+        /* this DLT contains nothing but raw ethernet frames */
+        ether_print(p, l2info.length, l2info.caplen);
+        return l2info.header_len;
+}
+
+
 u_int
 juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -427,15 +445,18 @@ juniper_parse_header (const u_char *p, const struct pcap_pkthdr *h, struct junip
             } else l2info->bundle = l2info->cookie[0];
 
             if (eflag)
-                printf("%s-PIC, cookie-len %u, cookie 0x",
+                printf("%s-PIC, cookie-len %u",
                        lp->s,
                        l2info->cookie_len);
-            
-            for (idx = 0; idx < l2info->cookie_len; idx++) {
-                l2info->cookie[idx] = p[idx]; /* copy cookie data */
-                if (eflag) printf("%02x",p[idx]);
+
+            if (eflag && l2info->cookie_len > 0) {
+                printf(", cookie 0x");
+                for (idx = 0; idx < l2info->cookie_len; idx++) {
+                    l2info->cookie[idx] = p[idx]; /* copy cookie data */
+                    if (eflag) printf("%02x",p[idx]);
+                }
             }
-            
+
             if (eflag) printf(": "); /* print demarc b/w L2/L3*/
             
 
index 9d7a8f5fd247c2102d11182692869423a9bbdd80..598fe183cb8b8b19d8e14c82e9b896e3225a25b5 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.254 2005-04-20 12:41:44 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.255 2005-05-03 20:35:41 hannes Exp $ (LBL)";
 #endif
 
 /*
@@ -234,6 +234,9 @@ static struct printer printers[] = {
 #endif
 #ifdef DLT_JUNIPER_MLPPP
        { juniper_mlppp_print,  DLT_JUNIPER_MLPPP },
+#endif
+#ifdef DLT_JUNIPER_PPPOE
+       { juniper_pppoe_print,  DLT_JUNIPER_PPPOE },
 #endif
        { NULL,                 0 },
 };