summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-10-20 21:05:58 +0000
committerbluhm <bluhm@openbsd.org>2016-10-20 21:05:58 +0000
commit1ca2c44da83b9bb0ace1595cc14677c467485c00 (patch)
treed214e1ee230f35bc63c04f11a8d0c01ccb1e8883
parentsome macro fixes for the options list; (diff)
downloadwireguard-openbsd-1ca2c44da83b9bb0ace1595cc14677c467485c00.tar.xz
wireguard-openbsd-1ca2c44da83b9bb0ace1595cc14677c467485c00.zip
During sniffing filter strictly on icmp6 "packet too big" to avoid
that "neighbor discovery" confuses the test.
-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)