X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/63216357de0aa557888329c614946626e37d7c6b..5ef0bcb5edd748de9d9af13c40da0395dfdd94e8:/print-udp.c diff --git a/print-udp.c b/print-udp.c index 75c4fb91..151b7e6b 100644 --- a/print-udp.c +++ b/print-udp.c @@ -103,7 +103,6 @@ vat_print(netdissect_options *ndo, const u_char *hdr, u_int length) ND_PRINT("udp/va/vat, length %u < 2", length); return; } - ND_TCHECK_2((const u_int *)hdr); ts = GET_BE_U_2(hdr); if ((ts & 0xf060) != 0) { /* probably vt */ @@ -118,9 +117,7 @@ vat_print(netdissect_options *ndo, const u_char *hdr, u_int length) ND_PRINT("udp/vat, length %u < 8", length); return; } - ND_TCHECK_4(&((const u_int *)hdr)[0]); i0 = GET_BE_U_4(&((const u_int *)hdr)[0]); - ND_TCHECK_4(&((const u_int *)hdr)[1]); i1 = GET_BE_U_4(&((const u_int *)hdr)[1]); ND_PRINT("udp/vat %u c%u %u%s", length - 8, @@ -132,10 +129,6 @@ vat_print(netdissect_options *ndo, const u_char *hdr, u_int length) if (i0 & 0x3f000000) ND_PRINT(" s%u", (i0 >> 24) & 0x3f); } - return; - -trunc: - nd_print_trunc(ndo); } static void @@ -152,9 +145,7 @@ rtp_print(netdissect_options *ndo, const u_char *hdr, u_int len) ND_PRINT("udp/rtp, length %u < 8", len); return; } - ND_TCHECK_4(&((const u_int *)hdr)[0]); i0 = GET_BE_U_4(&((const u_int *)hdr)[0]); - ND_TCHECK_4(&((const u_int *)hdr)[1]); i1 = GET_BE_U_4(&((const u_int *)hdr)[1]); dlen = len - 8; ip += 2; @@ -191,12 +182,10 @@ rtp_print(netdissect_options *ndo, const u_char *hdr, u_int len) i0 & 0xffff, i1); if (ndo->ndo_vflag) { - ND_TCHECK_4(&((const u_int *)hdr)[2]); ND_PRINT(" %u", GET_BE_U_4(&((const u_int *)hdr)[2])); if (hasopt) { u_int i2, optlen; do { - ND_TCHECK_4(ip); i2 = GET_BE_U_4(ip); optlen = (i2 >> 16) & 0xff; if (optlen == 0 || optlen > len) { @@ -209,7 +198,6 @@ rtp_print(netdissect_options *ndo, const u_char *hdr, u_int len) } if (hasext) { u_int i2, extlen; - ND_TCHECK_4(ip); i2 = GET_BE_U_4(ip); extlen = (i2 & 0xffff) + 1; if (extlen > len) { @@ -218,14 +206,9 @@ rtp_print(netdissect_options *ndo, const u_char *hdr, u_int len) } ip += extlen; } - ND_TCHECK_4(ip); if (contype == 0x1f) /*XXX H.261 */ ND_PRINT(" 0x%04x", GET_BE_U_4(ip) >> 16); } - return; - -trunc: - nd_print_trunc(ndo); } static const u_char * @@ -260,7 +243,7 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep) ND_TCHECK_SIZE(sr); ts = (double)(GET_BE_U_4(sr->sr_ntp.upper)) + ((double)(GET_BE_U_4(sr->sr_ntp.lower)) / - 4294967296.0); + FMAXINT); ND_PRINT(" @%.2f %u %up %ub", ts, GET_BE_U_4(sr->sr_ts), GET_BE_U_4(sr->sr_np), GET_BE_U_4(sr->sr_nb)); rr = (const struct rtcp_rr *)(sr + 1); @@ -459,7 +442,6 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, case PT_RPC: rp = (const struct sunrpc_msg *)cp; - ND_TCHECK_4(rp->rm_direction); direction = (enum sunrpc_msg_type) GET_BE_U_4(rp->rm_direction); if (direction == SUNRPC_CALL) sunrpc_print(ndo, (const u_char *)rp, length, @@ -577,7 +559,6 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, * TCP does, and we do so for UDP-over-IPv6. */ if (IP_V(ip) == 4 && (ndo->ndo_vflag > 1)) { - ND_TCHECK_2(up->uh_sum); udp_sum = GET_BE_U_2(up->uh_sum); if (udp_sum == 0) { ND_PRINT("[no cksum] "); @@ -596,7 +577,6 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, /* for IPv6, UDP checksum is mandatory */ if (ND_TTEST_LEN(cp, length)) { sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr)); - ND_TCHECK_2(up->uh_sum); udp_sum = GET_BE_U_2(up->uh_sum); if (sum != 0) { @@ -682,7 +662,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, IS_SRC_OR_DST_PORT(RADIUS_NEW_ACCOUNTING_PORT) || IS_SRC_OR_DST_PORT(RADIUS_CISCO_COA_PORT) || IS_SRC_OR_DST_PORT(RADIUS_COA_PORT) ) - radius_print(ndo, (const u_char *)(up+1), length); + radius_print(ndo, cp, length); else if (dport == HSRP_PORT) hsrp_print(ndo, cp, length); else if (IS_SRC_OR_DST_PORT(LWRES_PORT)) @@ -695,12 +675,12 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT)) lspping_print(ndo, cp, length); else if (sport == BCM_LI_PORT) - bcm_li_print(ndo, (const u_char *)(up+1), length); + bcm_li_print(ndo, cp, length); else if (dport == BFD_CONTROL_PORT || dport == BFD_MULTIHOP_PORT || dport == BFD_LAG_PORT || dport == BFD_ECHO_PORT ) - bfd_print(ndo, (const u_char *)(up+1), length, dport); + bfd_print(ndo, cp, length, dport); else if (IS_SRC_OR_DST_PORT(LMP_PORT)) lmp_print(ndo, cp, length); else if (IS_SRC_OR_DST_PORT(VQP_PORT))