From ec9e40767d3faae9db7fd358a829730a1f82a2b4 Mon Sep 17 00:00:00 2001 From: tuexen Date: Mon, 6 Oct 2014 17:12:03 +0000 Subject: MFC r272408: Check for UDP/IPv6 packets that the length in the UDP header is at least the minimum. Make the check similar to the one for UDPLite/IPv6. --- sys/netinet6/udp6_usrreq.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'sys/netinet6') diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 7eb64fd..b837601 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -235,18 +235,9 @@ udp6_input(struct mbuf **mp, int *offp, int proto) /* XXX: What is the right UDPLite MIB counter? */ goto badunlocked; } - } - if (nxt == IPPROTO_UDP && plen != ulen) { - UDPSTAT_INC(udps_badlen); - goto badunlocked; - } - - /* - * Checksum extended UDP header and data. - */ - if (uh->uh_sum == 0) { - if (ulen > plen || ulen < sizeof(struct udphdr)) { - UDPSTAT_INC(udps_nosum); + } else { + if ((ulen < sizeof(struct udphdr)) || (plen != ulen)) { + UDPSTAT_INC(udps_badlen); goto badunlocked; } } -- cgit v1.1