summaryrefslogtreecommitdiff
path: root/regress/sys
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2016-10-20 21:06:00 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2016-10-20 21:06:00 +0000
commit907d9e920192b698cb7e3427bb036c8a0daf8793 (patch)
tree956e323fb06c911aa35e9421f719bc331e415d45 /regress/sys
parent178843c59a7bf268085e1872123cfe4a41f73c86 (diff)
During sniffing filter strictly on icmp6 "packet too big" to avoid
that "neighbor discovery" confuses the test.
Diffstat (limited to 'regress/sys')
-rw-r--r--regress/sys/net/pf_forward/ping6_mtu.py7
-rw-r--r--regress/sys/net/pf_forward/ping_mtu.py3
-rw-r--r--regress/sys/net/pf_fragment/ping6_mtu_1300.py4
-rw-r--r--regress/sys/net/pf_fragment/ping_mtu_1300.py3
4 files changed, 15 insertions, 2 deletions
diff --git a/regress/sys/net/pf_forward/ping6_mtu.py b/regress/sys/net/pf_forward/ping6_mtu.py
index c6f1b93f842..14e47210f0a 100644
--- a/regress/sys/net/pf_forward/ping6_mtu.py
+++ b/regress/sys/net/pf_forward/ping6_mtu.py
@@ -32,13 +32,18 @@ iplen=IPv6(str(ip)).plen
eth=Ether(src=SRC_MAC, dst=PF_MAC)/ip
sniffer = Sniff1();
-sniffer.filter = "ip6 and dst %s and icmp6" % srcaddr
+# pcap cannot access icmp6, check for packet too big, avoid neighbor discovery
+sniffer.filter = "ip6 and dst %s and icmp6 and ip6[40] = 2 and ip6[41] = 0" \
+ % srcaddr
sniffer.start()
time.sleep(1)
sendp(eth, iface=SRC_IF)
sniffer.join(timeout=5)
a = sniffer.packet
+if a is None:
+ print "no packet sniffed"
+ exit(2)
if a and a.type == ETH_P_IPV6 and \
ipv6nh[a.payload.nh] == 'ICMPv6' and \
icmp6types[a.payload.payload.type] == 'Packet too big':
diff --git a/regress/sys/net/pf_forward/ping_mtu.py b/regress/sys/net/pf_forward/ping_mtu.py
index 98577ed1168..4afba9ca250 100644
--- a/regress/sys/net/pf_forward/ping_mtu.py
+++ b/regress/sys/net/pf_forward/ping_mtu.py
@@ -19,6 +19,9 @@ iplen=IP(str(ip)).len
eth=Ether(src=SRC_MAC, dst=PF_MAC)/ip
a=srp1(eth, iface=SRC_IF, timeout=2)
+if a is None:
+ print "no packet sniffed"
+ exit(2)
if a and a.payload.payload.type==3 and a.payload.payload.code==4:
mtu=a.payload.payload.nexthopmtu
print "mtu=%d" % (mtu)
diff --git a/regress/sys/net/pf_fragment/ping6_mtu_1300.py b/regress/sys/net/pf_fragment/ping6_mtu_1300.py
index a6550686cfe..38d6db15f4c 100644
--- a/regress/sys/net/pf_fragment/ping6_mtu_1300.py
+++ b/regress/sys/net/pf_fragment/ping6_mtu_1300.py
@@ -26,7 +26,9 @@ ip=hdr/payload
eth=Ether(src=SRC_MAC, dst=PF_MAC)/ip
sniffer = Sniff1();
-sniffer.filter = "ip6 and dst %s and icmp6" % SRC_OUT6
+# pcap cannot access icmp6, check for packet too big, avoid neighbor discovery
+sniffer.filter = "ip6 and dst %s and icmp6 and ip6[40] = 2 and ip6[41] = 0" \
+ % SRC_OUT6
sniffer.start()
time.sleep(1)
sendp(eth, iface=SRC_IF)
diff --git a/regress/sys/net/pf_fragment/ping_mtu_1300.py b/regress/sys/net/pf_fragment/ping_mtu_1300.py
index 4f3dd85191d..7e5ffa22c6b 100644
--- a/regress/sys/net/pf_fragment/ping_mtu_1300.py
+++ b/regress/sys/net/pf_fragment/ping_mtu_1300.py
@@ -13,6 +13,9 @@ ip=hdr/payload
eth=Ether(src=SRC_MAC, dst=PF_MAC)/ip
a=srp1(eth, iface=SRC_IF, timeout=2)
+if a is None:
+ print "no packet sniffed"
+ exit(2)
if a and a.payload.payload.type==3 and a.payload.payload.code==4:
mtu=a.payload.payload.nexthopmtu
print "mtu=%d" % (mtu)