All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Garver <eric@garver.life>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, Phil Sutter <phil@nwl.cc>
Subject: Re: [PATCH v4 nf-next 2/2] netfilter: nat: force port remap to prevent shadowing well-known ports
Date: Fri, 17 Dec 2021 08:28:17 -0500	[thread overview]
Message-ID: <YbyQcRF1V2FD1o7I@egarver.remote.csb> (raw)
In-Reply-To: <20211217102957.2999-3-fw@strlen.de>

On Fri, Dec 17, 2021 at 11:29:57AM +0100, Florian Westphal wrote:
> If destination port is above 32k and source port below 16k
> assume this might cause 'port shadowing' where a 'new' inbound
> connection matches an existing one, e.g.
> 
> inbound X:41234 -> Y:53 matches existing conntrack entry
>         Z:53 -> X:4123, where Z got natted to X.
> 
> In this case, new packet is natted to Z:53 which is likely
> unwanted.
> 
> We avoid the rewrite for connections that originate from local host:
> port-shadowing is only possible with forwarded connections.
> 
> Also adjust test case.
> 
> v3: no need to call tuple_force_port_remap if already in random mode (Phil)
> 
> Cc: Eric Garver <eric@garver.life>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> Acked-by: Phil Sutter <phil@nwl.cc>
> ---
>  resent without changes, kept phils ack.
>  net/netfilter/nf_nat_core.c                  | 43 ++++++++++++++++++--
>  tools/testing/selftests/netfilter/nft_nat.sh |  5 ++-
>  2 files changed, 43 insertions(+), 5 deletions(-)

Acked-by: Eric Garver <eric@garver.life>


  reply	other threads:[~2021-12-17 13:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 10:29 [PATCH nf-next v4 0/2] nat: force port remap to prevent shadowing well-known ports Florian Westphal
2021-12-17 10:29 ` [PATCH nf-next v4 1/2] netfilter: conntrack: tag conntracks picked up in local out hook Florian Westphal
2021-12-17 10:29 ` [PATCH v4 nf-next 2/2] netfilter: nat: force port remap to prevent shadowing well-known ports Florian Westphal
2021-12-17 13:28   ` Eric Garver [this message]
2021-12-23  0:02 ` [PATCH nf-next v4 0/2] " Pablo Neira Ayuso

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=YbyQcRF1V2FD1o7I@egarver.remote.csb \
    --to=eric@garver.life \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.