Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Sep 2015 16:49:53 +0000 (UTC)
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287674 - head/sys/contrib/ipfilter/netinet
Message-ID:  <201509111649.t8BGnrml034848@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cy
Date: Fri Sep 11 16:49:52 2015
New Revision: 287674
URL: https://svnweb.freebsd.org/changeset/base/287674

Log:
  Fix ipfilter bug 3600459 NAT bucket count wrong.
  
  Obtained from:	ipfilter cvs repo r1.48.2.25
  MFC after:	2 weeks

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

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Fri Sep 11 15:51:20 2015	(r287673)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Fri Sep 11 16:49:52 2015	(r287674)
@@ -1104,6 +1104,18 @@ ipf_checkv4sum(fin)
 		return -1;
 	}
 	if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) {
+		/* 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

Modified: head/sys/contrib/ipfilter/netinet/ip_state.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_state.c	Fri Sep 11 15:51:20 2015	(r287673)
+++ head/sys/contrib/ipfilter/netinet/ip_state.c	Fri Sep 11 16:49:52 2015	(r287674)
@@ -3646,7 +3646,8 @@ ipf_state_del(softc, is, why)
 		is->is_me = NULL;
 		is->is_ref--;
 	}
-	if (is->is_ref > 1) {
+	is->is_ref--;
+	if (is->is_ref > 0) {
 		int refs;
 
 		is->is_ref--;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509111649.t8BGnrml034848>