]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-chdlc.c
update change log: add support for LACP, MARKER as per 802.3ad
[tcpdump] / print-chdlc.c
index 18b232aad2f4d2dac9ee47e866b88d05ed467235..0865888883573aebca57df6db94881f7f4afe380 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.36 2005-04-19 08:06:09 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.39 2005-04-27 14:33:24 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -133,7 +133,8 @@ struct cisco_slarp {
        } un;
 };
 
-#define SLARP_LEN      14
+#define SLARP_MIN_LEN  14
+#define SLARP_MAX_LEN  18
 
 static void
 chdlc_slarp_print(const u_char *cp, u_int length)
@@ -142,11 +143,11 @@ chdlc_slarp_print(const u_char *cp, u_int length)
         u_int sec,min,hrs,days;
 
         printf("SLARP (length: %u), ",length);
-       if (length < SLARP_LEN)
+       if (length < SLARP_MIN_LEN)
                goto trunc;
 
        slarp = (const struct cisco_slarp *)cp;
-       TCHECK2(*slarp, SLARP_LEN);
+       TCHECK2(*slarp, SLARP_MIN_LEN);
        switch (EXTRACT_32BITS(&slarp->code)) {
        case SLARP_REQUEST:
                printf("request");
@@ -171,8 +172,8 @@ chdlc_slarp_print(const u_char *cp, u_int length)
                        EXTRACT_32BITS(&slarp->un.keep.yourseq),
                        EXTRACT_16BITS(&slarp->un.keep.rel));
 
-                if (length >= SLARP_LEN) { /* uptime-stamp is optional */
-                        cp += SLARP_LEN;
+                if (length >= SLARP_MAX_LEN) { /* uptime-stamp is optional */
+                        cp += SLARP_MIN_LEN;
                         if (!TTEST2(*cp, 4))
                                 goto trunc;
                         sec = EXTRACT_32BITS(cp) / 1000;
@@ -189,8 +190,8 @@ chdlc_slarp_print(const u_char *cp, u_int length)
                break;
        }
 
-       if (SLARP_LEN < length && vflag)
-               printf(", (trailing junk: %d bytes)", length - SLARP_LEN);
+       if (SLARP_MAX_LEN < length && vflag)
+               printf(", (trailing junk: %d bytes)", length - SLARP_MAX_LEN);
         if (vflag > 1)
             print_unknown_data(cp+4,"\n\t",length-4);
        return;