summaryrefslogtreecommitdiff
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
parent7589278ef5d08e809e3efaa613ce126a041aa71e (diff)
Switch to scapy with python 3.
-rw-r--r--regress/sys/netinet6/rh0/LICENSE26
-rw-r--r--regress/sys/netinet6/rh0/Makefile13
-rw-r--r--regress/sys/netinet6/rh0/rh0_empty.py16
-rw-r--r--regress/sys/netinet6/rh0/rh0_final.py16
-rw-r--r--regress/sys/netinet6/rh0/rh0_frag2.py20
-rw-r--r--regress/sys/netinet6/rh0/rh0_frag_empty.py16
-rw-r--r--regress/sys/netinet6/rh0/rh0_frag_final.py16
-rw-r--r--regress/sys/netinet6/rh0/rh0_frag_route.py16
-rw-r--r--regress/sys/netinet6/rh0/rh0_none.py16
-rw-r--r--regress/sys/netinet6/rh0/rh0_route.py16
10 files changed, 85 insertions, 86 deletions
diff --git a/regress/sys/netinet6/rh0/LICENSE b/regress/sys/netinet6/rh0/LICENSE
index 8132b495a44..866739d7ee3 100644
--- a/regress/sys/netinet6/rh0/LICENSE
+++ b/regress/sys/netinet6/rh0/LICENSE
@@ -1,13 +1,13 @@
-# Copyright (c) 2012-2017 Alexander Bluhm <bluhm@openbsd.org>
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+Copyright (c) 2012-2020 Alexander Bluhm <bluhm@openbsd.org>
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/regress/sys/netinet6/rh0/Makefile b/regress/sys/netinet6/rh0/Makefile
index db790d35449..ab2b9e7f577 100644
--- a/regress/sys/netinet6/rh0/Makefile
+++ b/regress/sys/netinet6/rh0/Makefile
@@ -1,15 +1,14 @@
-# $OpenBSD: Makefile,v 1.14 2020/12/17 00:51:13 bluhm Exp $
+# $OpenBSD: Makefile,v 1.15 2020/12/25 22:16:03 bluhm Exp $
# The following ports must be installed:
#
-# python-2.7 interpreted object-oriented programming language
# scapy powerful interactive packet manipulation in python
-.if ! exists(/usr/local/bin/python2.7) || ! exists(/usr/local/bin/scapy)
+.if ! exists(/usr/local/bin/scapy-3)
.BEGIN:
@true
regress:
- @echo Install python and the scapy module for additional tests.
+ @echo Install py3-scapy package to run this regress.
@echo SKIPPED
.endif
@@ -54,10 +53,10 @@ regress:
.if make (regress) || make (all)
.BEGIN:
- @echo
${SUDO} true
ssh -t ${REMOTE_SSH} ${SUDO} true
rm -f stamp-stack stamp-pf
+ @echo
.endif
# Create python include file containing the addresses.
@@ -74,9 +73,9 @@ addr.py: Makefile
# Set variables so that make runs with and without obj directory.
# Only do that if necessary to keep visible output short.
.if ${.CURDIR} == ${.OBJDIR}
-PYTHON = python2.7 -u ./
+PYTHON = python3 -u ./
.else
-PYTHON = PYTHONPATH=${.OBJDIR} python2.7 -u ${.CURDIR}/
+PYTHON = PYTHONPATH=${.OBJDIR} python3 -u ${.CURDIR}/
.endif
stamp-stack:
diff --git a/regress/sys/netinet6/rh0/rh0_empty.py b/regress/sys/netinet6/rh0/rh0_empty.py
index b75efbba722..5809d29acec 100644
--- a/regress/sys/netinet6/rh0/rh0_empty.py
+++ b/regress/sys/netinet6/rh0/rh0_empty.py
@@ -1,16 +1,16 @@
-#!/usr/local/bin/python2.7
+#!/usr/local/bin/python3
# send a ping6 packet with routing header type 0
# the address list is empty
# we expect a parameter problem from header scanning
-print "send ping6 packet with routing header type 0 but empty address list"
+print("send ping6 packet with routing header type 0 but empty address list")
import os
from addr import *
from scapy.all import *
eid=os.getpid() & 0xffff
-payload="ABCDEFGHIJKLMNOP"
+payload=b"ABCDEFGHIJKLMNOP"
packet=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/\
IPv6ExtHdrRouting(addresses=[])/\
ICMPv6EchoRequest(id=eid, data=payload)
@@ -29,15 +29,15 @@ for a in ans:
icmp6types[a.payload.payload.type] == 'Parameter problem':
pprob=a.payload.payload
code=pprob.code
- print "code=%#d" % (code)
+ print("code=%#d" % (code))
if code != 0:
- print "WRONG PARAMETER PROBLEM CODE"
+ print("WRONG PARAMETER PROBLEM CODE")
exit(2)
ptr=pprob.ptr
- print "ptr=%#d" % (ptr)
+ print("ptr=%#d" % (ptr))
if ptr != 42:
- print "WRONG PARAMETER PROBLEM POINTER"
+ print("WRONG PARAMETER PROBLEM POINTER")
exit(2)
exit(0)
-print "NO ICMP6 PARAMETER PROBLEM"
+print("NO ICMP6 PARAMETER PROBLEM")
exit(1)
diff --git a/regress/sys/netinet6/rh0/rh0_final.py b/regress/sys/netinet6/rh0/rh0_final.py
index 3347a238f79..da53ef8c621 100644
--- a/regress/sys/netinet6/rh0/rh0_final.py
+++ b/regress/sys/netinet6/rh0/rh0_final.py
@@ -1,16 +1,16 @@
-#!/usr/local/bin/python2.7
+#!/usr/local/bin/python3
# send a ping6 packet with routing header type 0
# the address pointer is at the final destination
# we expect a parameter problem from header scanning
-print "send ping6 packet with routing header type 0 to the final destination"
+print("send ping6 packet with routing header type 0 to the final destination")
import os
from addr import *
from scapy.all import *
eid=os.getpid() & 0xffff
-payload="ABCDEFGHIJKLMNOP"
+payload=b"ABCDEFGHIJKLMNOP"
packet=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/\
IPv6ExtHdrRouting(addresses=[OTHER_FAKE1_ADDR6, OTHER_FAKE2_ADDR6], \
segleft=0)/\
@@ -30,15 +30,15 @@ for a in ans:
icmp6types[a.payload.payload.type] == 'Parameter problem':
pprob=a.payload.payload
code=pprob.code
- print "code=%#d" % (code)
+ print("code=%#d" % (code))
if code != 0:
- print "WRONG PARAMETER PROBLEM CODE"
+ print("WRONG PARAMETER PROBLEM CODE")
exit(2)
ptr=pprob.ptr
- print "ptr=%#d" % (ptr)
+ print("ptr=%#d" % (ptr))
if ptr != 42:
- print "WRONG PARAMETER PROBLEM POINTER"
+ print("WRONG PARAMETER PROBLEM POINTER")
exit(2)
exit(0)
-print "NO ICMP6 PARAMETER PROBLEM"
+print("NO ICMP6 PARAMETER PROBLEM")
exit(1)
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)
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)
diff --git a/regress/sys/netinet6/rh0/rh0_frag_final.py b/regress/sys/netinet6/rh0/rh0_frag_final.py
index e8bf0c9852c..e373fe885cf 100644
--- a/regress/sys/netinet6/rh0/rh0_frag_final.py
+++ b/regress/sys/netinet6/rh0/rh0_frag_final.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 pointer is at the final destination
# 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 to the final destination"
+print("send with fragment and routing header type 0 to the final destination")
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=[OTHER_FAKE1_ADDR6, OTHER_FAKE2_ADDR6], \
@@ -34,15 +34,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)
diff --git a/regress/sys/netinet6/rh0/rh0_frag_route.py b/regress/sys/netinet6/rh0/rh0_frag_route.py
index de9bc9a8f8d..2ad5e8045af 100644
--- a/regress/sys/netinet6/rh0/rh0_frag_route.py
+++ b/regress/sys/netinet6/rh0/rh0_frag_route.py
@@ -1,10 +1,10 @@
-#!/usr/local/bin/python2.7
+#!/usr/local/bin/python3
# send a ping6 packet with routing header type 0
# try to source route
# hide the routing header behind a fragment header to avoid header scan
# we expect an ICMP6 error, as we do not support source routing
-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 *
@@ -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=[OTHER_FAKE1_ADDR6, OTHER_FAKE2_ADDR6], \
@@ -34,15 +34,15 @@ for a in ans:
icmp6types[a.payload.payload.type] == 'Parameter problem':
pprob=a.payload.payload
code=pprob.code
- print "code=%#d" % (code)
+ print("code=%#d" % (code))
if code != 0:
- print "WRONG PARAMETER PROBLEM CODE"
+ print("WRONG PARAMETER PROBLEM CODE")
exit(2)
ptr=pprob.ptr
- print "ptr=%#d" % (ptr)
+ print("ptr=%#d" % (ptr))
if ptr != 50:
- print "WRONG PARAMETER PROBLEM POINTER"
+ print("WRONG PARAMETER PROBLEM POINTER")
exit(2)
exit(0)
-print "NO ICMP6 PARAMETER PROBLEM"
+print("NO ICMP6 PARAMETER PROBLEM")
exit(1)
diff --git a/regress/sys/netinet6/rh0/rh0_none.py b/regress/sys/netinet6/rh0/rh0_none.py
index b285b2e2482..3596d25eca5 100644
--- a/regress/sys/netinet6/rh0/rh0_none.py
+++ b/regress/sys/netinet6/rh0/rh0_none.py
@@ -1,15 +1,15 @@
-#!/usr/local/bin/python2.7
+#!/usr/local/bin/python3
# send a ping6 packet without routing header type 0
# we expect an echo reply, as there is no routing header
-print "send ping6 packet without routing header type 0"
+print("send ping6 packet without routing header type 0")
import os
from addr import *
from scapy.all import *
eid=os.getpid() & 0xffff
-payload="ABCDEFGHIJKLMNOP"
+payload=b"ABCDEFGHIJKLMNOP"
packet=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/\
ICMPv6EchoRequest(id=eid, data=payload)
eth=Ether(src=LOCAL_MAC, dst=REMOTE_MAC)/packet
@@ -27,15 +27,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)
diff --git a/regress/sys/netinet6/rh0/rh0_route.py b/regress/sys/netinet6/rh0/rh0_route.py
index bce287ede16..f8ea44086e7 100644
--- a/regress/sys/netinet6/rh0/rh0_route.py
+++ b/regress/sys/netinet6/rh0/rh0_route.py
@@ -1,16 +1,16 @@
-#!/usr/local/bin/python2.7
+#!/usr/local/bin/python3
# send a ping6 packet with routing header type 0
# try to source route
# we expect an ICMP6 error, as we do not support source routing
-print "send ping6 packet with routing header type 0 to be source routed"
+print("send ping6 packet with routing header type 0 to be source routed")
import os
from addr import *
from scapy.all import *
eid=os.getpid() & 0xffff
-payload="ABCDEFGHIJKLMNOP"
+payload=b"ABCDEFGHIJKLMNOP"
packet=IPv6(src=LOCAL_ADDR6, dst=REMOTE_ADDR6)/\
IPv6ExtHdrRouting(addresses=[OTHER_FAKE1_ADDR6, OTHER_FAKE2_ADDR6], \
segleft=2)/\
@@ -30,15 +30,15 @@ for a in ans:
icmp6types[a.payload.payload.type] == 'Parameter problem':
pprob=a.payload.payload
code=pprob.code
- print "code=%#d" % (code)
+ print("code=%#d" % (code))
if code != 0:
- print "WRONG PARAMETER PROBLEM CODE"
+ print("WRONG PARAMETER PROBLEM CODE")
exit(2)
ptr=pprob.ptr
- print "ptr=%#d" % (ptr)
+ print("ptr=%#d" % (ptr))
if ptr != 42:
- print "WRONG PARAMETER PROBLEM POINTER"
+ print("WRONG PARAMETER PROBLEM POINTER")
exit(2)
exit(0)
-print "NO ICMP6 PARAMETER PROBLEM"
+print("NO ICMP6 PARAMETER PROBLEM")
exit(1)