From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Thomas Haller <thaller@redhat.com>
Cc: NetFilter <netfilter-devel@vger.kernel.org>
Subject: Re: [nft PATCH] src: use reentrant getprotobyname_r()/getprotobynumber_r()/getservbyport_r()
Date: Wed, 16 Aug 2023 18:16:58 +0200 [thread overview]
Message-ID: <ZNz2emyHGgx6ZtQj@calendula> (raw)
In-Reply-To: <c5d1ed7aa26a439314fd26a959fd03b77d7ee7c0.camel@redhat.com>
Hi Thomas,
Apologies for the late reply.
On Fri, Aug 11, 2023 at 02:58:48PM +0200, Thomas Haller wrote:
> Hi Pablo,
>
> On Fri, 2023-08-11 at 14:20 +0200, Pablo Neira Ayuso wrote:
> > On Thu, Aug 10, 2023 at 02:30:30PM +0200, Thomas Haller wrote:
> > > If the reentrant versions of the functions are available, use them
> > > so
> > > that libnftables is thread-safe in this regard.
> >
> > At netlink sequence tracking is not thread-safe, users hit EILSEQ
> > errors when multiple threads recycle the same nft_ctx object. Updates
> > are serialized by mutex per netns, batching is usually the way to go
> > to amortize the cost of ruleset updates.
>
> The problem already happens when one thread is using libnftables and
> another thread calls one of those libc functions at an unfortunate
> moment. It doesn't require multi-threaded uses of libnftables itself.
Indeed.
> Also, why couldn't you have two threads, handling one netns each, with
> separate nft_ctx objects?
You have to have one nft_ctx per thread, that should be sufficient,
this probably needs to be documented.
next prev parent reply other threads:[~2023-08-16 16:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-10 12:30 [nft PATCH] src: use reentrant getprotobyname_r()/getprotobynumber_r()/getservbyport_r() Thomas Haller
2023-08-10 21:48 ` Jan Engelhardt
2023-08-11 11:28 ` Thomas Haller
2023-08-11 12:20 ` Pablo Neira Ayuso
2023-08-11 12:58 ` Thomas Haller
2023-08-16 16:16 ` Pablo Neira Ayuso [this message]
2023-08-18 9:18 ` [nft PATCH v2] " Thomas Haller
2023-08-18 9:57 ` Pablo Neira Ayuso
2023-08-18 14:14 ` Thomas Haller
2023-08-18 16:10 ` Pablo Neira Ayuso
2023-08-18 16:23 ` Pablo Neira Ayuso
2023-08-18 17:38 ` Thomas Haller
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=ZNz2emyHGgx6ZtQj@calendula \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=thaller@redhat.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 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.