svn commit: r289210 - stable/10/sys/contrib/ipfilter/netinet

Cy Schubert cy at FreeBSD.org
Tue Oct 13 04:19:51 UTC 2015


Author: cy
Date: Tue Oct 13 04:19:49 2015
New Revision: 289210
URL: https://svnweb.freebsd.org/changeset/base/289210

Log:
  MFC r288910: On some interfaces, ipfilter drops UDP packets with zero
  checkum. This commit fixes that.
  
  PR:		166372
  Submitted by:	mk at neon1.net
  Reviewed by:	Darren Reed <darrenr at reed.wattle.id.au>

Modified:
  stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Tue Oct 13 03:12:55 2015	(r289209)
+++ stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Tue Oct 13 04:19:49 2015	(r289210)
@@ -1134,6 +1134,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


More information about the svn-src-stable-10 mailing list