diff options
author | cy <cy@FreeBSD.org> | 2015-10-13 04:19:49 +0000 |
---|---|---|
committer | cy <cy@FreeBSD.org> | 2015-10-13 04:19:49 +0000 |
commit | fe0e54ca0da7b8372b4350262934dbd919614c71 (patch) | |
tree | ec29e7f173344898f2a78c0701ba56b50abe6f51 /sys/contrib | |
parent | 8fe61b7856989a2fba0190222b32c35f9dcdf344 (diff) | |
download | FreeBSD-src-fe0e54ca0da7b8372b4350262934dbd919614c71.zip FreeBSD-src-fe0e54ca0da7b8372b4350262934dbd919614c71.tar.gz |
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 <darrenr@reed.wattle.id.au>
Diffstat (limited to 'sys/contrib')
-rw-r--r-- | sys/contrib/ipfilter/netinet/ip_fil_freebsd.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c index 325ddce..f10699d 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c @@ -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 |