diff options
author | Thomas Haller <thaller@redhat.com> | 2023-07-10 10:45:16 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-07-10 18:21:19 +0200 |
commit | 057f5ffe7dd500a379ca882cfec699d52bfa40a1 (patch) | |
tree | da646e79c4b1706399dc684adc2258db62d40fff /src/libnftables.c | |
parent | 668c18f672038dffa72b67d834445e0fe5ae286d (diff) |
libnftables: always initialize netlink socket in nft_ctx_new()
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/libnftables.c')
-rw-r--r-- | src/libnftables.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libnftables.c b/src/libnftables.c index de16d203..57e0fc77 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; } |