#include "nameser.h"
#include "nfs.h"
-#include "bootp.h"
struct rtcphdr {
uint16_t rh_flags; /* T:2 P:1 CNT:5 PT:8 */
else
ip6 = NULL;
#endif /*INET6*/
- cp = (u_char *)(up + 1);
if (!ND_TTEST(up->uh_dport)) {
udpipaddr_print(ndo, ip, -1, -1);
ND_PRINT((ndo, "[|udp]"));
ND_PRINT((ndo, "truncated-udp %d", length));
return;
}
+ ulen = EXTRACT_16BITS(&up->uh_ulen);
+ if (ulen < sizeof(struct udphdr)) {
+ udpipaddr_print(ndo, ip, sport, dport);
+ ND_PRINT((ndo, "truncated-udplength %d", ulen));
+ return;
+ }
+ ulen -= sizeof(struct udphdr);
length -= sizeof(struct udphdr);
+ if (ulen < length)
+ length = ulen;
+ cp = (u_char *)(up + 1);
if (cp > ndo->ndo_snapend) {
udpipaddr_print(ndo, ip, sport, dport);
ND_PRINT((ndo, "[|udp]"));
return;
}
- ulen = EXTRACT_16BITS(&up->uh_ulen);
- if (ulen < 8) {
- udpipaddr_print(ndo, ip, sport, dport);
- ND_PRINT((ndo, "truncated-udplength %d", ulen));
- return;
- }
if (ndo->ndo_packettype) {
register struct sunrpc_msg *rp;
enum sunrpc_msg_type direction;
case PT_CNFP:
udpipaddr_print(ndo, ip, sport, dport);
- cnfp_print(ndo, cp, (const u_char *)ip);
+ cnfp_print(ndo, cp);
break;
case PT_TFTP:
timed_print(ndo, (const u_char *)(up + 1));
else if (ISPORT(TFTP_PORT))
tftp_print(ndo, (const u_char *)(up + 1), length);
- else if (ISPORT(IPPORT_BOOTPC) || ISPORT(IPPORT_BOOTPS))
+ else if (ISPORT(BOOTPC_PORT) || ISPORT(BOOTPS_PORT))
bootp_print(ndo, (const u_char *)(up + 1), length);
else if (ISPORT(RIP_PORT))
rip_print(ndo, (const u_char *)(up + 1), length);
else if (ISPORT(RADIUS_PORT) ||
ISPORT(RADIUS_NEW_PORT) ||
ISPORT(RADIUS_ACCOUNTING_PORT) ||
- ISPORT(RADIUS_NEW_ACCOUNTING_PORT) )
+ ISPORT(RADIUS_NEW_ACCOUNTING_PORT) ||
+ ISPORT(RADIUS_COA_PORT) )
radius_print(ndo, (const u_char *)(up+1), length);
else if (dport == HSRP_PORT)
hsrp_print(ndo, (const u_char *)(up + 1), length);
otv_print(ndo, (const u_char *)(up + 1), length);
else if (ISPORT(VXLAN_PORT))
vxlan_print(ndo, (const u_char *)(up + 1), length);
- else
- ND_PRINT((ndo, "UDP, length %u",
- (uint32_t)(ulen - sizeof(*up))));
+ else if (ISPORT(GENEVE_PORT))
+ geneve_print(ndo, (const u_char *)(up + 1), length);
+ else {
+ if (ulen > length)
+ ND_PRINT((ndo, "UDP, bad length %u > %u",
+ ulen, length));
+ else
+ ND_PRINT((ndo, "UDP, length %u", ulen));
+ }
#undef ISPORT
- } else
- ND_PRINT((ndo, "UDP, length %u", (uint32_t)(ulen - sizeof(*up))));
+ } else {
+ if (ulen > length)
+ ND_PRINT((ndo, "UDP, bad length %u > %u",
+ ulen, length));
+ else
+ ND_PRINT((ndo, "UDP, length %u", ulen));
+ }
}