From: Ajith Adapa Date: Thu, 7 Feb 2013 05:37:29 +0000 (+0530) Subject: Fixes-for-test-results X-Git-Tag: tcpdump-4.4.0~3^2 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/cb85addfd6f1a7656d5d2b27104f92e64878eafe?ds=sidebyside;hp=-c Fixes-for-test-results --- cb85addfd6f1a7656d5d2b27104f92e64878eafe diff --git a/print-isoclns.c b/print-isoclns.c index b8b18138..4f8a5bb7 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -1328,8 +1328,7 @@ isis_print_mcid (const struct isis_spb_mcid *mcid) static int isis_print_mt_port_cap_subtlv (const u_int8_t *tptr, int len) { - int stlv_type; - int stlv_len; + int stlv_type, stlv_len; const struct isis_subtlv_spb_mcid *subtlv_spb_mcid; int i; @@ -1344,79 +1343,87 @@ isis_print_mt_port_cap_subtlv (const u_int8_t *tptr, int len) stlv_type, stlv_len); + /*len -= TLV_TYPE_LEN_OFFSET;*/ len = len -2; switch (stlv_type) { case ISIS_SUBTLV_SPB_MCID: + { + if (!TTEST2(*(tptr), ISIS_SUBTLV_SPB_MCID_MIN_LEN)) + goto trunctlv; - if (!TTEST2(*(tptr), ISIS_SUBTLV_SPB_MCID_MIN_LEN)) - goto trunctlv; + subtlv_spb_mcid = (struct isis_subtlv_spb_mcid *)tptr; - subtlv_spb_mcid = (struct isis_subtlv_spb_mcid *)tptr; + printf( "\n\t MCID: "); + isis_print_mcid (&(subtlv_spb_mcid->mcid)); - printf( "\n\t MCID: "); - isis_print_mcid (&(subtlv_spb_mcid->mcid)); + /*tptr += SPB_MCID_MIN_LEN; + len -= SPB_MCID_MIN_LEN; */ - printf( "\n\t AUX-MCID: "); - isis_print_mcid (&(subtlv_spb_mcid->aux_mcid)); + printf( "\n\t AUX-MCID: "); + isis_print_mcid (&(subtlv_spb_mcid->aux_mcid)); - tptr = tptr + sizeof(struct isis_subtlv_spb_mcid); - len = len - sizeof(struct isis_subtlv_spb_mcid); + /*tptr += SPB_MCID_MIN_LEN; + len -= SPB_MCID_MIN_LEN; */ + tptr = tptr + sizeof(struct isis_subtlv_spb_mcid); + len = len - sizeof(struct isis_subtlv_spb_mcid); - break; + break; + } case ISIS_SUBTLV_SPB_DIGEST: + { + if (!TTEST2(*(tptr), ISIS_SUBTLV_SPB_DIGEST_MIN_LEN)) + goto trunctlv; - if (!TTEST2(*(tptr), ISIS_SUBTLV_SPB_DIGEST_MIN_LEN)) - goto trunctlv; - - printf ("\n\t RES: %d V: %d A: %d D: %d", + printf ("\n\t RES: %d V: %d A: %d D: %d", (*(tptr) >> 5), (((*tptr)>> 4) & 0x01), ((*(tptr) >> 2) & 0x03), ((*tptr) & 0x03)); - tptr++; + tptr++; - printf( "\n\t Digest: "); + printf( "\n\t Digest: "); - for(i=1;i<=8; i++) - { + for(i=1;i<=8; i++) + { printf("%08x ", EXTRACT_32BITS(tptr)); if (i%4 == 0 && i != 8) printf("\n\t "); tptr = tptr + 4; - } + } - len = len - ISIS_SUBTLV_SPB_DIGEST_MIN_LEN; + len = len - ISIS_SUBTLV_SPB_DIGEST_MIN_LEN; - break; + break; + } case ISIS_SUBTLV_SPB_BVID: + { + if (!TTEST2(*(tptr), stlv_len)) + goto trunctlv; - if (!TTEST2(*(tptr), stlv_len)) + while (len) + { + if (!TTEST2(*(tptr), ISIS_SUBTLV_SPB_BVID_MIN_LEN)) goto trunctlv; - while (len) - { - if (!TTEST2(*(tptr), ISIS_SUBTLV_SPB_BVID_MIN_LEN)) - goto trunctlv; - - printf("\n\t ECT: %08x", + printf("\n\t ECT: %08x", EXTRACT_32BITS(tptr)); - tptr = tptr+4; + tptr = tptr+4; - printf(" B-Vlan: %d, U:%01x, M:%01x RES: %01x", + printf(" BVID: %d, U:%01x M:%01x ", (EXTRACT_16BITS (tptr) >> 4) , (EXTRACT_16BITS (tptr) >> 3) & 0x01, - (EXTRACT_16BITS (tptr) >> 2) & 0x01, - (EXTRACT_16BITS (tptr) & 0x03)); + (EXTRACT_16BITS (tptr) >> 2) & 0x01); - tptr = tptr + 2; - len = len - ISIS_SUBTLV_SPB_BVID_MIN_LEN; - } + tptr = tptr + 2; + len = len - ISIS_SUBTLV_SPB_BVID_MIN_LEN; + } - break; + break; + } default: break; @@ -1430,7 +1437,6 @@ isis_print_mt_port_cap_subtlv (const u_int8_t *tptr, int len) return(1); } - static int isis_print_mt_capability_subtlv (const u_int8_t *tptr, int len) { @@ -2754,7 +2760,7 @@ static int isis_print (const u_int8_t *p, u_int length) break; case ISIS_TLV_MT_PORT_CAP: - + { if (!TTEST2(*(tptr), 2)) goto trunctlv; @@ -2767,7 +2773,9 @@ static int isis_print (const u_int8_t *p, u_int length) if (tmp) isis_print_mt_port_cap_subtlv (tptr, tmp); + break; + } case ISIS_TLV_MT_CAPABILITY: diff --git a/print-stp.c b/print-stp.c index c88f6de9..7880268a 100644 --- a/print-stp.c +++ b/print-stp.c @@ -409,10 +409,12 @@ stp_print(const u_char *p, u_int length) if (length < STP_BPDU_MSTP_MIN_LEN) { goto trunc; } + if (stp_bpdu->v1_length != 0) { /* FIX ME: Emit a message here ? */ goto trunc; } + /* Validate v3 length */ mstp_len = EXTRACT_16BITS(p + MST_BPDU_VER3_LEN_OFFSET); mstp_len += 2; /* length encoding itself is 2 bytes */ @@ -422,6 +424,7 @@ stp_print(const u_char *p, u_int length) if (stp_bpdu->protocol_version == STP_PROTO_SPB) { + /* Validate v4 length */ spb_len = EXTRACT_16BITS (p + MST_BPDU_VER3_LEN_OFFSET + mstp_len); spb_len += 2; if (length < (sizeof(struct stp_bpdu_) + mstp_len + spb_len) || diff --git a/tests/spb_bpduv4.out b/tests/spb_bpduv4.out index adc519f2..748d4d25 100644 --- a/tests/spb_bpduv4.out +++ b/tests/spb_bpduv4.out @@ -1,25 +1,25 @@ -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] -STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward] +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205 +STP 802.1aq, Rapid STP, CIST Flags [Learn, Forward], length 205