summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2015-08-24 22:14:01 +0000
committerbluhm <bluhm@openbsd.org>2015-08-24 22:14:01 +0000
commitf674f844308d1a91e5d7cf5d36cc4ba4b3551ed9 (patch)
tree195705e0b4203c4851ba6728aa3d1001a887767c
parentAlways increment the reference counter of the returned route entry in (diff)
downloadwireguard-openbsd-f674f844308d1a91e5d7cf5d36cc4ba4b3551ed9.tar.xz
wireguard-openbsd-f674f844308d1a91e5d7cf5d36cc4ba4b3551ed9.zip
Enable path MTU test with ping for IPv6. Scapy srp1() does not
accept inner IPv6 packets in ICMP6 with bad checksum created by pf. Use same workaround as in pf_forward tests and fork a process for sniffing.
-rw-r--r--regress/sys/net/pf_fragment/Makefile8
-rw-r--r--regress/sys/net/pf_fragment/ping6_mtu_1300.py18
2 files changed, 18 insertions, 8 deletions
diff --git a/regress/sys/net/pf_fragment/Makefile b/regress/sys/net/pf_fragment/Makefile
index 821091bcc77..67bf1f6bd0c 100644
--- a/regress/sys/net/pf_fragment/Makefile
+++ b/regress/sys/net/pf_fragment/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.15 2015/08/17 22:06:50 bluhm Exp $
+# $OpenBSD: Makefile,v 1.16 2015/08/24 22:14:01 bluhm Exp $
# The following ports must be installed:
#
@@ -162,11 +162,7 @@ run-regress-fragping6: stamp-pfctl
# parse response packet to determine MTU of the router. The MTU has
# to be 1300 octets. The MTU has to be defined at out interface of
# the router RT before.
-TARGETS += ping-mtu
-
-# Currently this test fails as pf does not fix the checksum of
-# NATed packets inside of ICMP packets.
-# XXX TARGETS += ping6-mtu
+TARGETS += ping-mtu ping6-mtu
run-regress-ping-mtu: addr.py stamp-pfctl
@echo '\n======== $@ ========'
diff --git a/regress/sys/net/pf_fragment/ping6_mtu_1300.py b/regress/sys/net/pf_fragment/ping6_mtu_1300.py
index 30c220a7220..404ea45e14f 100644
--- a/regress/sys/net/pf_fragment/ping6_mtu_1300.py
+++ b/regress/sys/net/pf_fragment/ping6_mtu_1300.py
@@ -8,8 +8,22 @@ from scapy.all import *
dstaddr=sys.argv[1]
pid=os.getpid()
payload="a" * 1452
-a=srp1(Ether(src=SRC_MAC, dst=PF_MAC)/IPv6(src=SRC_OUT6, dst=dstaddr)/
- ICMPv6EchoRequest(id=pid, data=payload), iface=SRC_IF, timeout=2)
+eth=Ether(src=SRC_MAC, dst=PF_MAC)/IPv6(src=SRC_OUT6, dst=dstaddr)/\
+ ICMPv6EchoRequest(id=pid, data=payload)
+
+# work around the broken sniffing of packages with bad checksum
+#a=srp1(eth, iface=SRC_IF, timeout=2)
+if os.fork() == 0:
+ time.sleep(1)
+ sendp(eth, iface=SRC_IF)
+ os._exit(0)
+ans=sniff(iface=SRC_IF, timeout=3, filter=
+ "ip6 and dst "+SRC_OUT6+" and icmp6")
+if len(ans) == 0:
+ print "no packet sniffed"
+ exit(2)
+a=ans[0]
+
if a and a.type == ETH_P_IPV6 and \
ipv6nh[a.payload.nh] == 'ICMPv6' and \
icmp6types[a.payload.payload.type] == 'Packet too big':