X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/4806d509852dd162efd0669e6d3f75f174f2cb1b..10ac80fdecfa9b9b7d259d8f50d0b72ef1b18f12:/print-udp.c diff --git a/print-udp.c b/print-udp.c index 96d827cc..0efb0f1e 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 * @@ -342,13 +325,13 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo if (GET_U_1(ip6->ip6_nxt) == IPPROTO_UDP) { if (sport == -1) { ND_PRINT("%s > %s: ", - ip6addr_string(ndo, ip6->ip6_src), - ip6addr_string(ndo, ip6->ip6_dst)); + GET_IP6ADDR_STRING(ip6->ip6_src), + GET_IP6ADDR_STRING(ip6->ip6_dst)); } else { ND_PRINT("%s.%s > %s.%s: ", - ip6addr_string(ndo, ip6->ip6_src), + GET_IP6ADDR_STRING(ip6->ip6_src), udpport_string(ndo, (uint16_t)sport), - ip6addr_string(ndo, ip6->ip6_dst), + GET_IP6ADDR_STRING(ip6->ip6_dst), udpport_string(ndo, (uint16_t)dport)); } } else { @@ -362,13 +345,13 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo if (GET_U_1(ip->ip_p) == IPPROTO_UDP) { if (sport == -1) { ND_PRINT("%s > %s: ", - ipaddr_string(ndo, ip->ip_src), - ipaddr_string(ndo, ip->ip_dst)); + GET_IPADDR_STRING(ip->ip_src), + GET_IPADDR_STRING(ip->ip_dst)); } else { ND_PRINT("%s.%s > %s.%s: ", - ipaddr_string(ndo, ip->ip_src), + GET_IPADDR_STRING(ip->ip_src), udpport_string(ndo, (uint16_t)sport), - ipaddr_string(ndo, ip->ip_dst), + GET_IPADDR_STRING(ip->ip_dst), udpport_string(ndo, (uint16_t)dport)); } } else { @@ -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))