summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2016-03-10 12:14:23 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2016-03-10 12:15:08 +0100
commit3d3aa45033167b300ec81ab4ae7c2819ecac6ab5 (patch)
tree0c2de279d08175924da16c1dba64e41234d5efa3
parent039f818fc88010221cd7cf2e3c93d5bbc0db2b00 (diff)
tests/py: add tests for router-advertisement and router-solicitation icmp types
Introduced by 039f818fc88010 ("proto: Add router advertisement and solicitation icmp types"). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--tests/py/ip/icmp.t4
-rw-r--r--tests/py/ip/icmp.t.payload.ip27
2 files changed, 30 insertions, 1 deletions
diff --git a/tests/py/ip/icmp.t b/tests/py/ip/icmp.t
index 02027b0a..a6a4261c 100644
--- a/tests/py/ip/icmp.t
+++ b/tests/py/ip/icmp.t
@@ -17,7 +17,9 @@ icmp type info-request accept;ok
icmp type info-reply accept;ok
icmp type address-mask-request accept;ok
icmp type address-mask-reply accept;ok
-icmp type {echo-reply, destination-unreachable, source-quench, redirect, echo-request, time-exceeded, parameter-problem, timestamp-request, timestamp-reply, info-request, info-reply, address-mask-request, address-mask-reply} accept;ok
+icmp type router-advertisement accept;ok
+icmp type router-solicitation accept;ok
+icmp type {echo-reply, destination-unreachable, source-quench, redirect, echo-request, time-exceeded, parameter-problem, timestamp-request, timestamp-reply, info-request, info-reply, address-mask-request, address-mask-reply, router-advertisement, router-solicitation} accept;ok
- icmp type != {echo-reply, destination-unreachable, source-quench};ok
# BUG: icmp type != {echo-reply, destination-unreachable, source-quench}
# BUG: invalid expression type set
diff --git a/tests/py/ip/icmp.t.payload.ip b/tests/py/ip/icmp.t.payload.ip
index a6071a65..85369b9d 100644
--- a/tests/py/ip/icmp.t.payload.ip
+++ b/tests/py/ip/icmp.t.payload.ip
@@ -461,3 +461,30 @@ ip test-ip4 input
[ payload load 4b @ transport header + 4 => reg 1 ]
[ cmp neq reg 1 0x22000000 ]
+# icmp type router-advertisement accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+ [ payload load 1b @ transport header + 0 => reg 1 ]
+ [ cmp eq reg 1 0x00000009 ]
+ [ immediate reg 0 accept ]
+
+# icmp type router-solicitation accept
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+ [ payload load 1b @ transport header + 0 => reg 1 ]
+ [ cmp eq reg 1 0x0000000a ]
+ [ immediate reg 0 accept ]
+
+# icmp type {echo-reply, destination-unreachable, source-quench, redirect, echo-request, time-exceeded, parameter-problem, timestamp-request, timestamp-reply, info-request, info-reply, address-mask-request, address-mask-reply, router-advertisement, router-solicitation} accept
+set%d test-ip4 3
+set%d test-ip4 0
+ element 00000000 : 0 [end] element 00000003 : 0 [end] element 00000004 : 0 [end] element 00000005 : 0 [end] element 00000008 : 0 [end] element 0000000b : 0 [end] element 0000000c : 0 [end] element 0000000d : 0 [end] element 0000000e : 0 [end] element 0000000f : 0 [end] element 00000010 : 0 [end] element 00000011 : 0 [end] element 00000012 : 0 [end] element 00000009 : 0 [end] element 0000000a : 0 [end]
+ip test-ip4 input
+ [ payload load 1b @ network header + 9 => reg 1 ]
+ [ cmp eq reg 1 0x00000001 ]
+ [ payload load 1b @ transport header + 0 => reg 1 ]
+ [ lookup reg 1 set set%d ]
+ [ immediate reg 0 accept ]
+