From: hannes Date: Tue, 26 Apr 2005 09:42:44 +0000 (+0000) Subject: differentiate between SLARP_LEN and SLARP_MIN_LEN - otherwise we do print the trailin... X-Git-Tag: tcpdump-3.9.1~88 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/6719a17dc6d3e6f08805125ecf7d618d9a93ca4e differentiate between SLARP_LEN and SLARP_MIN_LEN - otherwise we do print the trailing-junk message for all short frames (and we should it print for frames > 18 --- diff --git a/print-chdlc.c b/print-chdlc.c index 8d272620..8b32cf91 100644 --- a/print-chdlc.c +++ b/print-chdlc.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.32.2.4 2005-04-19 08:07:03 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.32.2.5 2005-04-26 09:42:44 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_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_MIN_LEN) { /* uptime-stamp is optional */ + cp += SLARP_MIN_LEN; if (!TTEST2(*cp, 4)) goto trunc; sec = EXTRACT_32BITS(cp) / 1000;