From 617643aaa683818c9a9c541e5aca7fc6d0748d70 Mon Sep 17 00:00:00 2001 From: Max Khon Date: Thu, 27 Sep 2012 18:15:01 +0000 Subject: [PATCH] Fix pseudo checksum calculation. This fixes ipfilter w/ network controllers that implement only partial rx csum offloading. PR: 106438 Obtained from: upstream MFC after: 1 week --- sys/contrib/ipfilter/netinet/ip_fil_freebsd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c index cac56efcec46..338b69a50c65 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c @@ -1357,7 +1357,9 @@ fr_info_t *fin; else sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htonl(m->m_pkthdr.csum_data + - fin->fin_ip->ip_len + fin->fin_p)); + fin->fin_ip->ip_len - + (fin->fin_ip->ip_hl << 2) + + fin->fin_p)); sum ^= 0xffff; if (sum != 0) { fin->fin_flx |= FI_BAD;