From: Ulrich Weber <ulrich.weber@gmail.com>
To: Jean-Michel DILLY <jm@dilly.me>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>,
Florian Westphal <fw@strlen.de>,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: fix IPv6 NTP checksum calculation
Date: Tue, 29 Jan 2013 15:50:02 +0100 [thread overview]
Message-ID: <5107E19A.4000507@gmail.com> (raw)
In-Reply-To: <51040455.9090003@linux-ipv6.org>
[-- Attachment #1: Type: text/plain, Size: 256 bytes --]
Hi Jean-Michel,
can you please test again with Yoshifuji's patches and attached patch?
I think csum16_add() is still not proper, we would also need a carry bit if
"result < a". We better use the internal checksum functions if possible...
Cheers
Ulrich
[-- Attachment #2: 0001-netfilter-ip6t_NTP-Use-onces-complement-of-csum_fold.patch --]
[-- Type: text/x-patch, Size: 1412 bytes --]
>From 40e0c6d86514a8dcc80f18fbe8a2945c6ee78f6d Mon Sep 17 00:00:00 2001
From: Ulrich Weber <ulrich.weber@sophos.com>
Date: Tue, 29 Jan 2013 15:24:21 +0100
Subject: [PATCH] netfilter: ip6t_NTP: Use onces complement of csum_fold
we need a 16bit value but not folded
Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
---
net/ipv6/netfilter/ip6t_NPT.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 74e171d..61a9b95 100644
--- a/net/ipv6/netfilter/ip6t_NPT.c
+++ b/net/ipv6/netfilter/ip6t_NPT.c
@@ -35,7 +35,7 @@ static int ip6t_npt_checkentry(const struct xt_tgchk_param *par)
src_sum = csum_partial(&npt->src_pfx.in6, sizeof(npt->src_pfx.in6), 0);
dst_sum = csum_partial(&npt->dst_pfx.in6, sizeof(npt->dst_pfx.in6), 0);
- npt->adjustment = csum_fold(csum_sub(src_sum, dst_sum));
+ npt->adjustment = ~csum_fold(csum_sub(src_sum, dst_sum));
return 0;
}
@@ -71,8 +71,8 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt,
return false;
}
- sum = csum_fold(csum_add(csum_unfold((__force __sum16)addr->s6_addr16[idx]),
- csum_unfold(npt->adjustment)));
+ sum = ~csum_fold(csum_add(csum_unfold((__force __sum16)addr->s6_addr16[idx]),
+ csum_unfold(npt->adjustment)));
if (sum == CSUM_MANGLED_0)
sum = 0;
*(__force __sum16 *)&addr->s6_addr16[idx] = sum;
--
1.7.9.5
next prev parent reply other threads:[~2013-01-29 14:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 17:09 [PATCH] netfilter: fix IPv6 NTP checksum calculation Jean-Michel DILLY
2013-01-24 22:49 ` Florian Westphal
2013-01-25 21:09 ` Jean-Michel DILLY
2013-01-26 16:29 ` YOSHIFUJI Hideaki
2013-01-29 14:50 ` Ulrich Weber [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-01-02 15:24 Ulrich Weber
2013-01-04 9:20 ` Patrick McHardy
2013-01-04 19:22 ` Pablo Neira Ayuso
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=5107E19A.4000507@gmail.com \
--to=ulrich.weber@gmail.com \
--cc=fw@strlen.de \
--cc=jm@dilly.me \
--cc=netfilter-devel@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/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.