X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/bef667db65b15c89ec6f1cf325b76acd3c0b8748..20ecf68b9ed076df8c7db120e69a44663c4e6e82:/print-udp.c diff --git a/print-udp.c b/print-udp.c index 646d4142..0f5c8307 100644 --- a/print-udp.c +++ b/print-udp.c @@ -354,8 +354,8 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo } else { if (sport != -1) { ND_PRINT("%s > %s: ", - udpport_string(ndo, sport), - udpport_string(ndo, dport)); + udpport_string(ndo, (uint16_t)sport), + udpport_string(ndo, (uint16_t)dport)); } } } else { @@ -389,7 +389,8 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, const struct ip *ip; const u_char *cp; const u_char *ep = ndo->ndo_snapend; - uint16_t sport, dport, ulen; + uint16_t sport, dport; + u_int ulen; const struct ip6_hdr *ip6; ndo->ndo_protocol = "udp"; @@ -417,6 +418,13 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, goto trunc; } ulen = GET_BE_U_2(up->uh_ulen); + /* + * IPv6 Jumbo Datagrams; see RFC 2675. + * If the length is zero, and the length provided to us is + * > 65535, use the provided length as the length. + */ + if (ulen == 0 && length > 65535) + ulen = length; if (ulen < sizeof(struct udphdr)) { udpipaddr_print(ndo, ip, sport, dport); ND_PRINT("truncated-udplength %u", ulen); @@ -512,6 +520,18 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, udpipaddr_print(ndo, ip, sport, dport); lmp_print(ndo, cp, length); break; + case PT_PTP: + udpipaddr_print(ndo, ip, sport, dport); + ptp_print(ndo, cp, length); + break; + case PT_SOMEIP: + udpipaddr_print(ndo, ip, sport, dport); + someip_print(ndo, cp, length); + break; + case PT_DOMAIN: + udpipaddr_print(ndo, ip, sport, dport); + domain_print(ndo, (const u_char *)(up + 1), length, 0); + break; } return; } @@ -571,7 +591,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, ND_PRINT("[udp sum ok] "); } } - else if (IP_V(ip) == 6 && ip6->ip6_plen) { + else if (IP_V(ip) == 6) { /* for IPv6, UDP checksum is mandatory */ if (ND_TTEST_LEN(cp, length)) { sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr)); @@ -671,7 +691,11 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, (IP_V(ip) == 6) ? 1 : 0); else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT)) lspping_print(ndo, (const u_char *)(up + 1), length); + else if (sport == BCM_LI_PORT) + bcm_li_print(ndo, (const u_char *)(up+1), 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); else if (IS_SRC_OR_DST_PORT(LMP_PORT)) @@ -702,13 +726,20 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, vxlan_gpe_print(ndo, (const u_char *)(up + 1), length); else if (IS_SRC_OR_DST_PORT(ZEP_PORT)) zep_print(ndo, (const u_char *)(up + 1), length); + else if (IS_SRC_OR_DST_PORT(MPLS_PORT)) + mpls_print(ndo, (const u_char *)(up + 1), length); else if (ND_TTEST_1(((const struct LAP *)cp)->type) && GET_U_1(((const struct LAP *)cp)->type) == lapDDP && (atalk_port(sport) || atalk_port(dport))) { if (ndo->ndo_vflag) ND_PRINT("kip "); llap_print(ndo, cp, length); - } else { + } else if (IS_SRC_OR_DST_PORT(PTP_EVENT_PORT) || + IS_SRC_OR_DST_PORT(PTP_GENERAL_PORT)) { + ptp_print(ndo, cp, length); + } else if (IS_SRC_OR_DST_PORT(SOMEIP_PORT)) + someip_print(ndo, (const u_char *)(up + 1), length); + else { if (ulen > length) ND_PRINT("UDP, bad length %u > %u", ulen, length);