summaryrefslogtreecommitdiff
path: root/regress/sys/netinet6/rh0/rh0_frag2.py
diff options
context:
space:
mode:
Diffstat (limited to 'regress/sys/netinet6/rh0/rh0_frag2.py')
-rw-r--r--regress/sys/netinet6/rh0/rh0_frag2.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/regress/sys/netinet6/rh0/rh0_frag2.py b/regress/sys/netinet6/rh0/rh0_frag2.py
index 266e47a90dd..7c5d50b7835 100644
--- a/regress/sys/netinet6/rh0/rh0_frag2.py
+++ b/regress/sys/netinet6/rh0/rh0_frag2.py
@@ -1,10 +1,10 @@
-#!/usr/local/bin/python2.7
+#!/usr/local/bin/python3
# send a ping6 packet with routing header type 0
# the address list is empty
# hide the routing header in a second fragment to preclude header scan
# we expect an echo reply, as there are no more hops
-print "send with fragment and routing header type 0 to be source routed"
+print("send with fragment and routing header type 0 to be source routed")
import os
from addr import *
@@ -12,15 +12,15 @@ from scapy.all import *
pid=os.getpid()
eid=pid & 0xffff
-payload="ABCDEFGHIJKLMNOP"
+payload=b"ABCDEFGHIJKLMNOP"
packet=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/\
IPv6ExtHdrDestOpt()/\
IPv6ExtHdrRouting(addresses=[])/\
ICMPv6EchoRequest(id=eid, data=payload)
frag=[]
fid=pid & 0xffffffff
-frag.append(IPv6ExtHdrFragment(nh=60, id=fid, m=1)/str(packet)[40:48])
-frag.append(IPv6ExtHdrFragment(nh=60, id=fid, offset=1)/str(packet)[48:80])
+frag.append(IPv6ExtHdrFragment(nh=60, id=fid, m=1)/bytes(packet)[40:48])
+frag.append(IPv6ExtHdrFragment(nh=60, id=fid, offset=1)/bytes(packet)[48:80])
eth=[]
for f in frag:
pkt=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/f
@@ -39,15 +39,15 @@ for a in ans:
icmp6types[a.payload.payload.type] == 'Echo Reply':
reply=a.payload.payload
id=reply.id
- print "id=%#x" % (id)
+ print("id=%#x" % (id))
if id != eid:
- print "WRONG ECHO REPLY ID"
+ print("WRONG ECHO REPLY ID")
exit(2)
data=reply.data
- print "payload=%s" % (data)
+ print("payload=%s" % (data))
if data != payload:
- print "WRONG PAYLOAD"
+ print("WRONG PAYLOAD")
exit(2)
exit(0)
-print "NO ICMP6 ECHO REPLY"
+print("NO ICMP6 ECHO REPLY")
exit(1)