} else {
ND_PRINT("%s.%s > %s.%s: ",
ip6addr_string(ndo, ip6->ip6_src),
- udpport_string(ndo, sport),
+ udpport_string(ndo, (uint16_t)sport),
ip6addr_string(ndo, ip6->ip6_dst),
- udpport_string(ndo, dport));
+ udpport_string(ndo, (uint16_t)dport));
}
} 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 {
} else {
ND_PRINT("%s.%s > %s.%s: ",
ipaddr_string(ndo, ip->ip_src),
- udpport_string(ndo, sport),
+ udpport_string(ndo, (uint16_t)sport),
ipaddr_string(ndo, ip->ip_dst),
- udpport_string(ndo, dport));
+ udpport_string(ndo, (uint16_t)dport));
}
} 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));
}
}
}
void
udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
- const u_char *bp2, int fragmented)
+ const u_char *bp2, int fragmented, u_int ttl_hl)
{
const struct udphdr *up;
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";
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);
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));
else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT))
isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_NATT))
- isakmp_rfc3948_print(ndo, (const u_char *)(up + 1), length, bp2);
+ isakmp_rfc3948_print(ndo, (const u_char *)(up + 1), length, bp2, IP_V(ip), fragmented, ttl_hl);
else if (IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER1) || IS_SRC_OR_DST_PORT(ISAKMP_PORT_USER2))
isakmp_print(ndo, (const u_char *)(up + 1), length, bp2);
else if (IS_SRC_OR_DST_PORT(SNMP_PORT) || IS_SRC_OR_DST_PORT(SNMPTRAP_PORT))
else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT))
lspping_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))