X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/306c2a0384af923a73bf234f3c8bc186ceff0b58..d2777156522f139a858bd6b5b51e364826bc95a7:/print-hsrp.c diff --git a/print-hsrp.c b/print-hsrp.c index 8f0ab18c..30278268 100644 --- a/print-hsrp.c +++ b/print-hsrp.c @@ -100,26 +100,20 @@ hsrp_print(netdissect_options *ndo, const u_char *bp, u_int len) uint8_t version; ndo->ndo_protocol = "hsrp"; - ND_TCHECK_1(hp->hsrp_version); version = GET_U_1(hp->hsrp_version); ND_PRINT("HSRPv%u", version); if (version != 0) return; - ND_TCHECK_1(hp->hsrp_op_code); ND_PRINT("-"); ND_PRINT("%s ", tok2strary(op_code_str, "unknown (%u)", GET_U_1(hp->hsrp_op_code))); ND_PRINT("%u: ", len); - ND_TCHECK_1(hp->hsrp_state); ND_PRINT("state=%s ", tok2str(states, "Unknown (%u)", GET_U_1(hp->hsrp_state))); - ND_TCHECK_1(hp->hsrp_group); ND_PRINT("group=%u ", GET_U_1(hp->hsrp_group)); - ND_TCHECK_1(hp->hsrp_reserved); if (GET_U_1(hp->hsrp_reserved) != 0) { ND_PRINT("[reserved=%u!] ", GET_U_1(hp->hsrp_reserved)); } - ND_TCHECK_4(hp->hsrp_virtaddr); ND_PRINT("addr=%s", GET_IPADDR_STRING(hp->hsrp_virtaddr)); if (ndo->ndo_vflag) { ND_PRINT(" hellotime="); @@ -128,14 +122,12 @@ hsrp_print(netdissect_options *ndo, const u_char *bp, u_int len) unsigned_relts_print(ndo, GET_U_1(hp->hsrp_holdtime)); ND_PRINT(" priority=%u", GET_U_1(hp->hsrp_priority)); ND_PRINT(" auth=\""); - if (nd_printn(ndo, hp->hsrp_authdata, sizeof(hp->hsrp_authdata), - ndo->ndo_snapend)) { - ND_PRINT("\""); - goto trunc; - } + /* + * RFC 2281 Section 5.1 does not specify the encoding of + * Authentication Data explicitly, but zero padding can be + * inferred from the "recommended default value". + */ + nd_printjnp(ndo, hp->hsrp_authdata, HSRP_AUTH_SIZE); ND_PRINT("\""); } - return; -trunc: - nd_print_trunc(ndo); }