summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-09-02 07:41:32 +0200
committerChristian Poessinger <christian@poessinger.com>2022-09-02 06:21:32 +0200
commit96302a27db8e9aaad3f2c1a81457c5e8e048dd4b (patch)
tree06c63cba1e38428ebd110685f9ff511ebce22282 /smoketest/scripts/cli
parent735767f09f891c438e43565f935b927e6f1b317d (diff)
parent312ee15058fbb26feb6a93520417f0d5343ad15b (diff)
downloadvyos-1x-96302a27db8e9aaad3f2c1a81457c5e8e048dd4b.tar.gz
vyos-1x-96302a27db8e9aaad3f2c1a81457c5e8e048dd4b.zip
Merge branch 'T4651' of https://github.com/nicolas-fort/vyos-1x into firewall
* 'T4651' of https://github.com/nicolas-fort/vyos-1x: Firewall: T4651: Change proposed cli from ip-length to packet-length Firewall: T4651: Add options to match packet size on firewall rules.
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_firewall.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_firewall.py b/smoketest/scripts/cli/test_firewall.py
index 684a07681..8b6c221e3 100755
--- a/smoketest/scripts/cli/test_firewall.py
+++ b/smoketest/scripts/cli/test_firewall.py
@@ -209,6 +209,13 @@ class TestFirewall(VyOSUnitTestSHIM.TestCase):
self.cli_set(['firewall', 'name', 'smoketest', 'rule', '5', 'tcp', 'flags', 'syn'])
self.cli_set(['firewall', 'name', 'smoketest', 'rule', '5', 'tcp', 'mss', mss_range])
+ self.cli_set(['firewall', 'name', 'smoketest', 'rule', '6', 'action', 'accept'])
+ self.cli_set(['firewall', 'name', 'smoketest', 'rule', '6', 'packet-length', '64,512,1024'])
+ self.cli_set(['firewall', 'name', 'smoketest', 'rule', '7', 'action', 'accept'])
+ self.cli_set(['firewall', 'name', 'smoketest', 'rule', '7', 'packet-length', '0-30000'])
+ self.cli_set(['firewall', 'name', 'smoketest', 'rule', '8', 'action', 'accept'])
+ self.cli_set(['firewall', 'name', 'smoketest', 'rule', '8', 'packet-length', '!60000-65535'])
+
self.cli_set(['interfaces', 'ethernet', 'eth0', 'firewall', 'in', 'name', 'smoketest'])
self.cli_commit()
@@ -220,7 +227,10 @@ class TestFirewall(VyOSUnitTestSHIM.TestCase):
['tcp dport { 22 }', 'limit rate 5/minute', 'return'],
['log prefix "[smoketest-default-D]"','smoketest default-action', 'drop'],
['tcp dport { 22 }', 'add @RECENT_smoketest_4 { ip saddr limit rate over 10/minute burst 10 packets }', 'drop'],
- [f'tcp flags & syn == syn tcp option maxseg size {mss_range}']
+ [f'tcp flags & syn == syn tcp option maxseg size {mss_range}'],
+ ['ip length { 64, 512, 1024 }', 'return'],
+ ['ip length { 0-30000 }', 'return'],
+ ['ip length != { 60000-65535 }', 'return']
]
self.verify_nftables(nftables_search, 'ip filter')
@@ -239,6 +249,13 @@ class TestFirewall(VyOSUnitTestSHIM.TestCase):
self.cli_set(['firewall', 'ipv6-name', 'v6-smoketest', 'rule', '2', 'protocol', 'tcp_udp'])
self.cli_set(['firewall', 'ipv6-name', 'v6-smoketest', 'rule', '2', 'destination', 'port', '8888'])
+ self.cli_set(['firewall', 'ipv6-name', 'v6-smoketest', 'rule', '3', 'action', 'accept'])
+ self.cli_set(['firewall', 'ipv6-name', 'v6-smoketest', 'rule', '3', 'packet-length', '64,512,1024'])
+ self.cli_set(['firewall', 'ipv6-name', 'v6-smoketest', 'rule', '4', 'action', 'accept'])
+ self.cli_set(['firewall', 'ipv6-name', 'v6-smoketest', 'rule', '4', 'packet-length', '0-30000'])
+ self.cli_set(['firewall', 'ipv6-name', 'v6-smoketest', 'rule', '5', 'action', 'accept'])
+ self.cli_set(['firewall', 'ipv6-name', 'v6-smoketest', 'rule', '5', 'packet-length', '!60000-65535'])
+
self.cli_set(['interfaces', 'ethernet', 'eth0', 'firewall', 'in', 'ipv6-name', 'v6-smoketest'])
self.cli_commit()
@@ -247,6 +264,9 @@ class TestFirewall(VyOSUnitTestSHIM.TestCase):
['iifname "eth0"', 'jump NAME6_v6-smoketest'],
['saddr 2002::1', 'daddr 2002::1:1', 'log prefix "[v6-smoketest-1-A]" level crit', 'return'],
['meta l4proto { tcp, udp }', 'th dport { 8888 }', 'reject'],
+ ['ip6 length { 64, 512, 1024 }', 'return'],
+ ['ip6 length { 0-30000 }', 'return'],
+ ['ip6 length != { 60000-65535 }', 'return'],
['smoketest default-action', 'log prefix "[v6-smoketest-default-D]"', 'drop']
]