Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Aaron Fischer <mail@aaron-fischer.net>
Cc: netfilter@vger.kernel.org
Subject: Re: nftables: origin sport after dstnat
Date: Wed, 7 Dec 2022 12:29:00 +0100	[thread overview]
Message-ID: <20221207112900.GA28507@breakpoint.cc> (raw)
In-Reply-To: <20221206230347.205a59c1@deskFu>

Aaron Fischer <mail@aaron-fischer.net> wrote:
> The problem is that the DOCKER-USER chain is behind the dnat, so I
> can't use "sport", because it is already a random port from the dnat :(
> 
> With a trace in that chain, I got this (sport is 57484, a random port)
> and the filter rule does not work.
> 
> trace id 2a3fb2fd ip filter DOCKER-USER packet: iif "eth0" oif "docker0" ether saddr 52:54:00:8e:37:c7 ether daddr 52:54:00:9c:e5:b7 ip saddr 192.168.122.1 ip daddr 172.17.0.2 ip dscp cs0 ip ecn not-ect ip ttl 63 ip id 57921 ip length 60 tcp sport 57484 tcp dport 5000 tcp flags == syn tcp window 64240 
> trace id 2a3fb2fd ip filter DOCKER-USER rule tcp sport != 8448
> counter packets 6 bytes 360 drop (verdict drop)
> 
> Is there a way to somehow access the origin sport (8448 in my case), so
> I can filter for it in the FORWARD chain?

Yes, the original addresses are stored in conntrack: 'ct original proto-src 8448'

  reply	other threads:[~2022-12-07 11:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 22:03 nftables: origin sport after dstnat Aaron Fischer
2022-12-07 11:29 ` Florian Westphal [this message]
2022-12-07 23:31   ` Aaron Fischer
2022-12-08  7:48     ` Florian Westphal

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=20221207112900.GA28507@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=mail@aaron-fischer.net \
    --cc=netfilter@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