X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/85175500a17a547ae208c61c1e1db8fb65383ac1..fe0fcd92e3ae841f7ccf84b250df1ec4afdaecbc:/print-isoclns.c diff --git a/print-isoclns.c b/print-isoclns.c index 11143cce..16cedfc4 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -25,8 +25,8 @@ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.105 2003-11-05 16:40:57 hannes Exp $ (LBL)"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.108 2003-11-16 09:36:25 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -1372,9 +1372,9 @@ static int isis_print (const u_int8_t *p, u_int length) printf(" (purged)"); else /* verify the checksum - - * checking starts at the lsp-id field - * which is 12 bytes after the packet start*/ - printf(" (%s)", (osi_cksum(optr+12, length-12)) ? "incorrect" : "correct"); + * checking starts at the lsp-id field at byte position [12] + * hence the length needs to be reduced by 12 bytes */ + printf(" (%s)", (osi_cksum((u_int8_t *)header_lsp->lsp_id, length-12)) ? "incorrect" : "correct"); printf(", PDU length: %u, Flags: [ %s", pdu_len, @@ -1852,9 +1852,15 @@ static int isis_print (const u_int8_t *p, u_int length) case TLV_CHECKSUM: if (!TTEST2(*tptr, 2)) goto trunctlv; - printf("\n\t checksum: 0x%04x (%s)", - EXTRACT_16BITS(tptr), - (osi_cksum(optr, length)) ? "incorrect" : "correct"); + printf("\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr)); + /* do not attempt to verify the checksum if it is zero + * most likely a HMAC-MD5 TLV is also present and + * to avoid conflicts the checksum TLV is zeroed. + * see rfc3358 for details + */ + if (EXTRACT_16BITS(tptr) == 0) + printf("(unverified)"); + else printf("(%s)", osi_cksum(optr, length) ? "incorrect" : "correct"); break; case TLV_MT_SUPPORTED: