diff options
-rw-r--r-- | regress/sys/netinet6/frag6/Makefile | 10 | ||||
-rw-r--r-- | regress/sys/netinet6/frag6/frag6_timeout.py | 54 |
2 files changed, 63 insertions, 1 deletions
diff --git a/regress/sys/netinet6/frag6/Makefile b/regress/sys/netinet6/frag6/Makefile index b285f26a64e..55434b249d1 100644 --- a/regress/sys/netinet6/frag6/Makefile +++ b/regress/sys/netinet6/frag6/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2012/02/08 00:35:31 bluhm Exp $ +# $OpenBSD: Makefile,v 1.7 2013/07/23 22:15:04 bluhm Exp $ # The following ports must be installed: # @@ -166,7 +166,15 @@ run-regress-frag6-udppayload: addr.py @echo Check ping6 udp payload fragment ${SUDO} python2.7 frag6_udppayload.py +# fragmented icmp packet not within 60 second timeout +TARGETS += frag6-timeout +run-regress-frag6-timeout: addr.py + @echo '\n======== $@ ========' + @echo Check ping6 fragment timeout + ${SUDO} python2.7 frag6_timeout.py + REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/} +REGRESS_SLOW_TARGETS = run-regress-frag6-timeout CLEANFILES += addr.py *.pyc *.log diff --git a/regress/sys/netinet6/frag6/frag6_timeout.py b/regress/sys/netinet6/frag6/frag6_timeout.py new file mode 100644 index 00000000000..7082fa6f3b5 --- /dev/null +++ b/regress/sys/netinet6/frag6/frag6_timeout.py @@ -0,0 +1,54 @@ +#!/usr/local/bin/python2.7 +# send 5 non-overlapping ping6 fragments in 75 seconds, timeout is 60 + +# |----| +# |----| +# |----| +# |----| +# |----| + +import os +from addr import * +from scapy.all import * + +pid=os.getpid() +payload="ABCDEFGHIJKLMNOPQRSTUVWXYZ123456" +packet=IPv6(src=SRC_OUT6, dst=DST_IN6)/ICMPv6EchoRequest(id=pid, data=payload) +frag=[] +frag.append(IPv6ExtHdrFragment(nh=58, id=pid, m=1)/str(packet)[40:48]) +frag.append(IPv6ExtHdrFragment(nh=58, id=pid, offset=1, m=1)/str(packet)[48:56]) +frag.append(IPv6ExtHdrFragment(nh=58, id=pid, offset=2, m=1)/str(packet)[56:64]) +frag.append(IPv6ExtHdrFragment(nh=58, id=pid, offset=3, m=1)/str(packet)[64:72]) +frag.append(IPv6ExtHdrFragment(nh=58, id=pid, offset=4)/str(packet)[72:80]) +eth=[] +for f in frag: + pkt=IPv6(src=SRC_OUT6, dst=DST_IN6)/f + eth.append(Ether(src=SRC_MAC, dst=DST_MAC)/pkt) + +if os.fork() == 0: + time.sleep(1) + for e in eth: + sendp(e, iface=SRC_IF) + time.sleep(15) + os._exit(0) + +ans=sniff(iface=SRC_IF, timeout=90, filter= + "ip6 and src "+DST_IN6+" and dst "+SRC_OUT6+" and icmp6") +for a in ans: + if a and a.type == scapy.layers.dot11.ETHER_TYPES.IPv6 and \ + ipv6nh[a.payload.nh] == 'ICMPv6' and \ + icmp6types[a.payload.payload.type] == 'Echo Reply': + id=a.payload.payload.id + print "id=%#x" % (id) + if id != pid: + print "WRONG ECHO REPLY ID" + exit(2) + data=a.payload.payload.data + print "payload=%s" % (data) + if data == payload: + print "ECHO REPLY" + exit(1) + print "PAYLOAD!=%s" % (payload) + exit(2) +print "no echo reply" +exit(0) |