Author: cy
Date: Tue Oct  6 03:41:11 2015
New Revision: 288910
URL: https://svnweb.freebsd.org/changeset/base/288910

Log:
  On some interfaces, ipfilter drops UDP packets with zero checkum.
  This commit fixes that.
  
  PR:           166372
  Submitted by: m...@neon1.net
  Reviewed by:  Darren Reed <darr...@reed.wattle.id.au>
  MFC after:    1 week

Modified:
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Tue Oct  6 01:24:46 
2015        (r288909)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Tue Oct  6 03:41:11 
2015        (r288910)
@@ -1104,6 +1104,22 @@ ipf_checkv4sum(fin)
                return -1;
        }
        if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) {
+               /* Depending on the driver, UDP may have zero checksum */
+               if (fin->fin_p == IPPROTO_UDP && (fin->fin_flx &
+                   (FI_FRAG|FI_SHORT|FI_BAD)) == 0) {
+                       udphdr_t *udp = fin->fin_dp;
+                       if (udp->uh_sum == 0) {
+                               /*
+                                * we're good no matter what the hardware
+                                * checksum flags and csum_data say (handling
+                                * of csum_data for zero UDP checksum is not
+                                * consistent across all drivers)
+                                */
+                               fin->fin_cksum = 1;
+                               return 0;
+                       }
+               }
+
                if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR)
                        sum = m->m_pkthdr.csum_data;
                else
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to