extend ct_label_set with a negative ct label match and switch to inline counter checks (.nodump).
PATCH v2 1/1 extend ct_label_set with a negative ct label match and switch to inline counter checks (.nodump).
Signed-off-by Jiri Peska <[email protected]>
--- 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
@@ -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
@@ -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
Signature · 1 line
2.54.0