X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ac602ba5565eb851b402a29f76bf9fd3d8753671..a63600a1fc28dbc7ae7ce9f996829c49a25fb33c:/print-pgm.c diff --git a/print-pgm.c b/print-pgm.c index ccb0b46a..3b063ba7 100644 --- a/print-pgm.c +++ b/print-pgm.c @@ -21,6 +21,7 @@ #include "netdissect-stdinc.h" +#define ND_LONGJMP_FROM_TCHECK #include "netdissect.h" #include "extract.h" #include "addrtoname.h" @@ -174,8 +175,7 @@ pgm_print(netdissect_options *ndo, GET_IPADDR_STRING(ip->ip_src), GET_IPADDR_STRING(ip->ip_dst)); } - nd_print_trunc(ndo); - return; + nd_trunc_longjmp(ndo); } sport = GET_BE_U_2(pgm->pgm_sport); @@ -229,18 +229,18 @@ pgm_print(netdissect_options *ndo, bp = (const u_char *) (spm + 1); switch (GET_BE_U_2(spm->pgms_nla_afi)) { - case AFNUM_INET: + case AFNUM_IP: ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); addrtostr(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(nd_ipv4); break; - case AFNUM_INET6: + case AFNUM_IP6: ND_TCHECK_LEN(bp, sizeof(nd_ipv6)); addrtostr6(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(nd_ipv6); break; default: - goto trunc; + goto invalid; break; } @@ -261,18 +261,18 @@ pgm_print(netdissect_options *ndo, bp = (const u_char *) (pgm_poll + 1); switch (GET_BE_U_2(pgm_poll->pgmp_nla_afi)) { - case AFNUM_INET: + case AFNUM_IP: ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); addrtostr(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(nd_ipv4); break; - case AFNUM_INET6: + case AFNUM_IP6: ND_TCHECK_LEN(bp, sizeof(nd_ipv6)); addrtostr6(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(nd_ipv6); break; default: - goto trunc; + goto invalid; break; } @@ -306,7 +306,6 @@ pgm_print(netdissect_options *ndo, const struct pgm_data *odata; odata = (const struct pgm_data *)(pgm + 1); - ND_TCHECK_SIZE(odata); ND_PRINT("ODATA trail %u seq %u", GET_BE_U_4(odata->pgmd_trailseq), GET_BE_U_4(odata->pgmd_seq)); @@ -318,7 +317,6 @@ pgm_print(netdissect_options *ndo, const struct pgm_data *rdata; rdata = (const struct pgm_data *)(pgm + 1); - ND_TCHECK_SIZE(rdata); ND_PRINT("RDATA trail %u seq %u", GET_BE_U_4(rdata->pgmd_trailseq), GET_BE_U_4(rdata->pgmd_seq)); @@ -341,18 +339,18 @@ pgm_print(netdissect_options *ndo, * and stopping if we don't have enough. */ switch (GET_BE_U_2(nak->pgmn_source_afi)) { - case AFNUM_INET: + case AFNUM_IP: ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); addrtostr(bp, source_buf, sizeof(source_buf)); bp += sizeof(nd_ipv4); break; - case AFNUM_INET6: + case AFNUM_IP6: ND_TCHECK_LEN(bp, sizeof(nd_ipv6)); addrtostr6(bp, source_buf, sizeof(source_buf)); bp += sizeof(nd_ipv6); break; default: - goto trunc; + goto invalid; break; } @@ -362,18 +360,18 @@ pgm_print(netdissect_options *ndo, */ bp += (2 * sizeof(uint16_t)); switch (GET_BE_U_2(bp)) { - case AFNUM_INET: + case AFNUM_IP: ND_TCHECK_LEN(bp, sizeof(nd_ipv4)); addrtostr(bp, group_buf, sizeof(group_buf)); bp += sizeof(nd_ipv4); break; - case AFNUM_INET6: + case AFNUM_IP6: ND_TCHECK_LEN(bp, sizeof(nd_ipv6)); addrtostr6(bp, group_buf, sizeof(group_buf)); bp += sizeof(nd_ipv6); break; default: - goto trunc; + goto invalid; break; } @@ -574,7 +572,7 @@ pgm_print(netdissect_options *ndo, nla_afnum = GET_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { - case AFNUM_INET: + case AFNUM_IP: if (opt_len != PGM_OPT_REDIRECT_FIXED_LEN + sizeof(nd_ipv4)) { ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]", opt_len, PGM_OPT_REDIRECT_FIXED_LEN); @@ -585,7 +583,7 @@ pgm_print(netdissect_options *ndo, bp += sizeof(nd_ipv4); opts_len -= PGM_OPT_REDIRECT_FIXED_LEN + sizeof(nd_ipv4); break; - case AFNUM_INET6: + case AFNUM_IP6: if (opt_len != PGM_OPT_REDIRECT_FIXED_LEN + sizeof(nd_ipv6)) { ND_PRINT("[Bad OPT_REDIRECT option, length %u != %u + address size]", opt_len, PGM_OPT_REDIRECT_FIXED_LEN); @@ -597,7 +595,7 @@ pgm_print(netdissect_options *ndo, opts_len -= PGM_OPT_REDIRECT_FIXED_LEN + sizeof(nd_ipv6); break; default: - goto trunc; + goto invalid; break; } @@ -731,7 +729,7 @@ pgm_print(netdissect_options *ndo, nla_afnum = GET_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { - case AFNUM_INET: + case AFNUM_IP: if (opt_len != PGM_OPT_PGMCC_DATA_FIXED_LEN + sizeof(nd_ipv4)) { ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]", opt_len, PGM_OPT_PGMCC_DATA_FIXED_LEN); @@ -742,7 +740,7 @@ pgm_print(netdissect_options *ndo, bp += sizeof(nd_ipv4); opts_len -= PGM_OPT_PGMCC_DATA_FIXED_LEN + sizeof(nd_ipv4); break; - case AFNUM_INET6: + case AFNUM_IP6: if (opt_len != PGM_OPT_PGMCC_DATA_FIXED_LEN + sizeof(nd_ipv6)) { ND_PRINT("[Bad OPT_PGMCC_DATA option, length %u != %u + address size]", opt_len, PGM_OPT_PGMCC_DATA_FIXED_LEN); @@ -754,7 +752,7 @@ pgm_print(netdissect_options *ndo, opts_len -= PGM_OPT_PGMCC_DATA_FIXED_LEN + sizeof(nd_ipv6); break; default: - goto trunc; + goto invalid; break; } @@ -774,7 +772,7 @@ pgm_print(netdissect_options *ndo, nla_afnum = GET_BE_U_2(bp); bp += 2+2; switch (nla_afnum) { - case AFNUM_INET: + case AFNUM_IP: if (opt_len != PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN + sizeof(nd_ipv4)) { ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]", opt_len, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN); @@ -785,7 +783,7 @@ pgm_print(netdissect_options *ndo, bp += sizeof(nd_ipv4); opts_len -= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN + sizeof(nd_ipv4); break; - case AFNUM_INET6: + case AFNUM_IP6: if (opt_len != PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN + sizeof(nd_ipv6)) { ND_PRINT("[Bad OPT_PGMCC_FEEDBACK option, length %u != %u + address size]", opt_len, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN); @@ -797,7 +795,7 @@ pgm_print(netdissect_options *ndo, opts_len -= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN + sizeof(nd_ipv6); break; default: - goto trunc; + goto invalid; break; } @@ -823,7 +821,6 @@ pgm_print(netdissect_options *ndo, GET_BE_U_2(pgm->pgm_length)); return; - -trunc: - nd_print_trunc(ndo); +invalid: + nd_print_invalid(ndo); }