tests: Automated regression testing
cover tests: Automated regression testing
This is the automated regression testing of nftables.
In all development is important to have a good system to let us check all features in our tools automatically. In nftables, there is not an automated tests to check it so far.
There is not system to let us check all options/features in nft. So, If anyone sends a patch, we can not check all nft-tool automatically. It's impossible check if anything is broken, or if a change adds a fail in the system, or fix a problem in all cases.
I send in this patchset the nftables automated regression tests. It contains a python script (nft-add.py) and a set of test files.
This let us check the input of rules of nft-tool from the command-line and the output from nft-tool of this rule. Then, It compares if the rule input matches the rule output automatically. And, the most important things: It do it automatically.
We also have plans to add automated regression testing in the packet path in the future, which should come in a follow up step.
Comments welcome, thanks
Ana Rey (6):
[nft] tests: Add Automated regression testing
[nft] tests: Add ip6 folder with test files.
[nft] tests: Add inet folder with test files.
[nft] tests: Add any folder with test files.
[nft] tests: Add arp folder with test files.
[nft] tests: Add bridge folder with test files.
tests/any/ct.t | 113 +++++++ tests/any/frag.t | 69 +++++ tests/any/limit.t | 13 + tests/any/log.t | 14 + tests/any/meta.t | 157 ++++++++++ tests/any/queue.t | 15 + tests/arp/arp.t | 58 ++++ tests/arp/chains.t | 5 + tests/bridge/chains.t | 8 + tests/inet/ah.t | 63 ++++ tests/inet/comp.t | 31 ++ tests/inet/dccp.t | 31 ++ tests/inet/esp.t | 23 ++ tests/inet/sctp.t | 42 +++ tests/inet/tcp.t | 104 +++++++ tests/inet/udp.t | 49 +++ tests/inet/udplite.t | 42 +++ tests/ip/chains.t | 22 ++ tests/ip/icmp.t | 98 ++++++ tests/ip/ip.t | 108 +++++++ tests/ip/nat.t | 18 ++ tests/ip/reject.t | 5 + tests/ip/sets.t | 31 ++ tests/ip6/chains.t | 16 + tests/ip6/dst.t | 25 ++ tests/ip6/hbh.t | 17 + tests/ip6/icmpv6.t | 115 +++++++ tests/ip6/ip6.t | 141 +++++++++ tests/ip6/mh.t | 50 +++ tests/ip6/nat.t | 8 + tests/ip6/reject.t | 5 + tests/ip6/rt.t | 50 +++ tests/ip6/sets.t | 27 ++ tests/ip6/vmap.t | 54 ++++ tests/nft-test.py | 842 ++++++++++++++++++++++++++++++++++++++++++++++++++ 35 files changed, 2469 insertions(+) create mode 100644 tests/any/ct.t create mode 100644 tests/any/frag.t create mode 100644 tests/any/limit.t create mode 100644 tests/any/log.t create mode 100644 tests/any/meta.t create mode 100644 tests/any/queue.t create mode 100644 tests/arp/arp.t create mode 100644 tests/arp/chains.t create mode 100644 tests/bridge/chains.t create mode 100644 tests/inet/ah.t create mode 100644 tests/inet/comp.t create mode 100644 tests/inet/dccp.t create mode 100644 tests/inet/esp.t create mode 100644 tests/inet/sctp.t create mode 100644 tests/inet/tcp.t create mode 100644 tests/inet/udp.t create mode 100644 tests/inet/udplite.t create mode 100644 tests/ip/chains.t create mode 100644 tests/ip/icmp.t create mode 100644 tests/ip/ip.t create mode 100644 tests/ip/nat.t create mode 100644 tests/ip/reject.t create mode 100644 tests/ip/sets.t create mode 100644 tests/ip6/chains.t create mode 100644 tests/ip6/dst.t create mode 100644 tests/ip6/hbh.t create mode 100644 tests/ip6/icmpv6.t create mode 100644 tests/ip6/ip6.t create mode 100644 tests/ip6/mh.t create mode 100644 tests/ip6/nat.t create mode 100644 tests/ip6/reject.t create mode 100644 tests/ip6/rt.t create mode 100644 tests/ip6/sets.t create mode 100644 tests/ip6/vmap.t create mode 100755 tests/nft-test.py
Signature · 1 line
2.0.0
PATCH 1/6 tests: Add Automated regression testing
Here, the automated regression testing to nftables and some test files.
This is a python script to check the command-line in nft.
This script checks the input of rules of nft-tool from the command-line and the output of them to the command-line. A bit more details here below.
A) What is it checking?
This script tests two different paths:
1) The input of rules of nft-tool from the command-line. It checks the different steps from the command-line to the kernel: parse step, evaluate step, compile step, the generate of netlink message and after this is sent into the kernel.
2) The output that is obtained from the kernel. It checks the different steps from the kernel to the command-line: getting the netlink message, the parse step, the postproces step, the textify step and the listing the rule in the command-line.
As a last step, It compares the rule is added and rule is listed by nft.
B) What options are available?
The script offers the following options:
1) Execute all set of test files (or one test file):
./nft-test.sh => Run all test files
./nft-test.sh path/file.t => Run this test file
So, It tests the input of rules of nft-tool from the command-line and then, It checks if the rule is added correctly.
If there is a problem, It lists the differences between the rule is added and the rule is listed by nft.
(If there are more than one family of table indicated in the test file and there is an error or a warning in this execution of the rule, the execution of this rule stop and it does not run in the others families of the tables).
2) List all rules are added in nft-tool while this script is run. (It is similar a debug mode of this test.)
./nft-test.sh -d
./nft-test.sh -d path/file.t
3) Run marked-line. This mode runs the lines that starts with a "-" symbol (these rules only).
./nft-test.sh -r
./nft-test.sh -r path/file.t
4) Run a rule in all families of table. Run all rules in all families of the tables defined in the test file. (although there were an error or a warning in a previous families.)
./nft-test.sh -a
./nft-test.sh -a path/file.t
C) What is the structure of the test file?
A test file contains a set of rules that are added in the system.
Here, an example of a test file:
*ip;test-ipv4 # line 1 *ip6;test-ipv6 # line 2 *inet;test-inet # line 3
:input;type filter hook input priority 0 # line 4
ah hdrlength != 11-23;ok;ah hdrlength < 11 ah hdrlength > 23 # line 5
- tcp dport != {22-25} # line 6
!set1 ipv4_addr;ok # line 7 ?set1 192.168.3.8 192.168.3.9;ok # line 8 # This is a commented-line. # line 9
1) Tables:
# Line 1: it defines a table where chains and rules are added.
It defines a table. the name of the table is test-ip and the family is ip.
In line 2 and 3, It define more tables of different families (ip6 and inet). It's possible to add different type of tables.
2) Chains:
# Line 4: It defines the chain/s (and the type, hook and priority of
this chain) where rules are added. The name of this chain is "input". The type is "filter", the hook is "input" and the priority is 0.
3) Rules:
line: 4: This line is divided by a ";" character.
Part 1: "ah hdrlength != 11-23" is the rule to check. Part 2: "ok" is the result expected with the execute of this rule.
(This rule is added without errors.)
Part 3: "ah hdrlength < 11 ah hdrlength > 23". This is the look of
the rule if it is run in the command-line. If the look of the output rule is the same that the rule in the input, this part is omit.
4) Marked-line:
Line 6: This is a marked-line. It means this rule is not run in a general execution of this script.
If if want to execute this line, It's necessary run this script with "-r" option.
It's useful to mark a known bugs or lines that don't want to execute.
5) Named set:
Line 7: It adds a new set. The name of this set is "set1" and the type of this set is "ipv4_add"
Line 8: It adds two element into the set1 set: "192.168.3.8" and "192.168.3.9" A whitespace divide the diferent elements of the set.
The Anonymous sets is added as a normal rule. It doesn't an especial handling.
6) Comments:
Line 9: "#" symbol means that line is a comment about the test.
D) The test folders
The test files are divide in directory: ip, ip6, inet, arp, bridge and any folders:
* "ip" folder: Here are the test files are executed in ip and inet
table.
* "ip" folder: Here are the test files are executed in ip6 and inet
table.
* "inet" folder: Here are the test files are executed in ip, ip6 and
inet table.
* "arp" folder: Here are the test files are executed in arp tables.
"bridge" folder: Here are the test files are executed in bridge table.
* "any" folder: Here are the test files are executed in ip, ip6, inet,
arp and bridge tables.
Moreover, It adds the "ip4" folder with expecific test files for ip and inet tables.
--- tests/ip/chains.t | 22 ++ tests/ip/icmp.t | 98 +++++++ tests/ip/ip.t | 108 +++++++ tests/ip/nat.t | 18 ++ tests/ip/reject.t | 5 + tests/ip/sets.t | 31 ++ tests/nft-test.py | 842 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 1124 insertions(+) create mode 100644 tests/ip/chains.t create mode 100644 tests/ip/icmp.t create mode 100644 tests/ip/ip.t create mode 100644 tests/ip/nat.t create mode 100644 tests/ip/reject.t create mode 100644 tests/ip/sets.t create mode 100755 tests/nft-test.py
tests/ip/chains.t new file +22 -0
@@ -0,0 +1,22 @@ +*ip;test-ip4 +-*inet;test-inet + +# filter chains available are: input, output, forward, prerouting, postrouting +:filter-input;type filter hook input priority 0 +:filter-pre;type filter hook prerouting priority 0 +:filter-forw;type filter hook forward priority 0 +:filter-out;type filter hook output priority 0 +:filter-post;type filter hook postrouting priority 0 +# nat chains available are: input, output, prerouting, postrouting +:nat-input-t;type nat hook input priority 0 +:nat-pre-t;type nat hook prerouting priority 0 +:nat-out-t;type nat hook output priority 0 +:nat-post-t;type nat hook postrouting priority 0 +# route chain available are: output +:route-out-t;type route hook output priority 0 + +#ip daddr 192.168.0.1-192.168.0.250;ok +#ip daddr 192.168.0.1;ok +#ip daddr 192.168.0.1 drop;ok +#ip daddr 192.168.0.2 log;ok +#ip daddr 192.168.0.2 log;ok
tests/ip/icmp.t new file +98 -0
98 lines not on this page · raw message
tests/ip/ip.t new file +108 -0
108 lines not on this page · raw message
tests/ip/nat.t new file +18 -0
@@ -0,0 +1,18 @@ +*ip;test-ip4 +# bug: Nat tables is not supported yet in inet table. +-*inet;test-inet + +:output;type nat hook output priority 0 + +iifname eth0 tcp dport 80-90 dnat 192.168.3.2;ok +iifname eth0 tcp dport != 80-90 dnat 192.168.3.2;ok +iifname eth0 tcp dport {80, 90, 23} dnat 192.168.3.2;ok +- iifname eth0 tcp dport != {80, 90, 23} dnat 192.168.3.2;ok + +iifname eth0 tcp sport 23-34 snat 192.168.3.2;ok + +- iifname eth0 tcp dport != {80, 90, 23} dnat 192.168.3.2;ok +# BUG: invalid expression type set +# nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. + +iifname eth0 tcp dport != 23-34 dnat 192.168.3.2;ok
tests/ip/reject.t new file +5 -0
@@ -0,0 +1,5 @@ +*ip;test-ip4 +*ip;test-inet +:output;type filter hook output priority 0 + +reject;ok
tests/ip/sets.t new file +31 -0
@@ -0,0 +1,31 @@ +*ip;test-ip4 +*inet;test-inet +:input;type filter hook input priority 0 + +!set_ipv4_add ipv4_addr;ok +!set_inet inet_proto;ok +!set_inet_serv inet_service;ok +!set_time time;ok + +!set1 ipv4_addr;ok +?set1 192.168.3.4;ok + +?set1 192.168.3.4;fail +?set1 192.168.3.5 192.168.3.6;ok +?set1 192.168.3.5 192.168.3.6;fail +?set1 192.168.3.8 192.168.3.9;ok +?set1 192.168.3.10 192.168.3.11;ok +?set1 1234:1234:1234:1234:1234:1234:1234:1234;fail +?set2 192.168.3.4;fail + +!set2 ipv4_addr;ok +?set2 192.168.3.4;ok +?set2 192.168.3.5 192.168.3.6;ok +?set2 192.168.3.5 192.168.3.6;fail +?set2 192.168.3.8 192.168.3.9;ok +?set2 192.168.3.10 192.168.3.11;ok + +-ip saddr @set1 drop;ok +-ip saddr @set2 drop;ok +-ip saddr @set33 drop;fail +-ip saddr @set21 drop;fail
tests/nft-test.py new file +842 -0
842 lines not on this page · raw message
Signature · 1 line
2.0.0
PATCH 2/6 tests: Add ip6 folder with test files.
In reply to Ana Rey"ip6" folder contains the test files that are executed in ip6 and inet family of tables.
These test files are executed with nft-tests.py
--- tests/ip6/chains.t | 16 ++++++ tests/ip6/dst.t | 25 ++++++++++ tests/ip6/hbh.t | 17 +++++++ tests/ip6/icmpv6.t | 115 +++++++++++++++++++++++++++++++++++++++++++ tests/ip6/ip6.t | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/ip6/mh.t | 50 +++++++++++++++++++ tests/ip6/nat.t | 8 +++ tests/ip6/reject.t | 5 ++ tests/ip6/rt.t | 50 +++++++++++++++++++ tests/ip6/sets.t | 27 ++++++++++ tests/ip6/vmap.t | 54 ++++++++++++++++++++ 11 files changed, 508 insertions(+) create mode 100644 tests/ip6/chains.t create mode 100644 tests/ip6/dst.t create mode 100644 tests/ip6/hbh.t create mode 100644 tests/ip6/icmpv6.t create mode 100644 tests/ip6/ip6.t create mode 100644 tests/ip6/mh.t create mode 100644 tests/ip6/nat.t create mode 100644 tests/ip6/reject.t create mode 100644 tests/ip6/rt.t create mode 100644 tests/ip6/sets.t create mode 100644 tests/ip6/vmap.t
tests/ip6/chains.t new file +16 -0
@@ -0,0 +1,16 @@ +*ip6;test-ip6 +-*inet;test-inet + +# filter chains available are: input, output, forward, forward, prerouting and postrouting. +:filter-input;type filter hook input priority 0 +:filter-prer;type filter hook prerouting priority 0 +:filter-forw-t;type filter hook forward priority 0 +:filter-out-t;type filter hook output priority 0 +:filter-post-t;type filter hook postrouting priority 0 +# nat chains available are: input, output, forward, prerouting and postrouting. +:nat-input;type nat hook input priority 0 +:nat-prerouting;type nat hook prerouting priority 0 +:nat-output;type nat hook output priority 0 +:nat-postrou;type nat hook postrouting priority 0 +# route chain available is output. +:route-out;type route hook output priority 0
tests/ip6/dst.t new file +25 -0
@@ -0,0 +1,25 @@ +*ip6;test-ip6 +*inet;test-inet +:input;type filter hook input priority 0 + +dst nexthdr 22;ok;dst nexthdr xns-idp +dst nexthdr != 233;ok +dst nexthdr 33-45;ok;dst nexthdr >= dccp dst nexthdr <= idrp +dst nexthdr != 33-45;ok;dst nexthdr < dccp dst nexthdr > idrp +dst nexthdr { 33, 55, 67, 88};ok;dst nexthdr { 67, dccp, eigrp, 55} +- dst nexthdr != { 33, 55, 67, 88};ok +dst nexthdr { 33-55};ok;dst nexthdr { dccp-55} +- dst nexthdr != { 33-55};ok +dst nexthdr { udplite, ipcomp, udp, ah, sctp, esp, dccp, tcp, ipv6-icmp};ok +-dst nexthdr != { udplite, ipcomp, udp, ah, sctp, esp, dccp, tcp, ipv6-icmp};ok +-dst nexthdr icmp;ok +dst nexthdr != icmp;ok + +dst hdrlength 22;ok +dst hdrlength != 233;ok +dst hdrlength 33-45;ok;dst hdrlength >= 33 dst hdrlength <= 45 +dst hdrlength != 33-45;ok;dst hdrlength < 33 dst hdrlength > 45 +dst hdrlength { 33, 55, 67, 88};ok +-dst hdrlength != { 33, 55, 67, 88};ok +dst hdrlength { 33-55};ok +-dst hdrlength != { 33-55};ok
tests/ip6/hbh.t new file +17 -0
@@ -0,0 +1,17 @@ +*ip6;test-ip6 +*inet;test-inet +:filter-input;type filter hook input priority 0 + +hbh hdrlength 22;ok +hbh hdrlength != 233;ok +hbh hdrlength 33-45;ok;hbh hdrlength >= 33 hbh hdrlength <= 45 +hbh hdrlength != 33-45;ok;hbh hdrlength < 33 hbh hdrlength > 45 +hbh hdrlength {33, 55, 67, 88};ok +-hbh hdrlength != {33, 55, 67, 88};ok +hbh hdrlength { 33-55};ok +-hbh hdrlength != {33-55};ok + +hbh nexthdr {esp, ah, comp, udp, udplite, tcp, dccp, sctp, icmpv6};ok +-hbh nexthdr != {esp, ah, comp, udp, udplite, tcp, dccp, sctp, icmpv6};ok +hbh nexthdr ip;ok +hbh nexthdr != ip;ok
tests/ip6/icmpv6.t new file +115 -0
115 lines not on this page · raw message
tests/ip6/ip6.t new file +141 -0
141 lines not on this page · raw message
tests/ip6/mh.t new file +50 -0
50 lines not on this page · raw message
tests/ip6/nat.t new file +8 -0
@@ -0,0 +1,8 @@ +*ip6;test-ip6 +-*inet;test-inet + +:input;type nat hook input priority 0 + +# TODO +tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:: :80-100;ok +tcp dport 80-90 dnat 2001:838:35f:1::-2001:838:35f:2:: :100;ok
tests/ip6/reject.t new file +5 -0
@@ -0,0 +1,5 @@ +*ip6;test-ip6 +*inet;test-inet +:output;type filter hook output priority 0 + +reject;ok
tests/ip6/rt.t new file +50 -0
50 lines not on this page · raw message
tests/ip6/sets.t new file +27 -0
@@ -0,0 +1,27 @@ +*ip6;test-ip6 +*inet;test-inet +:input;type filter hook input priority 0 + +!set_ipv6_add1 ipv6_addr;ok +!set_inet1 inet_proto;ok +!set_inet inet_service;ok +!set_time time;ok + +?set2 192.168.3.4;fail +!set2 ipv6_addr;ok +?set2 1234:1234::1234:1234:1234:1234:1234;ok +# Bug: nft shows the error (for a repeat value in the set but the return value is 0 +# nft does not return an error code. +-?set2 1234:1234::1234:1234:1234:1234:1234;fail + +?set2 1234::1234:1234:1234;ok +?set2 1234:1234:1234:1234:1234::1234:1234 1234:1234::123;ok +?set2 192.168.3.8 192.168.3.9;fail +?set2 1234:1234::1234:1234:1234:1234;ok +-?set2 1234:1234::1234:1234:1234:1234;fail +?set2 1234:1234:1234::1234;ok + +ip saddr @set2 drop;fail + +ip6 saddr @set2 drop;ok +ip6 saddr @set33 drop;fail
tests/ip6/vmap.t new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.0.0
PATCH 3/6 tests: Add inet folder with test files.
In reply to Ana Rey"inet" folder contains the test files that are executed in ipv4, ipv6 and inet family of tables.
These test files are executed with nft-tests.py
--- tests/inet/ah.t | 63 +++++++++++++++++++++++++++++++ tests/inet/comp.t | 31 +++++++++++++++ tests/inet/dccp.t | 31 +++++++++++++++ tests/inet/esp.t | 23 ++++++++++++ tests/inet/sctp.t | 42 +++++++++++++++++++++ tests/inet/tcp.t | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/inet/udp.t | 49 ++++++++++++++++++++++++ tests/inet/udplite.t | 42 +++++++++++++++++++++ 8 files changed, 385 insertions(+) create mode 100644 tests/inet/ah.t create mode 100644 tests/inet/comp.t create mode 100644 tests/inet/dccp.t create mode 100644 tests/inet/esp.t create mode 100644 tests/inet/sctp.t create mode 100644 tests/inet/tcp.t create mode 100644 tests/inet/udp.t create mode 100644 tests/inet/udplite.t
tests/inet/ah.t new file +63 -0
@@ -0,0 +1,63 @@ +*ip;test-ip4 +*ip6;test-ip6 +*inet;test-inet + +:input;type filter hook input priority 0 + +# nexthdr +# Bug to list table. + +- ah nexthdr esp;ok +- ah nexthdr ah;ok +- ah nexthdr comp;ok +- ah nexthdr udp;ok +- ah nexthdr udplite;ok +- ah nexthdr tcp;ok +- ah nexthdr dccp;ok +- ah nexthdr sctp;ok + +- ah nexthdr { esp, ah, comp, udp, udplite, tcp, dccp, sctp};ok +- ah nexthdr != { esp, ah, comp, udp, udplite, tcp, dccp, sctp};ok + +# hdrlength +ah hdrlength 11-23;ok;ah hdrlength >= 11 ah hdrlength <= 23 +ah hdrlength != 11-23;ok;ah hdrlength < 11 ah hdrlength > 23 +ah hdrlength { 11-23};ok +- ah hdrlength != { 11-23};ok +ah hdrlength {11, 23, 44 };ok +- ah hdrlength != {11-23 };ok + +# reserved +ah reserved 22;ok +ah reserved != 233;ok +ah reserved 33-45;ok;ah reserved >= 33 ah reserved <= 45 +ah reserved != 33-45;ok;ah reserved < 33 ah reserved > 45 +ah reserved {23, 100};ok +- ah reserved != {33, 55, 67, 88};ok +ah reserved { 33-55};ok +- ah reserved != { 33-55};ok + +#spi +ah spi 111;ok +ah spi != 111;ok +ah spi 111-222;ok;ah spi >= 111 ah spi <= 222 +ah spi != 111-222;ok;ah spi < 111 ah spi > 222 +ah spi {111, 122};ok +-ah spi != {111, 122};ok +# BUG: invalid expression type set +# nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. + +ah spi { 111-122};ok +-ah spi != { 111-122};ok +# BUG: invalid expression type set +# nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. + +# sequence +ah sequence 123;ok +ah sequence != 123;ok +ah sequence {23, 25, 33};ok +-ah sequence != {23, 25, 33};ok +ah sequence { 23-33};ok +-ah sequence != { 33-44};ok +ah sequence 23-33;ok;ah sequence >= 23 ah sequence <= 33 +ah sequence != 23-33;ok;ah sequence < 23 ah sequence > 33
tests/inet/comp.t new file +31 -0
@@ -0,0 +1,31 @@ +*ip;test-ip4 +*ip6;test-ip6 +*inet;test-inet + +:input;type filter hook input priority 0 + +# BUG: Do no list table. +-comp nexthdr esp;ok +comp nexthdr != esp;ok + +-comp nexthdr {esp, ah, comp, udp, udplite, tcp, tcp, dccp, sctp};ok +# comp flags ## 8-bit field. Reserved for future use. MUST be set to zero. + +# Bug comp flags: to list. List the decimal value. +comp flags 0x00;ok +comp flags != 0x23;ok +comp flags 0x33-0x45;ok +comp flags != 0x33-0x45;ok +comp flags {0x33, 0x55, 0x67, 0x88};ok +-comp flags != {0x33, 0x55, 0x67, 0x88};ok +comp flags { 0x33-0x55};ok +-comp flags != { 0x33-0x55};ok + +comp cpi 22;ok +comp cpi != 233;ok +comp cpi 33-45;ok;comp cpi >= 33 comp cpi <= 45 +comp cpi != 33-45;ok;comp cpi < 33 comp cpi > 45 +comp cpi {33, 55, 67, 88};ok +-comp cpi != {33, 55, 67, 88};ok +comp cpi { 33-55};ok +-comp cpi != { 33-55};ok
tests/inet/dccp.t new file +31 -0
@@ -0,0 +1,31 @@ +*ip;test-ip4 +*ip6;test-ip6 +*inet;test-inet +:input;type filter hook input priority 0 + +dccp sport 21-35;ok;dccp sport >= ftp dccp sport <= 35 +dccp sport != 21-35;ok;dccp sport < ftp dccp sport > 35 +dccp sport {23, 24, 25};ok;dccp sport { smtp, 24, telnet} +- dccp sport != { 27, 34};ok +# BUG: invalid expression type set +# nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. + +dccp sport { ftp-data - re-mail-ck};ok +dccp sport ftp-data - re-mail-ck;ok;dccp sport >= ftp-data dccp sport <= re-mail-ck +dccp sport { 20-50};ok;dccp sport { ftp-data-re-mail-ck} +# dccp sport != {27-34};ok +- BUG: invalid expression type set +- nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. + +#dccp dport 21-35;ok +#dccp dport != 21-35;ok +dccp dport {23, 24, 25};ok;dccp dport { smtp, 24, telnet} +# dccp dport != {27, 34};ok +dccp dport { 20-50};ok;dccp dport { ftp-data-re-mail-ck} +# dccp dport != {27-34};ok + +# BUG dccp type +#dccp type {request, response, data, ack, dataack, closereq, close, reset, sync, syncack};ok +#dccp type != {request, response, data, ack, dataack, closereq, close, reset, sync, syncack};ok +#dccp type request;ok +#dccp type != request;ok
tests/inet/esp.t new file +23 -0
@@ -0,0 +1,23 @@ +*ip;test-ip4 +*ip6;test-ip6 +*inet;test-inet +:input;type filter hook input priority 0 + +esp spi 100;ok +esp spi != 100;ok +esp spi 111-222;ok;esp spi >= 111 esp spi <= 222 +esp spi != 111-222;ok;esp spi < 111 esp spi > 222 +esp spi { 100, 102};ok +-esp spi != { 100, 102};ok +esp spi { 100-102};ok +-esp spi {100-102};ok + +esp sequence 22;ok +esp sequence 22-24;ok;esp sequence >= 22 esp sequence <= 24 +esp sequence != 22-24;ok;esp sequence < 22 esp sequence > 24 +esp sequence { 22, 24};ok +- esp sequence != { 22, 24};ok +# BUG: invalid expression type set +# nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. +esp sequence { 22-25};ok +-esp sequence != { 22-25};ok
tests/inet/sctp.t new file +42 -0
42 lines not on this page · raw message
tests/inet/tcp.t new file +104 -0
104 lines not on this page · raw message
tests/inet/udp.t new file +49 -0
49 lines not on this page · raw message
tests/inet/udplite.t new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.0.0
PATCH 4/6 tests: Add any folder with test files.
In reply to Ana Rey"any" folder contains the test files that are executed in ipv4, ipv6, inet, arp, bridge family of tables.
These test files are executed with nft-tests.py
--- tests/any/ct.t | 113 +++++++++++++++++++++++++++++++++++++++ tests/any/frag.t | 69 ++++++++++++++++++++++++ tests/any/limit.t | 13 +++++ tests/any/log.t | 14 +++++ tests/any/meta.t | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/any/queue.t | 15 ++++++ 6 files changed, 381 insertions(+) create mode 100644 tests/any/ct.t create mode 100644 tests/any/frag.t create mode 100644 tests/any/limit.t create mode 100644 tests/any/log.t create mode 100644 tests/any/meta.t create mode 100644 tests/any/queue.t
tests/any/ct.t new file +113 -0
@@ -0,0 +1,113 @@ +*ip;test-ip4 +*ip6;test-ip6 +*inet;test-inet +# ct expresion is not supported in arp type table yet. +-*arp;test-arp +-*bridge;test-bridge + +:output;type filter hook output priority 0 + +ct state new,established, related, untracked;ok;ct state established,related,new,untracked +ct state != related;ok +ct state {new,established, related, untracked};ok +-ct state != {new,established, related, untracked};ok +ct state invalid drop;ok +ct state established accept;ok + +ct direction original;ok +ct direction != original;ok +ct direction reply;ok +ct direction != reply;ok +ct direction {reply, original};ok +-ct direction != {reply, original};ok + +ct status expected;ok +ct status != expected;ok +ct status seen-reply;ok +ct status != seen-reply;ok +ct status {expected, seen-reply, assured, confirmed, dying};ok + +# BUG: +# SYMBOL("snat", IPS_SRC_NAT) +# SYMBOL("dnat", IPS_DST_NAT), +-ct status snat;ok +-ct status dnat;ok + +ct mark 0;ok +ct mark or 0x23 == 0x11;ok +ct mark or 0x3 != 0x1;ok +ct mark and 0x23 == 0x11;ok +ct mark and 0x3 != 0x1;ok +ct mark xor 0x23 == 0x11;ok +ct mark xor 0x3 != 0x1;ok + +ct mark 0x32;ok +ct mark != 0x32;ok +ct mark 0x32-0x45;ok +ct mark != 0x32-0x43;ok +ct mark {0x32, 0x2222, 0x42de3};ok +- ct mark != {0x32, 0x2222, 0x42de3};ok + +# ct mark != {0x32, 0x2222, 0x42de3};ok +# BUG: invalid expression type set +# nft: src/evaluate.c:975: expr_evaluate_relational: Assertion '0' failed. + +ct mark set 0x11 xor 0x1331;ok +ct mark set 0x11333 and 0x11;ok +ct mark set 0x12 or 0x11;ok +ct mark set 0x11;ok + +ct expiration 30;ok +ct expiration 22;ok +ct expiration != 233;ok +ct expiration 33-45;ok +# BUG: ct expiration 33-45;ok +# BUG to list ct expiration >= "33s" ct expiration <= "9709d53m20s" +ct expiration != 33-45;ok +ct expiration {33, 55, 67, 88};ok +-ct expiration != {33, 55, 67, 88};ok +ct expiration {33-55};ok +# BUG: ct expiration {33-55};ok +# BUG to list ct expiration { "4271d23h25m52s"-"8738d3h11m59s" } +-ct expiration != {33-55};ok + +ct helper "ftp";ok +#ct helper "12345678901234567";fail + +-ct l3proto ?? "Layer 3 protocol of the connection";ok + +# If table is ip6 or inet or bridge, It is failed. I can not test it +-ct saddr 1.2.3.4;ok + + +# ct saddr 192.168.3.4 +# <cmdline>:1:1-43: Error: Could not process rule: Invalid argument +# add rule ip test input ct saddr 192.168.3.4 +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +# If table is ip6 or inet or bridge, It is failed. I can not test it +-ct daddr 1.3.4.4;ok + +# There is a bug in bridge and inet tables. +# ct protocol tcp;ok +-ct protocol tcp;ok + +# ct daddr x.x.x.x;ok +# ct protocol tcp;ok +# <cmdline>:1:1-38: Error: Could not process rule: Invalid argument +# add rule ip test input ct protocol tcp +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +-ct proto-src udp;ok + +# ct proto-src udp +# <cmdline>:1:37-39: Error: datatype mismatch, expected invalid, expression has type Internet protocol +# add rule ip test input ct proto-src udp +# ~~~~~~~~~~~~ ^^^ + +-ct proto-dst udp;ok + +# ct proto-dst udp +# <cmdline>:1:37-39: Error: datatype mismatch, expected invalid, expression has type Internet protocol +# add rule ip test input ct proto-dst udp +# ~~~~~~~~~~~~ ^^^
tests/any/frag.t new file +69 -0
69 lines not on this page · raw message
tests/any/limit.t new file +13 -0
@@ -0,0 +1,13 @@ +*ip;test-ip4 +*ip6;test-ip6 +*inet;test-inet +*arp;test-arp +*bridge;test-bridge + +:output;type filter hook output priority 0 + +limit rate 400/minute;ok +limit rate 20/second;ok +limit rate 400/hour;ok +limit rate 400/week;ok +limit rate 40/day;ok
tests/any/log.t new file +14 -0
@@ -0,0 +1,14 @@ +*ip;test-ip4 +*ip6;test-ip6 +*inet;test-inet +-*arp;test-arp +*bridge;test-bridge +:output;type filter hook output priority 0 + +# Bug in bridge family +-ct direction original log;ok +log;ok +udp dport 200 log group 2 prefix aaaaa-aaaaaa snaplen 33;ok +# BUG log qthreshold +- log qthreshold ;ok +tcp dport 300 log group 2 prefix \"IPTABLES-NFT SSH\";ok
tests/any/meta.t new file +157 -0
157 lines not on this page · raw message
tests/any/queue.t new file +15 -0
@@ -0,0 +1,15 @@ +*ip;test-ip4 +*ip6;test-ip6 +*inet;test-inet +*arp;test-arp +*bridge;test-bridge + +:output;type filter hook output priority 0 + +queue;ok;queue num 0 +queue num 2;ok +queue num 2-3;ok +- queue num {3, 4, 6};ok +queue num 4-5 fanout bypass;ok;queue num 4-5 bypass fanout +queue num 4-5 fanout;ok +queue num 4-5 bypass;ok
Signature · 1 line
2.0.0
PATCH 5/6 tests: Add arp folder with test files.
In reply to Ana Rey"arp" folder contains the test files that are executed in arp tables.
These test files are executed with nft-tests.py
--- tests/arp/arp.t | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/arp/chains.t | 5 +++++ 2 files changed, 63 insertions(+) create mode 100644 tests/arp/arp.t create mode 100644 tests/arp/chains.t
tests/arp/arp.t new file +58 -0
@@ -0,0 +1,58 @@ +*arp;test-arp +# filter chains available are: input, output, forward +:input;type filter hook input priority 0 + +arp htype 1;ok +arp htype != 1;ok +# http://www.iana.org/assignments/arp-parameters/arp-parameters.xhtml +arp htype 22;ok +arp htype != 233;ok +arp htype 33-45;ok;arp htype >= 33 arp htype <= 45 +arp htype != 33-45;ok;arp htype < 33 arp htype > 45 +arp htype { 33, 55, 67, 88};ok +# Bug to list arp htype { 1280, 1024, 256 } +-arp htype != { 33, 55, 67, 88};ok +arp htype { 33-55};ok +-arp htype != { 33-55};ok + +arp ptype 0x0800;ok + +arp hlen 22;ok +arp hlen != 233;ok +arp hlen 33-45;ok;arp hlen >= 33 arp hlen <= 45 +arp hlen != 33-45;ok;arp hlen < 33 arp hlen > 45 +arp hlen { 33, 55, 67, 88};ok +-arp hlen != { 33, 55, 67, 88};ok +arp hlen { 33-55};ok +-arp hlen != { 33-55};ok + +arp plen 22;ok +arp plen != 233;ok +arp plen 33-45;ok;arp plen >= 33 arp plen <= 45 +arp plen != 33-45;ok;arp plen < 33 arp plen > 45 +arp plen { 33, 55, 67, 88};ok +-arp plen != { 33, 55, 67, 88};ok +arp plen { 33-55};ok +-arp plen != {33-55};ok + + +arp operation {nak, inreply, inrequest, rreply, rrequest, reply, request};ok +-arp operation != {nak, inreply, inrequest, rreply, rrequest, reply, request};ok +# BUG to list arp operation { 1024, 2304, 768, 2048, 512, 2560, 256} + +arp operation request;ok +arp operation reply;ok +arp operation rrequest;ok +arp operation rreply;ok +arp operation inrequest;ok +arp operation inreply;ok +arp operation nak;ok +arp operation reply;ok +arp operation != request;ok +arp operation != reply;ok +arp operation != rrequest;ok +arp operation != rreply;ok +arp operation != inrequest;ok +arp operation != inreply;ok +arp operation != nak;ok +arp operation != reply;ok
tests/arp/chains.t new file +5 -0
@@ -0,0 +1,5 @@ +*arp;test-arp +- filter chains available are: input, output, forward +:input;type filter hook input priority 0 +:forward;type filter hook forward priority 0 +:output;type filter hook output priority 0
Signature · 1 line
2.0.0
PATCH 6/6 tests: Add bridge folder with test files.
In reply to Ana Rey"bridge" folder contains the test files that are executed in bridge tables.
These test files are executed with nft-tests.py
--- tests/bridge/chains.t | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/bridge/chains.t
tests/bridge/chains.t new file +8 -0
@@ -0,0 +1,8 @@ +*bridge;test-bridge + +# filter chains available are: input, output, forward +:filter-input;type filter hook input priority 0 +:filter-forward;type filter hook forward priority 0 +:filter-output;type filter hook output priority 0 + +-ether type 1;ok
Signature · 1 line
2.0.0