summaryrefslogtreecommitdiffstats
path: root/iptables/nft.c
diff options
context:
space:
mode:
authorKyle Bowman <kbowman@cloudflare.com>2021-10-01 18:41:37 +0100
committerFlorian Westphal <fw@strlen.de>2022-01-18 13:22:55 +0100
commit62ad29e9b778f4419573c6b43fe7a0a00d783fe6 (patch)
treec71ffa62272c9504e5e8d7d622ca1511d18f7385 /iptables/nft.c
parentdb99f6019eab5f108fe1050349b3e793ea21353d (diff)
extensions: libxt_NFLOG: don't truncate log prefix on print/save
When parsing the rule, use a struct with a layout compatible to that of struct xt_nflog_info, but with a buffer large enough to contain the whole 128-character nft prefix. We always send the nflog-group to the kernel since, for nft, log and nflog targets are handled by the same kernel module, and are distinguished by whether they define an nflog-group. Therefore, we must send the group even if it is zero, or the kernel will configure the target as a log, not an nflog. Changes to nft_is_expr_compatible were made since only targets which have an `nflog-group` are compatible. Since nflog targets are distinguished by having an nflog-group, we ignore targets without one. We also set the copy-len flag if the snap-len is set since without this, iptables will mistake `nflog-size` for `nflog-range`. Signed-off-by: Kyle Bowman <kbowman@cloudflare.com> Signed-off-by: Alex Forster <aforster@cloudflare.com> Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/nft.c')
-rw-r--r--iptables/nft.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/iptables/nft.c b/iptables/nft.c
index e4932a7a..72f7cf13 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -3542,6 +3542,10 @@ static int nft_is_expr_compatible(struct nftnl_expr *expr, void *data)
nftnl_expr_get_u32(expr, NFTNL_EXPR_LIMIT_FLAGS) == 0)
return 0;
+ if (!strcmp(name, "log") &&
+ nftnl_expr_is_set(expr, NFTNL_EXPR_LOG_GROUP))
+ return 0;
+
return -1;
}