summaryrefslogtreecommitdiff
path: root/regress/sys/netinet6/rh0/rh0_frag_empty.py
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2020-12-25 22:16:04 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2020-12-25 22:16:04 +0000
commita46f7a784a0fd34c3f0d5c01bb2afc056141cac3 (patch)
tree85eb6744aca8a5f9cd622489fd46106a03c52e2e /regress/sys/netinet6/rh0/rh0_frag_empty.py
parent7589278ef5d08e809e3efaa613ce126a041aa71e (diff)
Switch to scapy with python 3.
Diffstat (limited to 'regress/sys/netinet6/rh0/rh0_frag_empty.py')
-rw-r--r--regress/sys/netinet6/rh0/rh0_frag_empty.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/regress/sys/netinet6/rh0/rh0_frag_empty.py b/regress/sys/netinet6/rh0/rh0_frag_empty.py
index 779522c44c5..4f61fcf91c6 100644
--- a/regress/sys/netinet6/rh0/rh0_frag_empty.py
+++ b/regress/sys/netinet6/rh0/rh0_frag_empty.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 behind a fragment header to avoid header scan
# we expect an echo reply, as there are no more hops
-print "send with fragment and routing header type 0 but empty address list"
+print("send with fragment and routing header type 0 but empty address list")
import os
from addr import *
@@ -13,7 +13,7 @@ from scapy.all import *
pid=os.getpid()
eid=pid & 0xffff
fid=pid & 0xffffffff
-payload="ABCDEFGHIJKLMNOP"
+payload=b"ABCDEFGHIJKLMNOP"
packet=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/\
IPv6ExtHdrFragment(id=fid)/\
IPv6ExtHdrRouting(addresses=[])/\
@@ -33,15 +33,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)