[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100530125811.GA8120@gondor.apana.org.au>
Date: Sun, 30 May 2010 22:58:11 +1000
From: Herbert Xu <herbert@...dor.apana.org.au>
To: jamal <hadi@...erus.ca>
Cc: Changli Gao <xiaosuo@...il.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH v2] act_nat: fix the wrong checksum when addr isn't in
old_addr/mask
On Sun, May 30, 2010 at 08:43:41AM -0400, jamal wrote:
>
> Copying Herbert, taking linux-kernel off...
Thanks Jamal.
> 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@...il.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;
> > }
Yes the patch is correct.
However, the fact that you need this patch means that your act_nat
setup isn't perfect. Ideally all the unNATed packets should be
filtered out before you hit act_nat.
Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists