]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-juniper.c
add GRE and RSVP to the supported IPv6 protos
[tcpdump] / print-juniper.c
index 32b2e11ffa494f6c4a5bdc0043a000d05bc9261a..92ef4534577ccd7bf93b72e91f3f985af4b0104d 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8.2.9 2005-05-22 21:25:41 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8.2.13 2005-06-20 07:45:05 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -34,6 +34,7 @@ static const char rcsid[] _U_ =
 #include "llc.h"
 #include "nlpid.h"
 #include "ethertype.h"
+#include "atm.h"
 
 #define JUNIPER_BPF_OUT           0       /* Outgoing packet */
 #define JUNIPER_BPF_IN            1       /* Incoming packet */
@@ -76,17 +77,40 @@ struct juniper_cookie_table_t {
 };
 
 static struct juniper_cookie_table_t juniper_cookie_table[] = {
+#ifdef DLT_JUNIPER_ATM1
     { DLT_JUNIPER_ATM1,  4, "ATM1"},
+#endif
+#ifdef DLT_JUNIPER_ATM2
     { DLT_JUNIPER_ATM2,  8, "ATM2"},
+#endif
+#ifdef DLT_JUNIPER_MLPPP
     { DLT_JUNIPER_MLPPP, 2, "MLPPP"},
+#endif
+#ifdef DLT_JUNIPER_MLFR
     { DLT_JUNIPER_MLFR,  2, "MLFR"},
+#endif
+#ifdef DLT_JUNIPER_MFR
     { DLT_JUNIPER_MFR,   4, "MFR"},
+#endif
+#ifdef DLT_JUNIPER_PPPOE
     { DLT_JUNIPER_PPPOE, 0, "PPPoE"},
+#endif
+#ifdef DLT_JUNIPER_PPPOE_ATM
     { DLT_JUNIPER_PPPOE_ATM, 0, "PPPoE ATM"},
+#endif
+#ifdef DLT_JUNIPER_GGSN
     { DLT_JUNIPER_GGSN, 8, "GGSN"},
+#endif
+#ifdef DLT_JUNIPER_MONITOR
     { DLT_JUNIPER_MONITOR, 8, "MONITOR"},
+#endif
+#ifdef DLT_JUNIPER_SERVICES
     { DLT_JUNIPER_SERVICES, 8, "AS"},
+#endif
+#ifdef DLT_JUNIPER_ES
     { DLT_JUNIPER_ES, 0, "ES"},
+#endif
+    { 0, 0, NULL }
 };
 
 struct juniper_l2info_t {
@@ -128,6 +152,7 @@ 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 *);
 
+#ifdef DLT_JUNIPER_GGSN
 u_int
 juniper_ggsn_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -171,7 +196,9 @@ juniper_ggsn_print(const struct pcap_pkthdr *h, register const u_char *p)
 
         return l2info.header_len;
 }
+#endif
 
+#ifdef DLT_JUNIPER_ES
 u_int
 juniper_es_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -239,7 +266,9 @@ juniper_es_print(const struct pcap_pkthdr *h, register const u_char *p)
         ip_print(gndo, p, l2info.length);
         return l2info.header_len;
 }
+#endif
 
+#ifdef DLT_JUNIPER_MONITOR
 u_int
 juniper_monitor_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -270,7 +299,9 @@ juniper_monitor_print(const struct pcap_pkthdr *h, register const u_char *p)
 
         return l2info.header_len;
 }
+#endif
 
+#ifdef DLT_JUNIPER_SERVICES
 u_int
 juniper_services_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -302,7 +333,9 @@ juniper_services_print(const struct pcap_pkthdr *h, register const u_char *p)
 
         return l2info.header_len;
 }
+#endif
 
+#ifdef DLT_JUNIPER_PPPOE
 u_int
 juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -317,7 +350,9 @@ juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p)
         ether_print(p, l2info.length, l2info.caplen);
         return l2info.header_len;
 }
+#endif
 
+#ifdef DLT_JUNIPER_PPPOE_ATM
 u_int
 juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -343,7 +378,9 @@ juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p)
         
         return l2info.header_len;
 }
+#endif
 
+#ifdef DLT_JUNIPER_MLPPP
 u_int
 juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -367,9 +404,11 @@ juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
         case JUNIPER_LSQ_L3_PROTO_IPV4:
             ip_print(gndo, p, l2info.length);
             return l2info.header_len;
+#ifdef INET6
         case JUNIPER_LSQ_L3_PROTO_IPV6:
             ip6_print(p,l2info.length);
             return l2info.header_len;
+#endif
         case JUNIPER_LSQ_L3_PROTO_MPLS:
             mpls_print(p,l2info.length);
             return l2info.header_len;
@@ -393,8 +432,10 @@ juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
 
         return l2info.header_len;
 }
+#endif
 
 
+#ifdef DLT_JUNIPER_MFR
 u_int
 juniper_mfr_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -423,7 +464,9 @@ juniper_mfr_print(const struct pcap_pkthdr *h, register const u_char *p)
 
         return l2info.header_len;
 }
+#endif
 
+#ifdef DLT_JUNIPER_MLFR
 u_int
 juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -454,6 +497,7 @@ juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
 
         return l2info.header_len;
 }
+#endif
 
 /*
  *     ATM1 PIC cookie format
@@ -463,6 +507,7 @@ juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
  *     +-----+-------------------------+-------------------------------+
  */
 
+#ifdef DLT_JUNIPER_ATM1
 u_int
 juniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
@@ -477,7 +522,7 @@ juniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p)
         p+=l2info.header_len;
 
         if (l2info.cookie[0] == 0x80) { /* OAM cell ? */
-            oam_print(p,l2info.length);
+            oam_print(p,l2info.length,ATM_OAM_NOHEC);
             return l2info.header_len;
         }
 
@@ -500,6 +545,7 @@ juniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p)
 
        return l2info.header_len;
 }
+#endif
 
 /*
  *     ATM2 PIC cookie format
@@ -509,10 +555,12 @@ juniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p)
  *     +-------------------------------+---------+---+-----+-----------+
  */
 
+#ifdef DLT_JUNIPER_ATM2
 u_int
 juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p)
 {
         u_int16_t extracted_ethertype;
+        u_int32_t control_word;
 
         struct juniper_l2info_t l2info;
 
@@ -523,7 +571,13 @@ juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p)
         p+=l2info.header_len;
 
         if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */
-            oam_print(p,l2info.length);
+            control_word = EXTRACT_32BITS(p);
+            if(control_word == 0 || control_word == 0x08000000) {
+                l2info.header_len += 4;
+                l2info.length -= 4;
+                p += 4;
+            }
+            oam_print(p,l2info.length,ATM_OAM_NOHEC);
             return l2info.header_len;
         }
 
@@ -555,6 +609,7 @@ juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p)
 
        return l2info.header_len;
 }
+#endif
 
 
 /* try to guess, based on all PPP protos that are supported in