]> The Tcpdump Group git mirrors - tcpdump/commitdiff
hide multiline output using vflag plus enhanced, ES-IS decoder
authorhannes <hannes>
Thu, 3 Oct 2002 16:00:32 +0000 (16:00 +0000)
committerhannes <hannes>
Thu, 3 Oct 2002 16:00:32 +0000 (16:00 +0000)
FILES
INSTALL
Makefile.in
ethertype.h
interface.h
print-ip.c
print-isoclns.c

diff --git a/FILES b/FILES
index 52625772df43fca3b44dddfaad030e98a1858fb9..ba5ce531908a07bad760ecbb0d36685cb0702f67 100644 (file)
--- a/FILES
+++ b/FILES
@@ -140,6 +140,7 @@ print-radius.c
 print-raw.c
 print-rip.c
 print-ripng.c
+print-rsvp.c
 print-rt6.c
 print-rx.c
 print-sctp.c
diff --git a/INSTALL b/INSTALL
index 66942699afb199483620a84c503968dc201b2442..f3e60a292c352395423d897555704cba763b4c7c 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,4 @@
-@(#) $Header: /tcpdump/master/tcpdump/Attic/INSTALL,v 1.50 2002-09-05 21:25:35 guy Exp $ (LBL)
+@(#) $Header: /tcpdump/master/tcpdump/Attic/INSTALL,v 1.51 2002-10-03 16:00:33 hannes Exp $ (LBL)
 
 If you have not built libpcap, do so first.  See the README
 file in this directory for the ftp location.
@@ -166,6 +166,7 @@ print-radius.c      - Radius protocol printer routines
 print-raw.c    - Raw IP printer routines
 print-rip.c    - Routing Information Protocol printer routines
 print-ripng.c  - IPv6 Routing Information Protocol printer routines
+print-rsvp.c    - Resource reSerVation Protocol (RSVP) printer routines
 print-rt6.c    - IPv6 routing header printer routines
 print-rx.c     - AFS RX printer routines
 print-sctp.c   - Stream Control Transmission Protocol printer routines
index 956347660e1bb66722f51eb8b3bac8630e0b2c7d..9db5c300b1f885f2c6b2d0313cff059bbb71657d 100644 (file)
@@ -17,7 +17,7 @@
 #  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 #
-# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.266 2002-09-05 21:25:35 guy Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.267 2002-10-03 16:00:33 hannes Exp $ (LBL)
 
 #
 # Various configurable paths (remember to edit Makefile.in, not Makefile)
@@ -78,7 +78,7 @@ CSRC =        addrtoname.c gmt2local.c machdep.c parsenfsfh.c \
        print-lwres.c print-msdp.c print-mobile.c print-mpls.c \
        print-nfs.c print-ntp.c print-null.c print-ospf.c \
        print-pflog.c print-pim.c print-ppp.c print-pppoe.c \
-       print-pptp.c print-radius.c print-raw.c print-rip.c \
+       print-pptp.c print-radius.c print-raw.c print-rip.c print-rsvp.c \
        print-rx.c print-sctp.c print-sl.c print-sll.c \
        print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
        print-tcp.c print-telnet.c print-tftp.c print-timed.c \
index f8deb31a6339233167138565c6aefc50c3b16e61..d3c9a53fa731b302248c05f7be77d13df719bcdb 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/ethertype.h,v 1.17 2002-09-11 22:15:16 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.18 2002-10-03 16:00:33 hannes Exp $ (LBL)
  */
 
 /*
 #ifndef        ETHERTYPE_ISO
 #define        ETHERTYPE_ISO           0xfefe  /* nonstandard - used in Cisco HDLC encapsulation */
 #endif
+
+/* FIXME complete the proto-id to string mapping */
+static const struct tok ethertype_values[] = { 
+    { ETHERTYPE_IP,            "IPv4" },
+    { ETHERTYPE_MPLS,          "MPLS unicast" },
+    { ETHERTYPE_MPLS_MULTI,    "MPLS multicast" },
+    { ETHERTYPE_IPV6,          "IPv6" },
+    { 0, NULL}
+};
index ea7c5593056e6395c2ca9eb365ca109f721e4521..8d01dfb560122581602fba0a86f893562f5ae5d1 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.194 2002-09-05 21:25:36 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.195 2002-10-03 16:00:33 hannes Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -253,6 +253,7 @@ extern void null_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
 extern void ospf_print(const u_char *, u_int, const u_char *);
 extern void pimv1_print(const u_char *, u_int);
 extern void cisco_autorp_print(const u_char *, u_int);
+extern void rsvp_print(const u_char *, u_int);
 extern void mobile_print(const u_char *, u_int);
 extern void pim_print(const u_char *, u_int);
 extern u_int pppoe_print(const u_char *, u_int);
index a94ae30e5e4ae724ba31830ae780ef170243b6e1..c88a2076d15d1b86a6079955b897ff0112c9dd36 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.113 2002-09-05 21:25:41 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.114 2002-10-03 16:00:34 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -549,6 +549,12 @@ again:
                        break;
 #endif /*INET6*/
 
+#ifndef IPPROTO_RSVP
+#define IPPROTO_RSVP 46
+#endif
+               case IPPROTO_RSVP:
+                       rsvp_print(cp, len);
+                       break;
 
 #ifndef IPPROTO_GRE
 #define IPPROTO_GRE 47
@@ -676,3 +682,4 @@ ipN_print(register const u_char *bp, register u_int length)
 }
 
 
+
index 6405a6615e95f3cc3f874639966f2ae2c0d71b73..96dcf92751d709bce9ba5da8dc45aff1e34bd5c5 100644 (file)
@@ -26,7 +26,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.62 2002-09-15 00:58:43 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.63 2002-10-03 16:00:34 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -122,6 +122,7 @@ static struct tok isis_pdu_values[] = {
 #define TLV_SHARED_RISK_GROUP   138
 #define TLV_NORTEL_PRIVATE1     176
 #define TLV_NORTEL_PRIVATE2     177
+#define TLV_HOLDTIME            198 /* ES-IS */
 #define TLV_RESTART_SIGNALING   211
 #define TLV_MT_IS_REACH         222
 #define TLV_MT_SUPPORTED        229
@@ -161,6 +162,7 @@ static struct tok isis_tlv_values[] = {
     { TLV_SHARED_RISK_GROUP, "Shared Risk Link Group"},
     { TLV_NORTEL_PRIVATE1,   "Nortel Proprietary"},
     { TLV_NORTEL_PRIVATE2,   "Nortel Proprietary"},
+    { TLV_HOLDTIME,          "Holdtime"},
     { TLV_RESTART_SIGNALING, "Restart Signaling"},
     { TLV_MT_IS_REACH,       "Multi Topology IS Reachability"},
     { TLV_MT_SUPPORTED,      "Multi Topology"},
@@ -310,7 +312,7 @@ static struct tok isis_lsp_istype_values[] = {
     { 0, NULL }
 };
 
-static struct tok isis_nlpid_values[] = {
+static struct tok osi_nlpid_values[] = {
     { NLPID_CLNS,   "CLNS"},
     { NLPID_IP,     "IPv4"},
     { NLPID_IP6,    "IPv6"},
@@ -496,18 +498,16 @@ void isoclns_print(const u_char *p, u_int length, u_int caplen,
                break;
 
        case NLPID_ESIS:
-               (void)printf("ESIS, length: %u", length);
                if (!eflag && esrc != NULL && edst != NULL)
-                       (void)printf(", %s > %s",
+                       (void)printf("%s > %s, ",
                                     etheraddr_string(esrc),
                                     etheraddr_string(edst));
                esis_print(p, length);
                return;
 
        case NLPID_ISIS:
-               (void)printf("ISIS, length: %u", length);
                if (!eflag && esrc != NULL && edst != NULL)
-                       (void)printf(", %s > %s",
+                       (void)printf("%s > %s, ",
                             etheraddr_string(esrc),
                             etheraddr_string(edst));
                if (!isis_print(p, length))
@@ -538,6 +538,13 @@ void isoclns_print(const u_char *p, u_int length, u_int caplen,
 #define        ESIS_ESH        2
 #define        ESIS_ISH        4
 
+static struct tok esis_values[] = {
+    { ESIS_REDIRECT, "redirect"},
+    { ESIS_ESH,      "ESH"},
+    { ESIS_ISH,      "ISH"},
+    { 0, NULL }
+};
+
 struct esis_hdr {
        u_char version;
        u_char reserved;
@@ -580,24 +587,14 @@ esis_print(const u_char *p, u_int length)
                }
                return;
        }
-       switch (eh->type & 0x1f) {
 
-       case ESIS_REDIRECT:
-               printf(" redirect");
-               break;
+        printf("ES-IS, %s, length: %u",
+               tok2str(esis_values,"unknown type: %u",eh->type & 0x1f),
+               length);
 
-       case ESIS_ESH:
-               printf(" ESH");
-               break;
+        if(vflag < 1)
+               return;
 
-       case ESIS_ISH:
-               printf(" ISH");
-               break;
-
-       default:
-               printf(" type %d", eh->type & 0x1f);
-               break;
-       }
        if (vflag && osi_cksum(p, li)) {
                printf(" bad cksum (got 0x%02x%02x)",
                       eh->cksum[1], eh->cksum[0]);
@@ -634,11 +631,10 @@ esis_print(const u_char *p, u_int length)
                li = ep - p;
                break;
        }
-#if 0
+
        case ESIS_ESH:
-               printf(" ESH");
                break;
-#endif
+
        case ESIS_ISH: {
                const u_char *is;
 
@@ -656,13 +652,18 @@ esis_print(const u_char *p, u_int length)
        }
 
        default:
-               (void)printf(" len=%d", length);
-               if (length && p < snapend) {
-                       length = snapend - p;
-                       default_print(p, length);
-               }
-               return;
+            if (vflag <= 1) {
+                   if (p < snapend) 
+                            print_unknown_data(p,"\n\t  ",snapend-p);
+            }
+            return;
        }
+
+        /* hexdump - FIXME ? */
+        if (vflag > 1) {
+                    if (p < snapend)
+                            print_unknown_data(p,"\n\t  ",snapend-p);
+        }
        if (vflag)
                while (p < ep && li) {
                        u_int op, opli;
@@ -671,29 +672,37 @@ esis_print(const u_char *p, u_int length)
                        if (snapend - p < 2)
                                return;
                        if (li < 2) {
-                               printf(" bad opts/li");
+                               printf(", bad opts/li");
                                return;
                        }
                        op = *p++;
                        opli = *p++;
                        li -= 2;
                        if (opli > li) {
-                               printf(" opt (%d) too long", op);
+                               printf(", opt (%d) too long", op);
                                return;
                        }
                        li -= opli;
                        q = p;
                        p += opli;
+
                        if (snapend < p)
                                return;
-                       if (op == 198 && opli == 2) {
-                               printf(" tmo=%d", q[0] * 256 + q[1]);
+
+                       if (op == TLV_HOLDTIME && opli == 2) {
+                               printf("\n\tholdtime: %us", EXTRACT_16BITS(q));
                                continue;
                        }
-                       printf (" %d:<", op);
-                       while (opli-- > 0)
-                               printf("%02x", *q++);
-                       printf (">");
+
+                       if (op == TLV_PROTOCOLS && opli >= 1) {
+                               printf("\n\t%s (length: %u): %s",
+                                       tok2str(isis_tlv_values, "unknown", op),
+                                       opli,
+                                       tok2str(osi_nlpid_values,"Unknown 0x%02x",*q));
+                               continue;
+                       }
+
+                        print_unknown_data(q,"\n\t  ",opli);
                }
 }
 
@@ -1180,6 +1189,19 @@ static int isis_print (const u_char *p, u_int length)
        break;
     }
 
+    pdu_type=header->pdu_type;
+
+    /* in non-verbose mode just lets print the basic PDU Type*/
+    if (vflag < 1) {
+        printf("IS-IS, %s, length: %u",
+               tok2str(isis_pdu_values,"unknown PDU-Type %u",pdu_type),
+               length);
+        return(1);
+    }
+
+    /* ok they seem to want to know everything - lets fully decode it */
+    printf("IS-IS, length: %u",length);
+
     printf("\n\thlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
            header->fixed_len,
            header->version,
@@ -1189,12 +1211,10 @@ static int isis_print (const u_char *p, u_int length)
            max_area,
            header->max_area);
 
-    pdu_type=header->pdu_type;
-
     /* first lets see if we know the PDU name*/
     printf(", pdu-type: %s",
            tok2str(isis_pdu_values,
-                   "unknown, type %d",
+                   "unknown, type %u",
                    pdu_type));
 
     if (vflag) {
@@ -1846,7 +1866,7 @@ static int isis_print (const u_char *p, u_int length)
                if (!TTEST2(*(tptr), 1))
                    goto trunctlv;
                printf("%s",
-                       tok2str(isis_nlpid_values,
+                       tok2str(osi_nlpid_values,
                                "Unknown 0x%02x",
                                *tptr++));
                if (tmp>1) /* further NPLIDs ? - put comma */
@@ -2061,13 +2081,14 @@ static int isis_print (const u_char *p, u_int length)
         case TLV_MT_IP6_REACH:
 
        default:
-            if (!vflag) {
+            if (vflag <= 1) {
                 if(!print_unknown_data(pptr,"\n\t\t",len))
                     return(0);
             }
            break;
        }
-        if (vflag) {
+        /* do we want to see an additionally hexdump ? */
+        if (vflag> 1) {
            if(!print_unknown_data(pptr,"\n\t\t",len))
                return(0);
         }