[PATCH nft 2/3] tests/shell: cover long interface name in "0042chain_variable_0" test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



IFNAMSIZ is 16. Adjust "0042chain_variable_0" to use an interface name
with the maximum allowed bytes length.

Instead of adding an entirely different test, adjust an existing one to
use another interface name. The aspect for testing for a long interface
name is not special enough, to warrant a separate test. We can cover it
by extending an existing test.

Note that the length check in "parser_bison.y" is wrong. The test checks
still for the wrong behavior and that "d23456789012345x" is accepted.

Signed-off-by: Thomas Haller <thaller@xxxxxxxxxx>
---
 .../testcases/chains/0042chain_variable_0     | 36 ++++++++++++++++---
 .../chains/dumps/0042chain_variable_0.nft     |  4 +--
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/tests/shell/testcases/chains/0042chain_variable_0 b/tests/shell/testcases/chains/0042chain_variable_0
index 1ea44e85c71f..739dc05a1777 100755
--- a/tests/shell/testcases/chains/0042chain_variable_0
+++ b/tests/shell/testcases/chains/0042chain_variable_0
@@ -2,7 +2,8 @@
 
 set -e
 
-ip link add name dummy0 type dummy
+ip link add name d23456789012345 type dummy
+
 
 EXPECTED="define if_main = \"lo\"
 
@@ -14,22 +15,50 @@ table netdev filter1 {
 
 $NFT -f - <<< $EXPECTED
 
+
+EXPECTED="define if_main = \"lo\"
+
+table netdev filter2 {
+	chain Main_Ingress2 {
+		type filter hook ingress devices = { \$if_main, d23456789012345x } priority -500; policy accept;
+	}
+}"
+
+rc=0
+$NFT -f - <<< $EXPECTED || rc=$?
+test "$rc" = 0
+cat <<EOF | $DIFF -u <($NFT list ruleset) -
+table netdev filter1 {
+	chain Main_Ingress1 {
+		type filter hook ingress device "lo" priority -500; policy accept;
+	}
+}
+table netdev filter2 {
+	chain Main_Ingress2 {
+		type filter hook ingress devices = { d23456789012345, lo } priority -500; policy accept;
+	}
+}
+EOF
+
+
 EXPECTED="define if_main = \"lo\"
 
 table netdev filter2 {
 	chain Main_Ingress2 {
-		type filter hook ingress devices = { \$if_main, dummy0 } priority -500; policy accept;
+		type filter hook ingress devices = { \$if_main, d23456789012345 } priority -500; policy accept;
 	}
 }"
 
 $NFT -f - <<< $EXPECTED
 
+
 if [ "$NFT_TEST_HAVE_netdev_egress" = n ] ; then
 	echo "Skip parts of the test due to NFT_TEST_HAVE_netdev_egress=n"
 	exit 77
 fi
 
-EXPECTED="define if_main = { lo, dummy0 }
+
+EXPECTED="define if_main = { lo, d23456789012345 }
 define lan_interfaces = { lo }
 
 table netdev filter3 {
@@ -43,4 +72,3 @@ table netdev filter3 {
 
 $NFT -f - <<< $EXPECTED
 
-
diff --git a/tests/shell/testcases/chains/dumps/0042chain_variable_0.nft b/tests/shell/testcases/chains/dumps/0042chain_variable_0.nft
index 5ec230d0bcfa..84a908d33dee 100644
--- a/tests/shell/testcases/chains/dumps/0042chain_variable_0.nft
+++ b/tests/shell/testcases/chains/dumps/0042chain_variable_0.nft
@@ -5,12 +5,12 @@ table netdev filter1 {
 }
 table netdev filter2 {
 	chain Main_Ingress2 {
-		type filter hook ingress devices = { dummy0, lo } priority -500; policy accept;
+		type filter hook ingress devices = { d23456789012345, lo } priority -500; policy accept;
 	}
 }
 table netdev filter3 {
 	chain Main_Ingress3 {
-		type filter hook ingress devices = { dummy0, lo } priority -500; policy accept;
+		type filter hook ingress devices = { d23456789012345, lo } priority -500; policy accept;
 	}
 
 	chain Main_Egress3 {
-- 
2.41.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux