提交 d6120b8a 编写于 作者: P Patrick McHardy 提交者: David S. Miller

netfilter: nf_nat_snmp: fix checksum calculation (v4)

Fix checksum calculation in nf_nat_snmp_basic.

Based on patches by Clark Wang <wtweeker@163.com> and
Stephen Hemminger <shemminger@vyatta.com>.

https://bugzilla.kernel.org/show_bug.cgi?id=17622Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 15cdeada
......@@ -893,13 +893,15 @@ static void fast_csum(__sum16 *csum,
unsigned char s[4];
if (offset & 1) {
s[0] = s[2] = 0;
s[0] = ~0;
s[1] = ~*optr;
s[2] = 0;
s[3] = *nptr;
} else {
s[1] = s[3] = 0;
s[0] = ~*optr;
s[1] = ~0;
s[2] = *nptr;
s[3] = 0;
}
*csum = csum_fold(csum_partial(s, 4, ~csum_unfold(*csum)));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册