From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: 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:29:14 +0100 [thread overview]
Message-ID: <ZzH4mhspJvY6zTRA@calendula> (raw)
In-Reply-To: <20241111120946.GA13430@breakpoint.cc>
On Mon, Nov 11, 2024 at 01:09:46PM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > This is how it is implemented today and it works, but it does not
> > > handle process restarts per example, or is not resilient to errors.
> > > The implementation is also much more complex because we need to
> > > implement all the possible edge cases that can leave stale entries
> >
> > It should also be possible to shrink timeouts on restart via conntrack -U
> > which would be similar to the approach that Florian is proposing, but from
> > control plane rather than updating existing UDP timeout policy.
>
> 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?
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.
I am not sure we can make assumptions on the direction like this, any
application protocol could run over UDP.
next prev parent reply other threads:[~2024-11-11 12:29 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 [this message]
2024-11-11 12:54 ` Florian Westphal
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=ZzH4mhspJvY6zTRA@calendula \
--to=pablo@netfilter.org \
--cc=antonio.ojea.garcia@gmail.com \
--cc=fw@strlen.de \
--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 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.