Skip to contentSkip to conversation

tests: nft removes required payload protocol expressions

PATCH In review Florian Westphal 2 participants 4 messages Mar 23, 2017 – Apr 6, 2017 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 tests: nft removes required payload protocol expressions

This test fails with
'ip protocol tcp tcp dport 22' mismatches 'tcp dport 22'

ip protocol tcp tcp dport 22 is *ONLY* identical to 'tcp dport 22' in the ip family.

For netdev/inet/bridge, the dependency is required because we only want to match ipv4 packets.

---
Ran out of time, sorry.

I'll need to delay both this and the change of ipv6 nexthdr to meta dependencies until after netdev 2.1.

 tests/py/inet/ip_tcp.t         | 9 +++++++++
 tests/py/inet/ip_tcp.t.payload | 8 ++++++++
 tests/py/ip/ip_tcp.t           | 7 +++++++
 tests/py/ip/ip_tcp.t.payload   | 6 ++++++
 4 files changed, 30 insertions(+)
 create mode 100644 tests/py/inet/ip_tcp.t
 create mode 100644 tests/py/inet/ip_tcp.t.payload
 create mode 100644 tests/py/ip/ip_tcp.t
 create mode 100644 tests/py/ip/ip_tcp.t.payload
tests/py/inet/ip_tcp.t new file +9 -0
new file mode 100644
index 000000000000..b69edc38137b
@@ -0,0 +1,9 @@
+:input;type filter hook input priority 0
+:ingress;type filter hook ingress device lo priority 0
+
+*inet;test-inet;input
+*bridge;test-bridge;input
+*netdev;test-netdev;ingress
+
+# must not remove ip dependency -- ONLY ipv4 packets should be matched
+ip protocol tcp tcp dport 22;ok;ip protocol 6 tcp dport 22
tests/py/inet/ip_tcp.t.payload new file +8 -0
new file mode 100644
index 000000000000..b13988bc8d5e
@@ -0,0 +1,8 @@
+# ip protocol tcp tcp dport 22
+inet test-inet input
+  [ meta load nfproto => reg 1 ]
+  [ cmp eq reg 1 0x00000002 ]
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ payload load 2b @ transport header + 2 => reg 1 ]
+  [ cmp eq reg 1 0x00001600 ]
tests/py/ip/ip_tcp.t new file +7 -0
new file mode 100644
index 000000000000..30759c8f619b
@@ -0,0 +1,7 @@
+:input;type filter hook input priority 0
+:ingress;type filter hook ingress device lo priority 0
+
+*ip;test-inet;input
+
+# can remove ip dependency -- its redundant in ip family
+ip protocol tcp tcp dport 22;ok;tcp dport 22
tests/py/ip/ip_tcp.t.payload new file +6 -0
new file mode 100644
index 000000000000..e4141394af7e
@@ -0,0 +1,6 @@
+# ip protocol tcp tcp dport 22
+ip test-inet input
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ payload load 2b @ transport header + 2 => reg 1 ]
+  [ cmp eq reg 1 0x00001600 ]
Signature · 1 line
2.10.2
#1 lore raw
Quoted 8 lines · Florian Westphal

This test fails with
'ip protocol tcp tcp dport 22' mismatches 'tcp dport 22'

ip protocol tcp tcp dport 22 is *ONLY* identical to 'tcp dport 22' in the ip family.

For netdev/inet/bridge, the dependency is required because we only want to match ipv4 packets.

This needs the C chunk to fix this, right? so I let you decide if you want to push out this test now or make it together with the fix.

Thanks!

author maintainer
#2 lore raw
Quoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines · Florian Westphal

This test fails with
'ip protocol tcp tcp dport 22' mismatches 'tcp dport 22'

Quoted 8 lines
Quoted 5 lines

ip protocol tcp tcp dport 22 is *ONLY* identical to 'tcp dport 22' in the ip family.

For netdev/inet/bridge, the dependency is required because we only want to match ipv4 packets.

This needs the C chunk to fix this, right? so I let you decide if you want to push out this test now or make it together with the fix.

I have no fix at the moment.

I will thus probably push this test when I get home so we don't forget about it.

maintainer Acked-by
#3 lore raw
Quoted 11 lines · Florian Westphal
Quoted 10 lines · Pablo Neira Ayuso
Quoted 8 lines · Florian Westphal

This test fails with
'ip protocol tcp tcp dport 22' mismatches 'tcp dport 22'

ip protocol tcp tcp dport 22 is *ONLY* identical to 'tcp dport 22' in the ip family.

For netdev/inet/bridge, the dependency is required because we only want to match ipv4 packets.

Quoted 7 lines
Quoted 2 lines

This needs the C chunk to fix this, right? so I let you decide if you want to push out this test now or make it together with the fix.

I have no fix at the moment.

I will thus probably push this test when I get home so we don't forget about it.

Thanks!