From: Thomas Haller <thaller@redhat.com>
To: NetFilter <netfilter-devel@vger.kernel.org>
Cc: Thomas Haller <thaller@redhat.com>
Subject: [nft PATCH 1/4] libnftables: always initialize netlink socket in nft_ctx_new()
Date: Mon, 10 Jul 2023 10:45:16 +0200 [thread overview]
Message-ID: <20230710084926.172198-2-thaller@redhat.com> (raw)
In-Reply-To: <20230710084926.172198-1-thaller@redhat.com>
nft_ctx_new() has a flags argument, but currently no flags are
supported. The documentation suggests to pass 0 (NFT_CTX_DEFAULT).
Initializing the netlink socket happens by default already, we should do
it for all flags. Also because nft_ctx_netlink_init() is not public
API so it's not clear how the user gets a functioning context instance
otherwise.
If we ever want to not initialize the netlink socket for a context
instance, then there should be a dedicated flag for doing that (and
additional API for making that mode of operation usable).
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/libnftables.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/libnftables.c b/src/libnftables.c
index de16d203a017..57e0fc77f989 100644
--- a/src/libnftables.c
+++ b/src/libnftables.c
@@ -219,8 +219,7 @@ struct nft_ctx *nft_ctx_new(uint32_t flags)
ctx->output.error_fp = stderr;
init_list_head(&ctx->vars_ctx.indesc_list);
- if (flags == NFT_CTX_DEFAULT)
- nft_ctx_netlink_init(ctx);
+ nft_ctx_netlink_init(ctx);
return ctx;
}
--
2.41.0
next prev parent reply other threads:[~2023-07-10 8:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 8:45 [nft PATCH 0/4] libnftables: minor cleanups initalizing nf_sock instance of nft_ctx Thomas Haller
2023-07-10 8:45 ` Thomas Haller [this message]
2023-07-10 8:45 ` [nft PATCH 2/4] libnftables: drop unused argument nf_sock from nft_netlink() Thomas Haller
2023-07-10 8:45 ` [nft PATCH 3/4] libnftables: inline creation of nf_sock in nft_ctx_new() Thomas Haller
2023-07-10 8:45 ` [nft PATCH 4/4] libnftables: drop check for nf_sock in nft_ctx_free() Thomas Haller
2023-07-10 16:22 ` [nft PATCH 0/4] libnftables: minor cleanups initalizing nf_sock instance of nft_ctx 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=20230710084926.172198-2-thaller@redhat.com \
--to=thaller@redhat.com \
--cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).