netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Julian Anastasov <ja@ssi.bg>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] netfilter: nf_nat: avoid double nat for loopback
Date: Tue, 07 Jun 2011 11:37:43 +0200	[thread overview]
Message-ID: <4DEDF167.1010202@trash.net> (raw)
In-Reply-To: <alpine.LFD.2.00.1106041640080.1437@ja.ssi.bg>

On 04.06.2011 16:02, Julian Anastasov wrote:
> 
> 	Avoid double NAT and seq adjustment for loopback
> traffic because it causes silent repetition of TCP data. One
> example is passive FTP with DNAT rule and difference in the
> length of IP addresses.
> 
> 	This patch adds checks if packet is sent and
> received via loopback device. As the same conntrack is used
> both for outgoing and incoming direction, we restrict NAT,
> seq adjustment and confirmation to happen only in
> outgoing direction (OUTPUT and POSTROUTING).
> 
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> ---
> 
> 	As the check is not so cheap, another alternative
> is to add new skb flag, eg. "loopback", that can be set in 
> drivers/net/loopback.c, loopback_xmit(). May be there is space
> for it in flags2?

I don't think we should be adding code specifically needed for netfilter
to the loopback driver if we can avoid it. I don't think we need to
actually avoid calling nf_nat_packet twice, that shouldn't do any harm,
just the sequence number adjustment. So we could add the loopback check
to the IPS_SEQ_ADJUST_BIT case to at least avoid it in some cases.
Would that work or am I missing something?

  reply	other threads:[~2011-06-07  9:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04 14:02 [PATCH] netfilter: nf_nat: avoid double nat for loopback Julian Anastasov
2011-06-07  9:37 ` Patrick McHardy [this message]
2011-06-07 19:46   ` Julian Anastasov
2011-06-07 22:59     ` Patrick McHardy
2011-06-08  6:26       ` Julian Anastasov

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=4DEDF167.1010202@trash.net \
    --to=kaber@trash.net \
    --cc=ja@ssi.bg \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).