diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2020-12-25 16:17:01 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2020-12-25 16:17:01 +0000 |
commit | 21c4f7e02b0e96c54a95f591e055e3f6aeab6ee8 (patch) | |
tree | 966531cb5fa87dacdb45eb3385ef0f4e396940c8 /regress/sys/netinet | |
parent | 62a156a1cd032e0b6e67f935a40a319bf73c803a (diff) |
Switch to scapy with python 3.
Diffstat (limited to 'regress/sys/netinet')
-rw-r--r-- | regress/sys/netinet/arp/LICENSE | 26 | ||||
-rw-r--r-- | regress/sys/netinet/arp/Makefile | 13 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_announcement.py | 24 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_broadcast.py | 6 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_fake.py | 6 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_gratuitous.py | 6 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_multicast.py | 24 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_nonproxy.py | 6 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_other.py | 6 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_otherfake.py | 6 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_otherproxy.py | 6 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_probe.py | 24 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_proxy.py | 24 | ||||
-rw-r--r-- | regress/sys/netinet/arp/arp_request.py | 24 |
14 files changed, 100 insertions, 101 deletions
diff --git a/regress/sys/netinet/arp/LICENSE b/regress/sys/netinet/arp/LICENSE index e51b04edb72..700749014a9 100644 --- a/regress/sys/netinet/arp/LICENSE +++ b/regress/sys/netinet/arp/LICENSE @@ -1,13 +1,13 @@ -# Copyright (c) 2015 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) 2015-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/netinet/arp/Makefile b/regress/sys/netinet/arp/Makefile index 4360b7e7229..89d03797d2e 100644 --- a/regress/sys/netinet/arp/Makefile +++ b/regress/sys/netinet/arp/Makefile @@ -1,13 +1,12 @@ -# $OpenBSD: Makefile,v 1.13 2020/12/17 00:51:13 bluhm Exp $ +# $OpenBSD: Makefile,v 1.14 2020/12/25 16:17:00 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) regress: - @echo install python and the scapy module for additional tests + @echo Install py3-scapy package to run this regress. @echo SKIPPED .endif @@ -51,9 +50,9 @@ regress: .if ! empty (REMOTE_SSH) .if make (regress) || make (all) .BEGIN: - @echo ${SUDO} true ssh -t ${REMOTE_SSH} ${SUDO} true + @echo .endif .endif @@ -72,9 +71,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 # Clear local and remote ARP cache. diff --git a/regress/sys/netinet/arp/arp_announcement.py b/regress/sys/netinet/arp/arp_announcement.py index 004bc134771..06c780ea5a6 100644 --- a/regress/sys/netinet/arp/arp_announcement.py +++ b/regress/sys/netinet/arp/arp_announcement.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Announcement # expect Address Resolution Protocol response and check all fields # RFC 5227 IPv4 Address Conflict Detection @@ -17,35 +17,35 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload if a.hwtype != ARPHDR_ETHER: - print "HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype) + print("HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype)) exit(1) if a.ptype != ETH_P_IP: - print "PTYPE=%#0.4x != ETH_P_IP" % (a.ptype) + print("PTYPE=%#0.4x != ETH_P_IP" % (a.ptype)) exit(1) if a.hwlen != 6: - print "HWLEN=%d != 6" % (a.hwlen) + print("HWLEN=%d != 6" % (a.hwlen)) exit(1) if a.plen != 4: - print "PLEN=%d != 4" % (a.plen) + print("PLEN=%d != 4" % (a.plen)) exit(1) # XXX we should get a request from the defender, rfc5227 2.4 (3) if a.op != 2: - print "OP=%s != is-at" % (a.op) + print("OP=%s != is-at" % (a.op)) exit(1) if a.hwsrc != REMOTE_MAC: - print "HWLOCAL=%s != REMOTE_MAC" % (a.hwsrc) + print("HWLOCAL=%s != REMOTE_MAC" % (a.hwsrc)) exit(1) if a.psrc != REMOTE_ADDR: - print "PLOCAL=%s != REMOTE_ADDR" % (a.psrc) + print("PLOCAL=%s != REMOTE_ADDR" % (a.psrc)) exit(1) if a.hwdst != LOCAL_MAC: - print "HWREMOTE=%s != LOCAL_MAC" % (a.hwdst) + print("HWREMOTE=%s != LOCAL_MAC" % (a.hwdst)) exit(1) if a.pdst != REMOTE_ADDR: - print "PREMOTE=%s != REMOTE_ADDR" % (a.pdst) + print("PREMOTE=%s != REMOTE_ADDR" % (a.pdst)) exit(1) - print "arp reply" + print("arp reply") exit(0) -print "NO ARP REPLY" +print("NO ARP REPLY") exit(2) diff --git a/regress/sys/netinet/arp/arp_broadcast.py b/regress/sys/netinet/arp/arp_broadcast.py index 14b3c4f3b94..fb1c4a86f76 100644 --- a/regress/sys/netinet/arp/arp_broadcast.py +++ b/regress/sys/netinet/arp/arp_broadcast.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request to Ethernet broadcast address # expect no answer @@ -15,8 +15,8 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload a.show() - print "ARP REPLY" + print("ARP REPLY") exit(1) -print "no arp reply" +print("no arp reply") exit(0) diff --git a/regress/sys/netinet/arp/arp_fake.py b/regress/sys/netinet/arp/arp_fake.py index 40b41de1aa3..c7db319b395 100644 --- a/regress/sys/netinet/arp/arp_fake.py +++ b/regress/sys/netinet/arp/arp_fake.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request to modify fake address # expect no answer @@ -15,8 +15,8 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload a.show() - print "ARP REPLY" + print("ARP REPLY") exit(1) -print "no arp reply" +print("no arp reply") exit(0) diff --git a/regress/sys/netinet/arp/arp_gratuitous.py b/regress/sys/netinet/arp/arp_gratuitous.py index 4cf7976c74a..54afb972d6f 100644 --- a/regress/sys/netinet/arp/arp_gratuitous.py +++ b/regress/sys/netinet/arp/arp_gratuitous.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Gratuitous Address Resolution Protocol Reply # expect no answer # RFC 2002 IP Mobility Support @@ -17,8 +17,8 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload a.show() - print "ARP REPLY" + print("ARP REPLY") exit(1) -print "no arp reply" +print("no arp reply") exit(0) diff --git a/regress/sys/netinet/arp/arp_multicast.py b/regress/sys/netinet/arp/arp_multicast.py index 57643f1a8a5..1ca4e802575 100644 --- a/regress/sys/netinet/arp/arp_multicast.py +++ b/regress/sys/netinet/arp/arp_multicast.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request with ethernet multicast sender # expect Address Resolution Protocol response and check all fields # RFC 826 An Ethernet Address Resolution Protocol @@ -17,34 +17,34 @@ e=srp1(eth, iface=LOCAL_IF, promisc=1, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload if a.hwtype != ARPHDR_ETHER: - print "HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype) + print("HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype)) exit(1) if a.ptype != ETH_P_IP: - print "PTYPE=%#0.4x != ETH_P_IP" % (a.ptype) + print("PTYPE=%#0.4x != ETH_P_IP" % (a.ptype)) exit(1) if a.hwlen != 6: - print "HWLEN=%d != 6" % (a.hwlen) + print("HWLEN=%d != 6" % (a.hwlen)) exit(1) if a.plen != 4: - print "PLEN=%d != 4" % (a.plen) + print("PLEN=%d != 4" % (a.plen)) exit(1) if a.op != 2: - print "OP=%s != is-at" % (a.op) + print("OP=%s != is-at" % (a.op)) exit(1) if a.hwsrc != REMOTE_MAC: - print "HWLOCAL=%s != REMOTE_MAC" % (a.hwsrc) + print("HWLOCAL=%s != REMOTE_MAC" % (a.hwsrc)) exit(1) if a.psrc != REMOTE_ADDR: - print "PLOCAL=%s != REMOTE_ADDR" % (a.psrc) + print("PLOCAL=%s != REMOTE_ADDR" % (a.psrc)) exit(1) if a.hwdst != "33:33:33:33:33:33": - print "HWREMOTE=%s != 33:33:33:33:33:33" % (a.hwdst) + print("HWREMOTE=%s != 33:33:33:33:33:33" % (a.hwdst)) exit(1) if a.pdst != LOCAL_ADDR: - print "PREMOTE=%s != LOCAL_ADDR" % (a.pdst) + print("PREMOTE=%s != LOCAL_ADDR" % (a.pdst)) exit(1) - print "arp reply" + print("arp reply") exit(0) -print "NO ARP REPLY" +print("NO ARP REPLY") exit(2) diff --git a/regress/sys/netinet/arp/arp_nonproxy.py b/regress/sys/netinet/arp/arp_nonproxy.py index 0e319f9e022..2f1a9e685ff 100644 --- a/regress/sys/netinet/arp/arp_nonproxy.py +++ b/regress/sys/netinet/arp/arp_nonproxy.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request for Proxy ARP not published # expect no answer @@ -15,8 +15,8 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload a.show() - print "ARP REPLY" + print("ARP REPLY") exit(1) -print "no arp reply" +print("no arp reply") exit(0) diff --git a/regress/sys/netinet/arp/arp_other.py b/regress/sys/netinet/arp/arp_other.py index 0cdb6cffc46..ca2b085c61a 100644 --- a/regress/sys/netinet/arp/arp_other.py +++ b/regress/sys/netinet/arp/arp_other.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request to modify other address # expect no answer @@ -15,8 +15,8 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload a.show() - print "ARP REPLY" + print("ARP REPLY") exit(1) -print "no arp reply" +print("no arp reply") exit(0) diff --git a/regress/sys/netinet/arp/arp_otherfake.py b/regress/sys/netinet/arp/arp_otherfake.py index de299b1caca..ca018bbc8c7 100644 --- a/regress/sys/netinet/arp/arp_otherfake.py +++ b/regress/sys/netinet/arp/arp_otherfake.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request to modify other fake address # expect no answer @@ -15,8 +15,8 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload a.show() - print "ARP REPLY" + print("ARP REPLY") exit(1) -print "no arp reply" +print("no arp reply") exit(0) diff --git a/regress/sys/netinet/arp/arp_otherproxy.py b/regress/sys/netinet/arp/arp_otherproxy.py index 0d43f3212bb..13725147ae7 100644 --- a/regress/sys/netinet/arp/arp_otherproxy.py +++ b/regress/sys/netinet/arp/arp_otherproxy.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request for Proxy ARP on other interface # expect no answer @@ -15,8 +15,8 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload a.show() - print "ARP REPLY" + print("ARP REPLY") exit(1) -print "no arp reply" +print("no arp reply") exit(0) diff --git a/regress/sys/netinet/arp/arp_probe.py b/regress/sys/netinet/arp/arp_probe.py index 09b505d7464..80ab053edb5 100644 --- a/regress/sys/netinet/arp/arp_probe.py +++ b/regress/sys/netinet/arp/arp_probe.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Probe # expect Address Resolution Protocol response and check all fields # RFC 5227 IPv4 Address Conflict Detection @@ -18,34 +18,34 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload if a.hwtype != ARPHDR_ETHER: - print "HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype) + print("HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype)) exit(1) if a.ptype != ETH_P_IP: - print "PTYPE=%#0.4x != ETH_P_IP" % (a.ptype) + print("PTYPE=%#0.4x != ETH_P_IP" % (a.ptype)) exit(1) if a.hwlen != 6: - print "HWLEN=%d != 6" % (a.hwlen) + print("HWLEN=%d != 6" % (a.hwlen)) exit(1) if a.plen != 4: - print "PLEN=%d != 4" % (a.plen) + print("PLEN=%d != 4" % (a.plen)) exit(1) if a.op != 2: - print "OP=%s != is-at" % (a.op) + print("OP=%s != is-at" % (a.op)) exit(1) if a.hwsrc != REMOTE_MAC: - print "HWLOCAL=%s != REMOTE_MAC" % (a.hwsrc) + print("HWLOCAL=%s != REMOTE_MAC" % (a.hwsrc)) exit(1) if a.psrc != REMOTE_ADDR: - print "PLOCAL=%s != REMOTE_ADDR" % (a.psrc) + print("PLOCAL=%s != REMOTE_ADDR" % (a.psrc)) exit(1) if a.hwdst != LOCAL_MAC: - print "HWREMOTE=%s != LOCAL_MAC" % (a.hwdst) + print("HWREMOTE=%s != LOCAL_MAC" % (a.hwdst)) exit(1) if a.pdst != "0.0.0.0": - print "PREMOTE=%s != 0.0.0.0" % (a.pdst) + print("PREMOTE=%s != 0.0.0.0" % (a.pdst)) exit(1) - print "arp reply" + print("arp reply") exit(0) -print "NO ARP REPLY" +print("NO ARP REPLY") exit(2) diff --git a/regress/sys/netinet/arp/arp_proxy.py b/regress/sys/netinet/arp/arp_proxy.py index e6762c016f8..f90bc4057a2 100644 --- a/regress/sys/netinet/arp/arp_proxy.py +++ b/regress/sys/netinet/arp/arp_proxy.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request for Proxy ARP # expect Address Resolution Protocol fake response and check all fields @@ -15,34 +15,34 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload if a.hwtype != ARPHDR_ETHER: - print "HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype) + print("HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype)) exit(1) if a.ptype != ETH_P_IP: - print "PTYPE=%#0.4x != ETH_P_IP" % (a.ptype) + print("PTYPE=%#0.4x != ETH_P_IP" % (a.ptype)) exit(1) if a.hwlen != 6: - print "HWLEN=%d != 6" % (a.hwlen) + print("HWLEN=%d != 6" % (a.hwlen)) exit(1) if a.plen != 4: - print "PLEN=%d != 4" % (a.plen) + print("PLEN=%d != 4" % (a.plen)) exit(1) if a.op != 2: - print "OP=%s != is-at" % (a.op) + print("OP=%s != is-at" % (a.op)) exit(1) if a.hwsrc != FAKE_MAC: - print "HWLOCAL=%s != FAKE_MAC" % (a.hwsrc) + print("HWLOCAL=%s != FAKE_MAC" % (a.hwsrc)) exit(1) if a.psrc != FAKE_ADDR: - print "PLOCAL=%s != FAKE_ADDR" % (a.psrc) + print("PLOCAL=%s != FAKE_ADDR" % (a.psrc)) exit(1) if a.hwdst != LOCAL_MAC: - print "HWREMOTE=%s != LOCAL_MAC" % (a.hwdst) + print("HWREMOTE=%s != LOCAL_MAC" % (a.hwdst)) exit(1) if a.pdst != LOCAL_ADDR: - print "PREMOTE=%s != LOCAL_ADDR" % (a.pdst) + print("PREMOTE=%s != LOCAL_ADDR" % (a.pdst)) exit(1) - print "arp reply" + print("arp reply") exit(0) -print "NO ARP REPLY" +print("NO ARP REPLY") exit(2) diff --git a/regress/sys/netinet/arp/arp_request.py b/regress/sys/netinet/arp/arp_request.py index d974c6330c2..327d8dcdfd0 100644 --- a/regress/sys/netinet/arp/arp_request.py +++ b/regress/sys/netinet/arp/arp_request.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # send Address Resolution Protocol Request # expect Address Resolution Protocol response and check all fields # RFC 826 An Ethernet Address Resolution Protocol @@ -17,34 +17,34 @@ e=srp1(eth, iface=LOCAL_IF, timeout=2) if e and e.type == ETH_P_ARP: a=e.payload if a.hwtype != ARPHDR_ETHER: - print "HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype) + print("HWTYPE=%#0.4x != ARPHDR_ETHER" % (a.hwtype)) exit(1) if a.ptype != ETH_P_IP: - print "PTYPE=%#0.4x != ETH_P_IP" % (a.ptype) + print("PTYPE=%#0.4x != ETH_P_IP" % (a.ptype)) exit(1) if a.hwlen != 6: - print "HWLEN=%d != 6" % (a.hwlen) + print("HWLEN=%d != 6" % (a.hwlen)) exit(1) if a.plen != 4: - print "PLEN=%d != 4" % (a.plen) + print("PLEN=%d != 4" % (a.plen)) exit(1) if a.op != 2: - print "OP=%s != is-at" % (a.op) + print("OP=%s != is-at" % (a.op)) exit(1) if a.hwsrc != REMOTE_MAC: - print "HWLOCAL=%s != REMOTE_MAC" % (a.hwsrc) + print("HWLOCAL=%s != REMOTE_MAC" % (a.hwsrc)) exit(1) if a.psrc != REMOTE_ADDR: - print "PLOCAL=%s != REMOTE_ADDR" % (a.psrc) + print("PLOCAL=%s != REMOTE_ADDR" % (a.psrc)) exit(1) if a.hwdst != LOCAL_MAC: - print "HWREMOTE=%s != LOCAL_MAC" % (a.hwdst) + print("HWREMOTE=%s != LOCAL_MAC" % (a.hwdst)) exit(1) if a.pdst != LOCAL_ADDR: - print "PREMOTE=%s != LOCAL_ADDR" % (a.pdst) + print("PREMOTE=%s != LOCAL_ADDR" % (a.pdst)) exit(1) - print "arp reply" + print("arp reply") exit(0) -print "NO ARP REPLY" +print("NO ARP REPLY") exit(2) |