summaryrefslogtreecommitdiffstats
path: root/doc/libnftables.adoc
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 /doc/libnftables.adoc
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 'doc/libnftables.adoc')
-rw-r--r--doc/libnftables.adoc10
1 files changed, 9 insertions, 1 deletions
diff --git a/doc/libnftables.adoc b/doc/libnftables.adoc
index a0d3521e..62de75f3 100644
--- a/doc/libnftables.adoc
+++ b/doc/libnftables.adoc
@@ -84,7 +84,15 @@ The *nft_ctx_set_dry_run*() function sets the dry-run setting in 'ctx' to the va
=== nft_ctx_input_get_flags() and nft_ctx_input_set_flags()
The flags setting controls the input format.
-Currently no flags are implemented.
+----
+enum {
+ NFT_CTX_INPUT_NO_DNS = (1 << 0),
+};
+----
+
+NFT_CTX_INPUT_NO_DNS::
+ Avoid resolving IP addresses with blocking getaddrinfo(). In that case,
+ only plain IP addresses are accepted.
The *nft_ctx_input_get_flags*() function returns the input flags setting's value in 'ctx'.