netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Xiaozhou Liu <liuxiaozhou@bytedance.com>
Cc: fw@strlen.de, netfilter-devel@vger.kernel.org,
	zhangyongsu@bytedance.com, wenxudong@bytedance.com
Subject: Re: RFC: NAT's default behavior of forwarding un-NATed packets
Date: Wed, 17 Apr 2019 13:30:54 +0200	[thread overview]
Message-ID: <20190417113054.nc3fetyoy2duywyg@salvia> (raw)
In-Reply-To: <20190417080242.jas4vongrv5fivzx@bytedancedeMacBook-Air.local>

On Wed, Apr 17, 2019 at 04:02:44PM +0800, Xiaozhou Liu wrote:
> Hi,
> 
> We find that our SNAT sometimes forwards un-NATed packets out as-is. This
> behavior confused us for a while until we saw this in
> net/netfilter/nf_nat_core.c:
> 
>        ct = nf_ct_get(skb, &ctinfo);
>        /* Can't track?  It's not due to stress, or conntrack would
>         * have dropped it.  Hence it's the user's responsibilty to
>         * packet filter it out, or implement conntrack/NAT for that
>         * protocol. 8) --RR
>         */
>        if (!ct)
>               return NF_ACCEPT;
> 
> The code and comment are very clear. So it is not kernel's responsibility,
> at least in RR's point of view. We added filtering shortly afterwards.
> 
> But as normal users, we really want a NAT server which can work out of box as
> expected from users' point of view. That said, if any packet that is bad (in
> our case, orphaned SYN-ACK and FIN packets going out without getting a chance
> to setup conntrack), it's better to drop them in kernel by default.
> 
> Is there any possibility to change this default behavior?

You can just drop invalid traffic via policy.

      parent reply	other threads:[~2019-04-17 11:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17  8:02 RFC: NAT's default behavior of forwarding un-NATed packets Xiaozhou Liu
2019-04-17  8:58 ` Jan Engelhardt
2019-04-17 11:54   ` [External Email] " Xiaozhou Liu
2019-04-17 18:01     ` Jan Engelhardt
2019-04-17 11:30 ` Pablo Neira Ayuso [this message]

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=20190417113054.nc3fetyoy2duywyg@salvia \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=liuxiaozhou@bytedance.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=wenxudong@bytedance.com \
    --cc=zhangyongsu@bytedance.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).