-# $OpenBSD: Makefile,v 1.10 2014/07/11 18:25:50 bluhm Exp $
+# $OpenBSD: Makefile,v 1.11 2015/04/15 21:29:15 bluhm Exp $
# The following ports must be installed:
#
@echo Check ping6 destination option reassembly
${SUDO} ${PYTHON}frag6_opt.py
+# The ethernet frame has some padding that must be ignored by reassembly
+TARGETS += frag6-padding
+run-regress-frag6-padding: addr.py
+ @echo '\n======== $@ ========'
+ @echo Check ping6 ethernet padding
+ ${SUDO} ${PYTHON}frag6_padding.py
+
# fragmented packet with head overlapping first fragment
TARGETS += frag6-overhead0
run-regress-frag6-overhead0: addr.py
--- /dev/null
+#!/usr/local/bin/python2.7
+# send 2 non-overlapping ping6 fragments with ethernet padding
+
+# |--------|XX|
+# |----|XX|
+
+import os
+from addr import *
+from scapy.all import *
+
+pid=os.getpid()
+payload="ABCDEFGHIJKLMNOP"
+padding="0123"
+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:56])
+frag.append(IPv6ExtHdrFragment(nh=58, id=pid, offset=2)/str(packet)[56:64])
+eth=[]
+for f in frag:
+ pkt=str(IPv6(src=SRC_OUT6, dst=DST_IN6)/f) + padding
+ eth.append(Ether(src=SRC_MAC, dst=DST_MAC, type=0x86dd)/pkt)
+
+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 src "+DST_IN6+" and dst "+SRC_OUT6+" and icmp6")
+for a in ans:
+ if a and a.type == ETH_P_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:
+ exit(0)
+ print "PAYLOAD!=%s" % (payload)
+ exit(1)
+print "NO ECHO REPLY"
+exit(2)