diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-01-25 22:38:34 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-01-25 22:38:34 -0800 |
commit | b89e946e5ec0beca0121ed0c3b2490ecbd0f317f (patch) | |
tree | bbc2623290915262fc41c6e2b10619d9e46652d9 /print-bgp.c | |
parent | 93f356121080660d14c867e1dbebe851d90dc245 (diff) | |
download | tcpdump-b89e946e5ec0beca0121ed0c3b2490ecbd0f317f.tar.gz |
Make the cases in bgp_capabilities_print() more similar to each other.
Diffstat (limited to 'print-bgp.c')
-rw-r--r-- | print-bgp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/print-bgp.c b/print-bgp.c index f3e1a49a..5a8f279e 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -2500,7 +2500,6 @@ bgp_capabilities_print(netdissect_options *ndo, ND_TCHECK_LEN(opt + i, BGP_CAP_HEADER_SIZE); cap_type=EXTRACT_U_1(opt + i); cap_len=EXTRACT_U_1(opt + i + 1); - tcap_len=cap_len; ND_PRINT("\n\t %s (%u), length: %u", tok2str(bgp_capcode_values, "Unknown", cap_type), cap_type, @@ -2508,7 +2507,7 @@ bgp_capabilities_print(netdissect_options *ndo, ND_TCHECK_LEN(opt + 2 + i, cap_len); switch (cap_type) { case BGP_CAPCODE_MP: - if (tcap_len < 4) { + if (cap_len < 4) { ND_PRINT(" (too short, < 4)"); return; } @@ -2519,10 +2518,11 @@ bgp_capabilities_print(netdissect_options *ndo, EXTRACT_U_1(opt + i + 5)); break; case BGP_CAPCODE_RESTART: - if (tcap_len < 2) { + if (cap_len < 2) { ND_PRINT(" (too short, < 2)"); return; } + tcap_len=cap_len; ND_PRINT("\n\t\tRestart Flags: [%s], Restart Time %us", ((EXTRACT_U_1(opt + i + 2))&0x80) ? "R" : "none", EXTRACT_BE_U_2(opt + i + 2)&0xfff); @@ -2545,7 +2545,6 @@ bgp_capabilities_print(netdissect_options *ndo, case BGP_CAPCODE_RR_CISCO: break; case BGP_CAPCODE_AS_NEW: - /* * Extract the 4 byte AS number encoded. */ @@ -2558,11 +2557,12 @@ bgp_capabilities_print(netdissect_options *ndo, EXTRACT_BE_U_4(opt + i + 2))); break; case BGP_CAPCODE_ADD_PATH: - cap_offset=2; - if (tcap_len == 0) { + if (cap_len == 0) { ND_PRINT(" (bogus)"); /* length */ break; } + tcap_len=cap_len; + cap_offset=2; while (tcap_len != 0) { if (tcap_len < 4) { ND_PRINT("\n\t\t(invalid)"); |