summaryrefslogtreecommitdiffstats
path: root/include/nftables
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-08-18 11:40:37 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-08-24 09:01:45 +0200
commit3684a1b69c255d5268dd2b1590c1dc039e48052d (patch)
tree6dab3f3dc8e948338b47ac08248f23923699ea21 /include/nftables
parent4496b390ed2a086c4abbaa864798f36d891fa933 (diff)
src: add input flag NFT_CTX_INPUT_NO_DNS to avoid blocking
getaddrinfo() blocks while trying to resolve the name. Blocking the caller of the library is in many cases undesirable. Also, while reconfiguring the firewall, it's not clear that resolving names via the network will work or makes sense. Add a new input flag NFT_CTX_INPUT_NO_DNS to opt-out from getaddrinfo() and only accept plain IP addresses. We could also use AI_NUMERICHOST with getaddrinfo() instead of inet_pton(). By parsing via inet_pton(), we are better aware of what we expect and can generate a better error message in case of failure. Signed-off-by: Thomas Haller <thaller@redhat.com> Reviewed-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/nftables')
-rw-r--r--include/nftables/libnftables.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/nftables/libnftables.h b/include/nftables/libnftables.h
index 9a05d3c4..e109805f 100644
--- a/include/nftables/libnftables.h
+++ b/include/nftables/libnftables.h
@@ -48,6 +48,10 @@ enum nft_optimize_flags {
uint32_t nft_ctx_get_optimize(struct nft_ctx *ctx);
void nft_ctx_set_optimize(struct nft_ctx *ctx, uint32_t flags);
+enum {
+ NFT_CTX_INPUT_NO_DNS = (1 << 0),
+};
+
unsigned int nft_ctx_input_get_flags(struct nft_ctx *ctx);
unsigned int nft_ctx_input_set_flags(struct nft_ctx *ctx, unsigned int flags);