From e5510f478bbee16f136d7c4967c2805a87a76bdc Mon Sep 17 00:00:00 2001 From: cy Date: Tue, 13 Oct 2015 04:23:21 +0000 Subject: [PATCH] MFC r288910: On some interfaces, ipfilter drops UDP packets with zero checkum. This commit fixes that. PR: 166372 Submitted by: mk@neon1.net Reviewed by: Darren Reed git-svn-id: svn://svn.freebsd.org/base/stable/9@289211 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/contrib/ipfilter/netinet/ip_fil_freebsd.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c index 0d6528e69..e24454707 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c @@ -1361,6 +1361,22 @@ fr_info_t *fin; ip = fin->fin_ip; 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; + } + } + if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) sum = m->m_pkthdr.csum_data; else -- 2.45.0