From: jamal <hadi@cyberus.ca>
To: Changli Gao <xiaosuo@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH v2] act_nat: fix the wrong checksum when addr isn't in old_addr/mask
Date: Sun, 30 May 2010 08:43:41 -0400 [thread overview]
Message-ID: <1275223421.3587.0.camel@bigi> (raw)
In-Reply-To: <1275179219-10424-1-git-send-email-xiaosuo@gmail.com>
Copying Herbert, taking linux-kernel off...
On Sun, 2010-05-30 at 08:26 +0800, Changli Gao wrote:
> fix the wrong checksum when addr isn't in old_addr/mask
>
> For TCP and UDP packets, when addr isn't in old_addr/mask we don't do SNAT or
> DNAT, and we should not update layer 4 checksum.
>
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ----
> net/sched/act_nat.c | 4 ++++
> 1 file changed, 4 insertions(+)
> diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
> index d885ba3..5709494 100644
> --- a/net/sched/act_nat.c
> +++ b/net/sched/act_nat.c
> @@ -159,6 +159,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
> iph->daddr = new_addr;
>
> csum_replace4(&iph->check, addr, new_addr);
> + } else if ((iph->frag_off & htons(IP_OFFSET)) ||
> + iph->protocol != IPPROTO_ICMP) {
> + goto out;
> }
>
> ihl = iph->ihl * 4;
> @@ -247,6 +250,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
> break;
> }
>
> +out:
> return action;
>
> drop:
next prev parent reply other threads:[~2010-05-30 12:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-30 0:26 [PATCH v2] act_nat: fix the wrong checksum when addr isn't in old_addr/mask Changli Gao
2010-05-30 12:43 ` jamal [this message]
2010-05-30 12:58 ` Herbert Xu
2010-05-30 13:33 ` Changli Gao
2010-05-30 14:11 ` Changli Gao
2010-05-30 21:53 ` Herbert Xu
2010-06-02 13:52 ` David Miller
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=1275223421.3587.0.camel@bigi \
--to=hadi@cyberus.ca \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=xiaosuo@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).