From a46f7a784a0fd34c3f0d5c01bb2afc056141cac3 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Fri, 25 Dec 2020 22:16:04 +0000 Subject: Switch to scapy with python 3. --- regress/sys/netinet6/rh0/rh0_frag_empty.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'regress/sys/netinet6/rh0/rh0_frag_empty.py') 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) -- cgit v1.2.3