From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>,
Antonio Ojea <antonio.ojea.garcia@gmail.com>,
netfilter@vger.kernel.org
Subject: Re: Most optimal method to dump UDP conntrack entries
Date: Mon, 11 Nov 2024 13:54:56 +0100 [thread overview]
Message-ID: <20241111125456.GA14363@breakpoint.cc> (raw)
In-Reply-To: <ZzH4mhspJvY6zTRA@calendula>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Mon, Nov 11, 2024 at 01:09:46PM +0100, Florian Westphal wrote:
> > The time and effort needed to make something as basic as NAT
> > work properly is jus silly.
> >
> > Lets fix conntrack so this "just works".
>
> Ok, then...
>
> +static bool udp_ts_reply(struct nf_conn *ct, enum ip_conntrack_dir dir)
> +{
> + bool is_reply = READ_ONCE(ct->proto.udp.last_dir) != dir;
> +
> + if (is_reply)
> + WRITE_ONCE(ct->proto.udp.last_dir, dir);
> +
> + return is_reply;
> +}
>
> ... if packet in the other direction is seen, then...
>
> + if (udp_ts_reply(ct, dir))
> + nf_ct_refresh_acct(ct, ctinfo, skb, extra);
>
> ... conntrack entry is refreshed?
Yes.
> Will this work for, let's say, RTP traffic which goes over UDP and it
> is unidirectional? Well, maybe you could occasionally see a RCTP
> packet as reply to get statistics, but those could just not be
> available.
We could add a || ct->master to the is_reply test.
> I am not sure we can make assumptions on the direction like this, any
> application protocol could run over UDP.
What about adding a CT template option to control the behaviour?
More work, but would avoid any compat concerns.
next prev parent reply other threads:[~2024-11-11 12:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 10:26 Most optimal method to dump UDP conntrack entries Antonio Ojea
2024-10-17 12:46 ` Florian Westphal
2024-10-17 16:36 ` Pablo Neira Ayuso
2024-10-17 22:10 ` Antonio Ojea
2024-10-17 23:30 ` Florian Westphal
2024-10-18 11:05 ` Antonio Ojea
2024-10-18 11:33 ` Florian Westphal
2024-10-18 14:10 ` Antonio Ojea
2024-10-21 13:53 ` Florian Westphal
2024-10-23 9:03 ` Benny Lyne Amorsen
2024-11-10 21:50 ` Florian Westphal
2024-11-11 6:33 ` Antonio Ojea
2024-11-11 12:06 ` Pablo Neira Ayuso
2024-11-11 12:09 ` Florian Westphal
2024-11-11 12:29 ` Pablo Neira Ayuso
2024-11-11 12:54 ` Florian Westphal [this message]
2024-11-12 9:16 ` Pablo Neira Ayuso
2024-11-12 9:20 ` Pablo Neira Ayuso
2024-11-12 14:41 ` Antonio Ojea
2024-11-12 14:43 ` Antonio Ojea
2024-11-12 16:18 ` Florian Westphal
2024-11-15 4:11 ` Antonio Ojea
2024-12-01 17:00 ` Antonio Ojea
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=20241111125456.GA14363@breakpoint.cc \
--to=fw@strlen.de \
--cc=antonio.ojea.garcia@gmail.com \
--cc=netfilter@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