diff options
author | tuexen <tuexen@FreeBSD.org> | 2014-10-06 17:12:03 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2014-10-06 17:12:03 +0000 |
commit | ec9e40767d3faae9db7fd358a829730a1f82a2b4 (patch) | |
tree | e7a30129f9c02df65ef1b84cfbe806166d2e9bb1 | |
parent | 01f551f619a0190f2a22242a9b28a20e72e95685 (diff) | |
download | FreeBSD-src-ec9e40767d3faae9db7fd358a829730a1f82a2b4.zip FreeBSD-src-ec9e40767d3faae9db7fd358a829730a1f82a2b4.tar.gz |
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.
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 15 |
1 files changed, 3 insertions, 12 deletions
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; } } |