]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/py: add tests for router-advertisement and router-solicitation icmp types
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 10 Mar 2016 11:14:23 +0000 (12:14 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 10 Mar 2016 11:15:08 +0000 (12:15 +0100)
Introduced by 039f818fc88010 ("proto: Add router advertisement and solicitation
icmp types").

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/py/ip/icmp.t
tests/py/ip/icmp.t.payload.ip

index 02027b0a52869d4d544e35765468ee8ec0c93802..a6a4261c76f17c5091df0bad0e19cdb3d77d1f8e 100644 (file)
@@ -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
index a6071a6591c6e34a7140c64fd24e2ffee3240ac7..85369b9d42f9933014ca05b61094c739b777c063 100644 (file)
@@ -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 ]
+