From: Patrick McHardy <kaber@trash.net>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Íõ躣šŒÆËã»ú¿ÆÑ§Ñ§Ôº£© <wtweeker@163.com>,
akpm@linux-foundation.org, bugzilla-daemon@bugzilla.kernel.org,
bugme-daemon@bugzilla.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] nf_nat_snmp: fix checksum calculation (v3)
Date: Mon, 20 Sep 2010 19:35:08 +0200 [thread overview]
Message-ID: <4C979B4C.4020605@trash.net> (raw)
In-Reply-To: <20100920094448.67210244@nehalam>
[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]
On 20.09.2010 18:44, Stephen Hemminger wrote:
> Revised version of the original patch in the bug
> https://bugzilla.kernel.org/show_bug.cgi?id=17622
> from clark wang <wtweeker@163.com>
>
> I took the opportunity to do some cleanup here.
> * reorder the assignment to make the byte order clear
> * get rid of unnecessary ref/deref and just pass the bytes
> * use sizeof() instead of hard coding size
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Thanks Stephen, but this patch didn't compile:
net/ipv4/netfilter/nf_nat_snmp_basic.c: In function 'fast_csum':
net/ipv4/netfilter/nf_nat_snmp_basic.c:893: error: 's' undeclared (first
use in this function)
net/ipv4/netfilter/nf_nat_snmp_basic.c:893: error: (Each undeclared
identifier is reported only once
net/ipv4/netfilter/nf_nat_snmp_basic.c:893: error: for each function it
appears in.)
net/ipv4/netfilter/nf_nat_snmp_basic.c:890: warning: unused variable 'diff'
Since I prefer to keep this fix to the minimal size at this point,
I've committed this patch based on Clark's and your patches:
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1031 bytes --]
commit 8d70d82cdcc6da0a77440c6d860957a1f50b8089
Author: Patrick McHardy <kaber@trash.net>
Date: Mon Sep 20 19:29:40 2010 +0200
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=17622
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index 1679e2c..ee5f419 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -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)));
next prev parent reply other threads:[~2010-09-20 17:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-17622-10286@https.bugzilla.kernel.org/>
2010-09-14 23:32 ` [Bugme-new] [Bug 17622] New: snmp trap ALG issue Andrew Morton
[not found] ` <6029e4.25bb.12b1d97358d.Coremail.wtweeker@163.com>
2010-09-17 5:39 ` Stephen Hemminger
2010-09-17 12:08 ` Patrick McHardy
2010-09-17 15:31 ` Stephen Hemminger
2010-09-17 15:36 ` Patrick McHardy
[not found] ` <2a014b7c.92ce.12b293c61ba.Coremail.wtweeker@163.com>
2010-09-20 16:44 ` [PATCH] nf_nat_snmp: fix checksum calculation (v3) Stephen Hemminger
2010-09-20 17:35 ` Patrick McHardy [this message]
[not found] <AANLkTi=FbjWdAVfmoBK8E21gDEqxYyDsUyoJsGAfRumW@mail.gmail.com>
2010-09-30 11:03 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C979B4C.4020605@trash.net \
--to=kaber@trash.net \
--cc=akpm@linux-foundation.org \
--cc=bugme-daemon@bugzilla.kernel.org \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=wtweeker@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.