diff options
author | William Lyu <William.Lyu@windriver.com> | 2024-04-02 06:34:00 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-04-03 17:44:22 -0700 |
commit | 04fcbeb562f035de00138f473d923bfe2ac975b1 (patch) | |
tree | e9efcdb466a61a78fa08a3e34f325a88dc0f7df8 /meta-networking | |
parent | 32f5f091dd105a316adaa6ea06b017829a585c08 (diff) | |
download | meta-openembedded-04fcbeb562f035de00138f473d923bfe2ac975b1.tar.gz |
nftables: Fix failed ptest testcases
There are 2 failed ptest testcases. They fail because they are broken,
but the fix from the upstream is not yet available in version 1.0.9.
These testcases are:
- tests/shell/testcases/sets/reset_command_0
Fix from the upstream:
https://git.netfilter.org/nftables/commit/?id=7a6089a400a573b9a4fd92f29c00a6be7b8ef269
- tests/shell/testcases/json/0005secmark_objref_0
Fix from the upstream:
https://git.netfilter.org/nftables/commit/?id=fff913c1eefbc84eb2d9c52038ef29fe881e9ee9
Signed-off-by: William Lyu <William.Lyu@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
3 files changed, 101 insertions, 0 deletions
diff --git a/meta-networking/recipes-filter/nftables/nftables/0001-tests-shell-Fix-sets-reset_command_0-for-current-ker.patch b/meta-networking/recipes-filter/nftables/nftables/0001-tests-shell-Fix-sets-reset_command_0-for-current-ker.patch new file mode 100644 index 0000000000..164182bb1e --- /dev/null +++ b/meta-networking/recipes-filter/nftables/nftables/0001-tests-shell-Fix-sets-reset_command_0-for-current-ker.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 7a6089a400a573b9a4fd92f29c00a6be7b8ef269 Mon Sep 17 00:00:00 2001 | ||
2 | From: Phil Sutter <phil@nwl.cc> | ||
3 | Date: Thu, 2 Nov 2023 16:02:14 +0100 | ||
4 | Subject: [PATCH] tests: shell: Fix sets/reset_command_0 for current kernels | ||
5 | |||
6 | Since kernel commit 4c90bba60c26 ("netfilter: nf_tables: do not refresh | ||
7 | timeout when resetting element"), element reset won't touch expiry | ||
8 | anymore. Invert the one check to make sure it remains unaltered, drop | ||
9 | the other testing behaviour for per-element timeouts. | ||
10 | |||
11 | Signed-off-by: Phil Sutter <phil@nwl.cc> | ||
12 | |||
13 | Upstream-Status: Backport | ||
14 | [https://git.netfilter.org/nftables/commit/?id=7a6089a400a573b9a4fd92f29c00a6be7b8ef269] | ||
15 | |||
16 | Signed-off-by: William Lyu <William.Lyu@windriver.com> | ||
17 | --- | ||
18 | tests/shell/testcases/sets/reset_command_0 | 10 ++-------- | ||
19 | 1 file changed, 2 insertions(+), 8 deletions(-) | ||
20 | |||
21 | diff --git a/tests/shell/testcases/sets/reset_command_0 b/tests/shell/testcases/sets/reset_command_0 | ||
22 | index e663dac8..d38ddb3f 100755 | ||
23 | --- a/tests/shell/testcases/sets/reset_command_0 | ||
24 | +++ b/tests/shell/testcases/sets/reset_command_0 | ||
25 | @@ -44,10 +44,10 @@ elem='element t s { 1.0.0.1 . udp . 53 }' | ||
26 | grep 'elements = ' | drop_seconds | uniq | wc -l) == 1 ]] | ||
27 | echo OK | ||
28 | |||
29 | -echo -n "counters and expiry are reset: " | ||
30 | +echo -n "counters are reset, expiry left alone: " | ||
31 | NEW=$($NFT "get $elem") | ||
32 | grep -q 'counter packets 0 bytes 0' <<< "$NEW" | ||
33 | -[[ $(expires_minutes <<< "$NEW") -gt 20 ]] | ||
34 | +[[ $(expires_minutes <<< "$NEW") -lt 20 ]] | ||
35 | echo OK | ||
36 | |||
37 | echo -n "get map elem matches reset map elem: " | ||
38 | @@ -80,12 +80,6 @@ OUT=$($NFT reset map t m) | ||
39 | $DIFF -u <(echo "$EXP") <(echo "$OUT") | ||
40 | echo OK | ||
41 | |||
42 | -echo -n "reset command respects per-element timeout: " | ||
43 | -VAL=$($NFT get element t s '{ 2.0.0.2 . tcp . 22 }' | expires_minutes) | ||
44 | -[[ $VAL -lt 15 ]] # custom timeout applies | ||
45 | -[[ $VAL -gt 10 ]] # expires was reset | ||
46 | -echo OK | ||
47 | - | ||
48 | echo -n "remaining elements are reset: " | ||
49 | OUT=$($NFT list ruleset) | ||
50 | grep -q '2.0.0.2 . tcp . 22 counter packets 0 bytes 0' <<< "$OUT" | ||
51 | -- | ||
52 | 2.43.0 | ||
53 | |||
diff --git a/meta-networking/recipes-filter/nftables/nftables/0001-tests-shell-skip-secmark-tests-if-kernel-does-not-su.patch b/meta-networking/recipes-filter/nftables/nftables/0001-tests-shell-skip-secmark-tests-if-kernel-does-not-su.patch new file mode 100644 index 0000000000..2a966ab443 --- /dev/null +++ b/meta-networking/recipes-filter/nftables/nftables/0001-tests-shell-skip-secmark-tests-if-kernel-does-not-su.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | From fff913c1eefbc84eb2d9c52038ef29fe881e9ee9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Pablo Neira Ayuso <pablo@netfilter.org> | ||
3 | Date: Tue, 21 Nov 2023 21:16:38 +0100 | ||
4 | Subject: [PATCH] tests: shell: skip secmark tests if kernel does not support | ||
5 | it | ||
6 | |||
7 | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> | ||
8 | |||
9 | Upstream-Status: Backport | ||
10 | [https://git.netfilter.org/nftables/commit/?id=fff913c1eefbc84eb2d9c52038ef29fe881e9ee9] | ||
11 | |||
12 | Signed-off-by: William Lyu <William.Lyu@windriver.com> | ||
13 | --- | ||
14 | tests/shell/features/secmark.nft | 7 +++++++ | ||
15 | tests/shell/testcases/json/0005secmark_objref_0 | 1 + | ||
16 | 2 files changed, 8 insertions(+) | ||
17 | create mode 100644 tests/shell/features/secmark.nft | ||
18 | |||
19 | diff --git a/tests/shell/features/secmark.nft b/tests/shell/features/secmark.nft | ||
20 | new file mode 100644 | ||
21 | index 00000000..ccbb572f | ||
22 | --- /dev/null | ||
23 | +++ b/tests/shell/features/secmark.nft | ||
24 | @@ -0,0 +1,7 @@ | ||
25 | +# fb961945457f ("netfilter: nf_tables: add SECMARK support") | ||
26 | +# v4.20-rc1~14^2~125^2~5 | ||
27 | +table inet x { | ||
28 | + secmark ssh_server { | ||
29 | + "system_u:object_r:ssh_server_packet_t:s0" | ||
30 | + } | ||
31 | +} | ||
32 | diff --git a/tests/shell/testcases/json/0005secmark_objref_0 b/tests/shell/testcases/json/0005secmark_objref_0 | ||
33 | index 992d1b00..5c44f093 100755 | ||
34 | --- a/tests/shell/testcases/json/0005secmark_objref_0 | ||
35 | +++ b/tests/shell/testcases/json/0005secmark_objref_0 | ||
36 | @@ -1,6 +1,7 @@ | ||
37 | #!/bin/bash | ||
38 | |||
39 | # NFT_TEST_REQUIRES(NFT_TEST_HAVE_json) | ||
40 | +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_secmark) | ||
41 | |||
42 | set -e | ||
43 | |||
44 | -- | ||
45 | 2.43.0 | ||
46 | |||
diff --git a/meta-networking/recipes-filter/nftables/nftables_1.0.9.bb b/meta-networking/recipes-filter/nftables/nftables_1.0.9.bb index 906d1b4f65..ad99a80a6d 100644 --- a/meta-networking/recipes-filter/nftables/nftables_1.0.9.bb +++ b/meta-networking/recipes-filter/nftables/nftables_1.0.9.bb | |||
@@ -12,6 +12,8 @@ DEPENDS = "libmnl libnftnl bison-native \ | |||
12 | ${@bb.utils.contains('PACKAGECONFIG', 'mini-gmp', '', 'gmp', d)}" | 12 | ${@bb.utils.contains('PACKAGECONFIG', 'mini-gmp', '', 'gmp', d)}" |
13 | 13 | ||
14 | SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.xz \ | 14 | SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.xz \ |
15 | file://0001-tests-shell-Fix-sets-reset_command_0-for-current-ker.patch \ | ||
16 | file://0001-tests-shell-skip-secmark-tests-if-kernel-does-not-su.patch \ | ||
15 | file://run-ptest \ | 17 | file://run-ptest \ |
16 | " | 18 | " |
17 | SRC_URI[sha256sum] = "a3c304cd9ba061239ee0474f9afb938a9bb99d89b960246f66f0c3a0a85e14cd" | 19 | SRC_URI[sha256sum] = "a3c304cd9ba061239ee0474f9afb938a9bb99d89b960246f66f0c3a0a85e14cd" |