Skip to contentSkip to conversation

monitor: print "dormant" flag in monitor mode

PATCH New Florian Westphal 1 participant 2 messages Jul 14, 2020 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/2 monitor: print "dormant" flag in monitor mode

This distinction is important: a table with this flag is inert -- all base chains are unregistered and see no traffic.

---
 src/monitor.c | 4 ++++
 1 file changed, 4 insertions(+)
src/monitor.c +4 -0
index bb269c02950c..3872ebcfbdaf 100644
@@ -214,6 +214,10 @@ static int netlink_events_table_cb(const struct nlmsghdr *nlh, int type,
 
 		nft_mon_print(monh, "%s %s", family2str(t->handle.family),
 			      t->handle.table.name);
+
+		if (t->flags & TABLE_F_DORMANT)
+			nft_mon_print(monh, " { flags dormant; }");
+
 		if (nft_output_handle(&monh->ctx->nft->output))
 			nft_mon_print(monh, " # handle %" PRIu64 "",
 				      t->handle.handle.id);
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH 2/2 tests: extend existing dormat test case to catch a kernel bug

This is a test case for the kernel bug fixed by:
netfilter: nf_tables: fix nat hook table deletion

---
 tests/shell/testcases/transactions/0002table_0           | 1 +
 tests/shell/testcases/transactions/dumps/0002table_0.nft | 4 ++++
 2 files changed, 5 insertions(+)
tests/shell/testcases/transactions/0002table_0 +1 -0
index 246b10924d19..c5f31a6fb401 100755
@@ -5,6 +5,7 @@ set -e
 RULESET="add table x
 delete table x
 add table x
+add chain x y { type nat hook prerouting priority 0; policy accept; }
 add table x { flags dormant; }"
 
 $NFT -f - <<< "$RULESET"
tests/shell/testcases/transactions/dumps/0002table_0.nft +4 -0
index 6eb70726385f..429cbc348781 100644
@@ -1,3 +1,7 @@
 table ip x {
 	flags dormant
+
+	chain y {
+		type nat hook prerouting priority filter; policy accept;
+	}
 }
Signature · 1 line
2.26.2