netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: Patrick McHardy <kaber@trash.net>,
	"David S. Miller" <davem@davemloft.net>,
	netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/4] netfilter: xt_connlimit: fix daddr connlimit in SNAT scenario
Date: Tue, 15 Mar 2011 07:49:04 +0800	[thread overview]
Message-ID: <AANLkTimBV9x7Y-tUez5VMDoU+8mtaw1f48GV1yxgZ71c@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1103141955180.21929@obet.zrqbmnf.qr>

On Tue, Mar 15, 2011 at 3:00 AM, Jan Engelhardt <jengelh@medozas.de> wrote:
> On Monday 2011-03-14 13:42, Changli Gao wrote:
>
>>
>>Yes, you are correct only when there is no SNAT rule. If there is an
>>SNAT rule:
>>
>>-t nat -A POSTROUTING -p tcp --dport 80 -j SNAT --to-source 192.168.0.1
>>
>>the final tuples will be:
>>src = home dst = router src=1.2.3.4 dst=192.168.0.1
>>
>>However, the tuple saved by connlimit is src=1.2.3.4 dst=home, so this
>>conn will be removed later as there isn't any conntrack, which has
>>this tuple in any direction.
>
> But I don't yet see how your patch #1 can help. At the time
> conn->tuple = *tuple is done, *tuple still contains the non-SNATed
> tuple, and it is never updated again.
>

In this patch, conn->addr is used to save the destination/source
address instead of conn->tuple.src.u3, so the conn->tuple is used for
conntrack lookup only. Just as the original tuple isn't updated, we
can use it to looking up the associated conntrack all the time.

addr: 192.168.0.1
tuple: src = home, dst = router

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-03-14 23:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14  6:50 [PATCH 1/4] netfilter: xt_connlimit: fix daddr connlimit in SNAT scenario Changli Gao
2011-03-14  6:50 ` [PATCH 2/4] netfilter: xt_connlimit: use kmalloc() instead of kzalloc() Changli Gao
2011-03-15 12:25   ` Patrick McHardy
2011-03-14  6:50 ` [PATCH 3/4] netfilter: xt_connlimit: use hlist instead Changli Gao
2011-03-15 12:26   ` Patrick McHardy
2011-03-14  6:50 ` [PATCH 4/4] netfilter: xt_connlimit: remove connlimit_rnd_inited Changli Gao
2011-03-15 12:26   ` Patrick McHardy
2011-03-14 12:26 ` [PATCH 1/4] netfilter: xt_connlimit: fix daddr connlimit in SNAT scenario Jan Engelhardt
2011-03-14 12:42   ` Changli Gao
2011-03-14 18:32     ` Patrick McHardy
2011-03-14 19:00     ` Jan Engelhardt
2011-03-14 23:49       ` Changli Gao [this message]
2011-03-15  1:16         ` Jan Engelhardt
2011-03-15  1:30           ` Changli Gao
2011-03-15  2:05             ` Jan Engelhardt
2011-03-15 12:21               ` Patrick McHardy
2011-03-15 12:24 ` 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=AANLkTimBV9x7Y-tUez5VMDoU+8mtaw1f48GV1yxgZ71c@mail.gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.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 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).