Author: tuexen
Date: Thu Oct  2 10:49:01 2014
New Revision: 272408
URL: https://svnweb.freebsd.org/changeset/base/272408

Log:
  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.
  
  MFC after: 3 days

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c     Thu Oct  2 10:46:12 2014        
(r272407)
+++ head/sys/netinet6/udp6_usrreq.c     Thu Oct  2 10:49:01 2014        
(r272408)
@@ -237,18 +237,9 @@ udp6_input(struct mbuf **mp, int *offp, 
                        /* 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;
                }
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to