X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/64e8f9a9ed91a3cbfa8e66367f87ef50a1d62b99..a63600a1fc28dbc7ae7ce9f996829c49a25fb33c:/print-bfd.c diff --git a/print-bfd.c b/print-bfd.c index cb0dcb26..2db14354 100644 --- a/print-bfd.c +++ b/print-bfd.c @@ -26,6 +26,7 @@ #include "netdissect-stdinc.h" +#define ND_LONGJMP_FROM_TCHECK #include "netdissect.h" #include "extract.h" @@ -145,7 +146,8 @@ static const struct tok bfd_diag_values[] = { static const struct tok bfd_port_values[] = { { BFD_CONTROL_PORT, "Control" }, { BFD_MULTIHOP_PORT, "Multihop" }, - { BFD_LAG_PORT, "Lag" }, + { BFD_LAG_PORT, "LAG" }, + { SBFD_PORT, "S-BFD" }, { 0, NULL } }; @@ -181,7 +183,7 @@ static const struct tok bfd_v1_state_values[] = { { 0, NULL } }; -static int +static void auth_print(netdissect_options *ndo, const u_char *pptr) { const struct bfd_auth_header_t *bfd_auth_header; @@ -221,9 +223,7 @@ auth_print(netdissect_options *ndo, const u_char *pptr) pptr++; ND_PRINT(", Password: "); /* the length is equal to the password length plus three */ - if (nd_printn(ndo, pptr, auth_len - 3, - ndo->ndo_snapend)) - goto trunc; + nd_printjn(ndo, pptr, auth_len - 3); break; case AUTH_MD5: case AUTH_MET_MD5: @@ -248,7 +248,6 @@ auth_print(netdissect_options *ndo, const u_char *pptr) break; } pptr += 2; - ND_TCHECK_4(pptr); ND_PRINT(", Sequence Number: 0x%08x", GET_BE_U_4(pptr)); pptr += 4; ND_TCHECK_LEN(pptr, AUTH_MD5_HASH_LEN); @@ -279,7 +278,6 @@ auth_print(netdissect_options *ndo, const u_char *pptr) break; } pptr += 2; - ND_TCHECK_4(pptr); ND_PRINT(", Sequence Number: 0x%08x", GET_BE_U_4(pptr)); pptr += 4; ND_TCHECK_LEN(pptr, AUTH_SHA1_HASH_LEN); @@ -288,10 +286,6 @@ auth_print(netdissect_options *ndo, const u_char *pptr) ND_PRINT("%02x", GET_U_1(pptr + i)); break; } - return 0; - -trunc: - return 1; } void @@ -301,7 +295,8 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, ndo->ndo_protocol = "bfd"; if (port == BFD_CONTROL_PORT || port == BFD_MULTIHOP_PORT || - port == BFD_LAG_PORT) { + port == BFD_LAG_PORT || + port == SBFD_PORT) { /* * Control packet. */ @@ -320,8 +315,7 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, /* BFDv0 */ case 0: - if (ndo->ndo_vflag < 1) - { + if (ndo->ndo_vflag < 1) { ND_PRINT("BFDv0, Control, Flags: [%s], length: %u", bittok2str(bfd_v0_flag_values, "none", flags), len); @@ -352,15 +346,13 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, GET_BE_U_4(bfd_header->required_min_echo_interval)/1000); if (flags & BFD_FLAG_AUTH) { - if (auth_print(ndo, pptr)) - goto trunc; + auth_print(ndo, pptr); } break; /* BFDv1 */ case 1: - if (ndo->ndo_vflag < 1) - { + if (ndo->ndo_vflag < 1) { ND_PRINT("BFDv1, %s, State %s, Flags: [%s], length: %u", tok2str(bfd_port_values, "unknown (%u)", port), tok2str(bfd_v1_state_values, "unknown (%u)", (flags & 0xc0) >> 6), @@ -395,8 +387,7 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, GET_BE_U_4(bfd_header->required_min_echo_interval)/1000); if (flags & BFD_FLAG_AUTH) { - if (auth_print(ndo, pptr)) - goto trunc; + auth_print(ndo, pptr); } break; @@ -432,8 +423,4 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, return; } } - return; - -trunc: - nd_print_trunc(ndo); }