Skip to contentSkip to conversation

extend ct_label_set with a negative ct label match and switch to inline counter checks (.nodump).

PATCH New Jiri Peska 1 participant 1 message Sep 8 netfilter

lore
Share & tools
lore

Jiri Peska

author
#0 lore raw

PATCH v2 1/1 extend ct_label_set with a negative ct label match and switch to inline counter checks (.nodump).

---
 tests/shell/testcases/packetpath/ct_label_set |   4 +
 .../packetpath/dumps/ct_label_set.json-nft    | 132 ------------------
 .../packetpath/dumps/ct_label_set.nft         |  11 --
 .../packetpath/dumps/ct_label_set.nodump      |   0
 4 files changed, 4 insertions(+), 143 deletions(-)
 delete mode 100644 tests/shell/testcases/packetpath/dumps/ct_label_set.json-nft
 delete mode 100644 tests/shell/testcases/packetpath/dumps/ct_label_set.nft
 create mode 100644 tests/shell/testcases/packetpath/dumps/ct_label_set.nodump
tests/shell/testcases/packetpath/ct_label_set +4 -0
index 554829c0..9d1184a3 100755
@@ -7,12 +7,15 @@ ip link set lo up
 $NFT -f - <<EOF
 table ip test {
     counter labeled {}
+    counter unlabeled {}
     chain output {
         type filter hook output priority filter; policy accept;
             # set bit 1 on each echo-request
             icmp type echo-request ip daddr 127.0.0.1 ct label set 1
             # count only if label is already set
             icmp type echo-request ip daddr 127.0.0.1 ct label 1 counter name labeled
+            # label 3 is never set, must not match
+            icmp type echo-request ip daddr 127.0.0.1 ct label 3 counter name unlabeled
     }
 }
 EOF
@@ -25,3 +28,4 @@ ping -c 2 -W 1 127.0.0.1 >/dev/null
 
 # Assert correct number of matched packets
 $NFT list counter ip test labeled | grep -q 'packets 3'
+$NFT list counter ip test unlabeled | grep -q 'packets 0'
tests/shell/testcases/packetpath/dumps/ct_label_set.json-nft deleted +0 -132

132 lines not on this page · raw message

tests/shell/testcases/packetpath/dumps/ct_label_set.nft deleted +0 -11
deleted file mode 100644
index 261677f8..00000000
@@ -1,11 +0,0 @@
-table ip test {
-	counter labeled {
-		packets 3 bytes 252
-	}
-
-	chain output {
-		type filter hook output priority filter; policy accept;
-		icmp type echo-request ip daddr 127.0.0.1 ct label set 1
-		icmp type echo-request ip daddr 127.0.0.1 ct label 1 counter name "labeled"
-	}
-}
tests/shell/testcases/packetpath/dumps/ct_label_set.nodump new file +0 -0
new file mode 100644
index 00000000..e69de29b
Signature · 1 line
2.54.0