From 3a262c66595690871b58e0429110a6ce96525932 Mon Sep 17 00:00:00 2001 From: bluhm Date: Fri, 29 Apr 2022 17:27:37 +0000 Subject: [PATCH] Cleanup makefile so that tests are similar. Link pair to build. --- regress/sys/net/Makefile | 4 +- regress/sys/net/gif/Makefile | 71 +++++++++++++++----------- regress/sys/net/loop/Makefile | 40 ++++++++++----- regress/sys/net/pair/Makefile | 74 ++++++++++++++------------- regress/sys/net/pf_opts/Makefile | 88 +++++++++++++++++--------------- regress/sys/net/pflog/Makefile | 51 +++++++++++------- regress/sys/net/pflow/Makefile | 4 +- regress/sys/net/vxlan/Makefile | 8 +-- 8 files changed, 195 insertions(+), 145 deletions(-) diff --git a/regress/sys/net/Makefile b/regress/sys/net/Makefile index bda4ec8f22a..7680f3f3bf5 100644 --- a/regress/sys/net/Makefile +++ b/regress/sys/net/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.17 2022/04/29 11:59:10 bluhm Exp $ +# $OpenBSD: Makefile,v 1.18 2022/04/29 17:27:37 bluhm Exp $ SUBDIR += etherip gif loop SUBDIR += pf_divert pf_forward pf_fragment pf_opts pf_print pf_state SUBDIR += pf_table -SUBDIR += pflog pflow rdomains rtable vxlan wg +SUBDIR += pair pflog pflow rdomains rtable vxlan wg .include diff --git a/regress/sys/net/gif/Makefile b/regress/sys/net/gif/Makefile index 15618c5879e..1d02c8df8a4 100644 --- a/regress/sys/net/gif/Makefile +++ b/regress/sys/net/gif/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2021/07/06 11:26:47 bluhm Exp $ +# $OpenBSD: Makefile,v 1.7 2022/04/29 17:27:37 bluhm Exp $ # Copyright (c) 2018-2020 Alexander Bluhm # @@ -61,14 +61,14 @@ regress: @echo SKIPPED .endif -PF_STATUS != ${SUDO} pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' +PF_STATUS != ${SUDO} /sbin/pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' .if empty(PF_STATUS:MEnabled) regress: @echo pf status: "${PF_STATUS}" @echo Enable pf to run this regress. @echo SKIPPED .endif -PF_SKIP != ${SUDO} pfctl -sI -v | sed -n 's/ (skip)//p' +PF_SKIP != ${SUDO} /sbin/pfctl -sI -v | sed -n 's/ (skip)//p' .if ! empty(PF_SKIP:Mlo*:Nlo0) regress: @echo pf skip: "${PF_SKIP}" @@ -76,7 +76,8 @@ regress: @echo SKIPPED .endif -PF_ANCHOR != ${SUDO} pfctl -sr | sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' +PF_ANCHOR != ${SUDO} /sbin/pfctl -sr |\ + sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' .if empty(PF_ANCHOR:Mregress) regress: @echo pf anchor: "${PF_ANCHOR}" @@ -100,41 +101,53 @@ REGRESS_SETUP_ONCE += ifconfig ifconfig: unconfig # Create and configure loopback interfaces. .for n in ${NUMS} - ${SUDO} ifconfig lo$n rdomain $n - ${SUDO} ifconfig lo$n inet 127.0.0.1/8 - ${SUDO} ifconfig lo$n inet6 ::1/128 - ${SUDO} ifconfig lo$n inet ${SRC_TUNNEL4_$n} alias - ${SUDO} ifconfig lo$n inet6 ${SRC_TUNNEL6_$n} alias - ${SUDO} route -n -T $n add -inet -host ${DST_TUNNEL4_$n} 127.0.0.1 - ${SUDO} route -n -T $n add -inet6 -host ${DST_TUNNEL6_$n} ::1 - ${SUDO} ifconfig gif$n4 create rdomain $n tunneldomain $n - ${SUDO} ifconfig gif$n4 tunnel ${SRC_TUNNEL4_$n} ${DST_TUNNEL4_$n} - ${SUDO} ifconfig gif$n4 inet ${TUNNEL4_SRC_ADDR4_$n}/32\ + ${SUDO} /sbin/ifconfig lo$n rdomain $n + ${SUDO} /sbin/ifconfig lo$n inet 127.0.0.1/8 + ${SUDO} /sbin/ifconfig lo$n inet6 ::1/128 + ${SUDO} /sbin/ifconfig lo$n inet ${SRC_TUNNEL4_$n} alias + ${SUDO} /sbin/ifconfig lo$n inet6 ${SRC_TUNNEL6_$n} alias + ${SUDO} /sbin/route -n -T $n add -inet -host ${DST_TUNNEL4_$n} 127.0.0.1 + ${SUDO} /sbin/route -n -T $n add -inet6 -host ${DST_TUNNEL6_$n} ::1 + ${SUDO} /sbin/ifconfig gif$n4 create rdomain $n tunneldomain $n + ${SUDO} /sbin/ifconfig gif$n4 tunnel ${SRC_TUNNEL4_$n} ${DST_TUNNEL4_$n} + ${SUDO} /sbin/ifconfig gif$n4 inet ${TUNNEL4_SRC_ADDR4_$n}/32\ ${TUNNEL4_DST_ADDR4_$n} - ${SUDO} ifconfig gif$n4 inet6 ${TUNNEL4_SRC_ADDR6_$n}\ + ${SUDO} /sbin/ifconfig gif$n4 inet6 ${TUNNEL4_SRC_ADDR6_$n}\ ${TUNNEL4_DST_ADDR6_$n} - ${SUDO} ifconfig gif$n6 create rdomain $n tunneldomain $n - ${SUDO} ifconfig gif$n6 tunnel ${SRC_TUNNEL6_$n}\ + ${SUDO} /sbin/ifconfig gif$n6 create rdomain $n tunneldomain $n + ${SUDO} /sbin/ifconfig gif$n6 tunnel ${SRC_TUNNEL6_$n}\ ${DST_TUNNEL6_$n} - ${SUDO} ifconfig gif$n6 inet ${TUNNEL6_SRC_ADDR4_$n}/32\ + ${SUDO} /sbin/ifconfig gif$n6 inet ${TUNNEL6_SRC_ADDR4_$n}/32\ ${TUNNEL6_DST_ADDR4_$n} - ${SUDO} ifconfig gif$n6 inet6 ${TUNNEL6_SRC_ADDR6_$n}\ + ${SUDO} /sbin/ifconfig gif$n6 inet6 ${TUNNEL6_SRC_ADDR6_$n}\ ${TUNNEL6_DST_ADDR6_$n} .endfor - # Wait until DAD for inet6 tunnel addresses has finished. - sleep 1 + # Wait until IPv6 addresses are no longer tentative. + for i in `jot 50`; do\ + if ! { /sbin/ifconfig lo${N1}; /sbin/ifconfig lo${N2};\ + /sbin/ifconfig gif${N1}4; /sbin/ifconfig gif${N1}6;\ + /sbin/ifconfig gif${N2}4; /sbin/ifconfig gif${N2}6; }\ + | fgrep -q tentative; then\ + break;\ + fi;\ + sleep .1;\ + done + ! { /sbin/ifconfig lo${N1}; /sbin/ifconfig lo${N2};\ + /sbin/ifconfig gif${N1}4; /sbin/ifconfig gif${N1}6;\ + /sbin/ifconfig gif${N2}4; /sbin/ifconfig gif${N2}6; }\ + | fgrep -q tentative REGRESS_CLEANUP += unconfig unconfig: # Destroy interfaces, keep lo as routing domain cannot be destroyed. .for n in ${NUMS} - -${SUDO} ifconfig lo$n rdomain $n - -${SUDO} ifconfig lo$n inet 127.0.0.1 delete - -${SUDO} ifconfig lo$n inet6 ::1 delete - -${SUDO} ifconfig lo$n inet ${SRC_TUNNEL4_$n} delete - -${SUDO} ifconfig lo$n inet6 ${SRC_TUNNEL6_$n} delete - -${SUDO} ifconfig gif$n4 destroy - -${SUDO} ifconfig gif$n6 destroy + -${SUDO} /sbin/ifconfig lo$n rdomain $n + -${SUDO} /sbin/ifconfig lo$n inet 127.0.0.1 delete + -${SUDO} /sbin/ifconfig lo$n inet6 ::1 delete + -${SUDO} /sbin/ifconfig lo$n inet ${SRC_TUNNEL4_$n} delete + -${SUDO} /sbin/ifconfig lo$n inet6 ${SRC_TUNNEL6_$n} delete + -${SUDO} /sbin/ifconfig gif$n4 destroy + -${SUDO} /sbin/ifconfig gif$n6 destroy .endfor rm -f stamp-ifconfig @@ -153,7 +166,7 @@ REGRESS_SETUP_ONCE += pfctl pfctl: addr.py pf.conf # Load the pf rules into the kernel. cat addr.py ${.CURDIR}/pf.conf | /sbin/pfctl -n -f - - cat addr.py ${.CURDIR}/pf.conf | ${SUDO} pfctl -a regress -f - + cat addr.py ${.CURDIR}/pf.conf | ${SUDO} /sbin/pfctl -a regress -f - # ifconfig gif inet6 DAD created tunnel states based on old pf rules ${SUDO} /sbin/pfctl -Fs diff --git a/regress/sys/net/loop/Makefile b/regress/sys/net/loop/Makefile index e347aeb4f7b..1b5e903a6f3 100644 --- a/regress/sys/net/loop/Makefile +++ b/regress/sys/net/loop/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2021/07/06 11:26:47 bluhm Exp $ +# $OpenBSD: Makefile,v 1.9 2022/04/29 17:27:37 bluhm Exp $ # Copyright (c) 2017-2020 Alexander Bluhm # @@ -37,7 +37,7 @@ regress: @echo SKIPPED .endif -PF_STATUS != ${SUDO} pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' +PF_STATUS != ${SUDO} /sbin/pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' .if empty(PF_STATUS:MEnabled) regress: @echo pf status: "${PF_STATUS}" @@ -45,7 +45,7 @@ regress: @echo SKIPPED .endif -PF_SKIP != ${SUDO} pfctl -sI -v | sed -n 's/ (skip)//p' +PF_SKIP != ${SUDO} /sbin/pfctl -sI -v | sed -n 's/ (skip)//p' .if ! empty(PF_SKIP:Mlo*:Nlo0) regress: @echo pf skip: "${PF_SKIP}" @@ -53,7 +53,8 @@ regress: @echo SKIPPED .endif -PF_ANCHOR != ${SUDO} pfctl -sr | sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' +PF_ANCHOR != ${SUDO} /sbin/pfctl -sr |\ + sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' .if empty(PF_ANCHOR:Mregress) regress: @echo pf anchor: "${PF_ANCHOR}" @@ -77,21 +78,32 @@ REGRESS_SETUP_ONCE += ifconfig ifconfig: unconfig # Create and configure loopback interfaces. .for n in ${NUMS} - ${SUDO} ifconfig lo$n rdomain $n - ${SUDO} ifconfig lo$n inet 127.0.0.1/8 - ${SUDO} ifconfig lo$n inet 127.0.0.$n alias - ${SUDO} route -n -T $n add -inet -host 10.6.6.6 127.0.0.1 - ${SUDO} route -n -T $n add -inet -host 10.7.7.7 127.0.0.1 + ${SUDO} /sbin/ifconfig lo$n rdomain $n + ${SUDO} /sbin/ifconfig lo$n inet 127.0.0.1/8 + ${SUDO} /sbin/ifconfig lo$n inet 127.0.0.$n alias + ${SUDO} /sbin/route -n -T $n add -inet -host 10.6.6.6 127.0.0.1 + ${SUDO} /sbin/route -n -T $n add -inet -host 10.7.7.7 127.0.0.1 .endfor - ${SUDO} route -n -T ${N1} add -inet -host 127.0.0.${N2} 127.0.0.1 - ${SUDO} route -n -T ${N2} add -inet -host 127.0.0.${N1} 127.0.0.1 + ${SUDO} /sbin/route -n -T ${N1} add -inet -host 127.0.0.${N2} 127.0.0.1 + ${SUDO} /sbin/route -n -T ${N2} add -inet -host 127.0.0.${N1} 127.0.0.1 + # Wait until IPv6 addresses are no longer tentative. + for i in `jot 50`; do\ + if ! { /sbin/ifconfig lo${N1}; /sbin/ifconfig lo${N2}; }\ + | fgrep -q tentative; then\ + break;\ + fi;\ + sleep .1;\ + done + ! { /sbin/ifconfig lo${N1}; /sbin/ifconfig lo${N2}; }\ + | fgrep tentative REGRESS_CLEANUP += unconfig unconfig: stamp-stop # Destroy interfaces. .for n in ${NUMS} - -${SUDO} ifconfig lo$n 127.0.0.1 delete - -${SUDO} ifconfig lo$n 127.0.0.$n delete + -${SUDO} /sbin/ifconfig lo$n rdomain $n + -${SUDO} /sbin/ifconfig lo$n inet 127.0.0.1 delete + -${SUDO} /sbin/ifconfig lo$n inet 127.0.0.$n delete .endfor rm -f stamp-ifconfig @@ -109,7 +121,7 @@ REGRESS_SETUP_ONCE += pfctl pfctl: addr.py pf.conf # Load the pf rules into the kernel. cat addr.py ${.CURDIR}/pf.conf | /sbin/pfctl -n -f - - cat addr.py ${.CURDIR}/pf.conf | ${SUDO} pfctl -a regress -f - + cat addr.py ${.CURDIR}/pf.conf | ${SUDO} /sbin/pfctl -a regress -f - # run tcpdump on lo devices DUMPCMD = /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni diff --git a/regress/sys/net/pair/Makefile b/regress/sys/net/pair/Makefile index 147fcb71b37..64894fc75a3 100644 --- a/regress/sys/net/pair/Makefile +++ b/regress/sys/net/pair/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2021/04/21 10:18:35 bluhm Exp $ +# $OpenBSD: Makefile,v 1.3 2022/04/29 17:27:37 bluhm Exp $ # Copyright (c) 2021 Alexander Bluhm # @@ -52,7 +52,7 @@ regress: @echo SKIPPED .endif -PF_STATUS != ${SUDO} pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' +PF_STATUS != ${SUDO} /sbin/pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' .if empty(PF_STATUS:MEnabled) regress: @echo pf status: "${PF_STATUS}" @@ -60,7 +60,7 @@ regress: @echo SKIPPED .endif -PF_SKIP != ${SUDO} pfctl -sI -v | sed -n 's/ (skip)//p' +PF_SKIP != ${SUDO} /sbin/pfctl -sI -v | sed -n 's/ (skip)//p' .if ! empty(PF_SKIP:Mlo*:Nlo0) regress: @echo pf skip: "${PF_SKIP}" @@ -68,7 +68,8 @@ regress: @echo SKIPPED .endif -PF_ANCHOR != ${SUDO} pfctl -sr | sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' +PF_ANCHOR != ${SUDO} /sbin/pfctl -sr |\ + sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' .if empty(PF_ANCHOR:Mregress) regress: @echo pf anchor: "${PF_ANCHOR}" @@ -84,49 +85,50 @@ REGRESS_SETUP_ONCE += ifconfig ifconfig: unconfig # Create and configure pflog and loopback interfaces. .for n in ${NUMS} - ${SUDO} ifconfig lo$n rdomain $n - ${SUDO} ifconfig lo$n inet 127.0.0.1/8 - ${SUDO} ifconfig lo$n inet6 ::1/128 - ${SUDO} route -n -T $n add -inet 169.254.0.0/16 127.0.0.1 - ${SUDO} route -n -T $n add -inet6 fc00::/48 ::1 + ${SUDO} /sbin/ifconfig lo$n rdomain $n + ${SUDO} /sbin/ifconfig lo$n inet 127.0.0.1/8 + ${SUDO} /sbin/ifconfig lo$n inet6 ::1/128 + ${SUDO} /sbin/route -n -T $n add -inet 169.254.0.0/16 127.0.0.1 + ${SUDO} /sbin/route -n -T $n add -inet6 fc00::/48 ::1 .endfor .for n in ${PAIRS} - ${SUDO} ifconfig pair$n rdomain $n - ${SUDO} ifconfig pair$n inet ${IP_$n}/24 - ${SUDO} ifconfig pair$n inet6 ${IP6_$n}/64 + ${SUDO} /sbin/ifconfig pair$n rdomain $n + ${SUDO} /sbin/ifconfig pair$n inet ${IP_$n}/24 + ${SUDO} /sbin/ifconfig pair$n inet6 ${IP6_$n}/64 .endfor - ${SUDO} ifconfig pair${N1} patch pair${N2} - ${SUDO} ifconfig lo${N3} inet ${IP_${N3}}/24 alias - ${SUDO} ifconfig lo${N3} inet6 ${IP6_${N3}}/64 - ${SUDO} ifconfig pair${N1} mtu 8000 - ${SUDO} route -n -T ${N1} add -inet ${IP_${N3}} ${IP_${N2}} - ${SUDO} route -n -T ${N1} add -inet6 ${IP6_${N3}} ${IP6_${N2}} + ${SUDO} /sbin/ifconfig pair${N1} patch pair${N2} + ${SUDO} /sbin/ifconfig lo${N3} inet ${IP_${N3}}/24 alias + ${SUDO} /sbin/ifconfig lo${N3} inet6 ${IP6_${N3}}/64 + ${SUDO} /sbin/ifconfig pair${N1} mtu 8000 + ${SUDO} /sbin/route -n -T ${N1} add -inet ${IP_${N3}} ${IP_${N2}} + ${SUDO} /sbin/route -n -T ${N1} add -inet6 ${IP6_${N3}} ${IP6_${N2}} # Wait until IPv6 addresses are no longer tentative. for i in `jot 50`; do\ - if ! { ifconfig pair${N1}; ifconfig pair${N2}; ifconfig lo${N3}; }\ - | fgrep -q tentative; then\ + if ! { /sbin/ifconfig pair${N1}; /sbin/ifconfig pair${N2};\ + /sbin/ifconfig lo${N3}; } | fgrep -q tentative; then\ break;\ fi;\ sleep .1;\ done - ! { ifconfig pair${N1}; ifconfig pair${N2}; ifconfig lo${N3};}\ - | fgrep tentative + ! { /sbin/ifconfig pair${N1}; /sbin/ifconfig pair${N2};\ + /sbin/ifconfig lo${N3}; } | fgrep tentative REGRESS_CLEANUP += unconfig unconfig: # Destroy interfaces. - -${SUDO} route -n -T ${N1} delete -inet ${IP_${N3}} - -${SUDO} route -n -T ${N1} delete -inet6 ${IP6_${N3}} - -${SUDO} ifconfig lo${N3} inet ${IP_${N3}} delete - -${SUDO} ifconfig lo${N3} inet6 ${IP6_${N3}} delete + -${SUDO} /sbin/route -n -T ${N1} delete -inet ${IP_${N3}} + -${SUDO} /sbin/route -n -T ${N1} delete -inet6 ${IP6_${N3}} + -${SUDO} /sbin/ifconfig lo${N3} rdomain ${N3} + -${SUDO} /sbin/ifconfig lo${N3} inet ${IP_${N3}} delete + -${SUDO} /sbin/ifconfig lo${N3} inet6 ${IP6_${N3}} delete .for n in ${PAIRS} - -${SUDO} ifconfig pair$n destroy + -${SUDO} /sbin/ifconfig pair$n destroy .endfor .for n in ${NUMS} - -${SUDO} route -n -T $n delete -inet 169.254.0.0/16 - -${SUDO} route -n -T $n delete -inet6 fc00::/48 - -${SUDO} ifconfig lo$n inet 127.0.0.1 delete - -${SUDO} ifconfig lo$n inet6 ::1 delete + -${SUDO} /sbin/route -n -T $n delete -inet 169.254.0.0/16 + -${SUDO} /sbin/route -n -T $n delete -inet6 fc00::/48 + -${SUDO} /sbin/ifconfig lo$n inet 127.0.0.1 delete + -${SUDO} /sbin/ifconfig lo$n inet6 ::1 delete .endfor rm -f stamp-ifconfig @@ -146,17 +148,17 @@ REGRESS_SETUP_ONCE += pfctl pfctl: addr.py pf.conf # Load the pf rules into the kernel. cat addr.py ${.CURDIR}/pf.conf | /sbin/pfctl -n -f - - cat addr.py ${.CURDIR}/pf.conf | ${SUDO} pfctl -a regress -f - + cat addr.py ${.CURDIR}/pf.conf | ${SUDO} /sbin/pfctl -a regress -f - .for f in 1 2 3 .for t in 1 2 3 REGRESS_TARGETS += run-ping-$f-$t run-ping-$f-$t: - ping -c 1 -w 1 -n -V ${N$f} -I ${IP_${N$f}} ${IP_${N$t}} + /sbin/ping -c 1 -w 1 -n -V ${N$f} -I ${IP_${N$f}} ${IP_${N$t}} REGRESS_TARGETS += run-ping6-$f-$t run-ping6-$f-$t: - ping6 -c 1 -w 1 -n -V ${N$f} -I ${IP6_${N$f}} ${IP6_${N$t}} + /sbin/ping6 -c 1 -w 1 -n -V ${N$f} -I ${IP6_${N$f}} ${IP6_${N$t}} REGRESS_TARGETS += run-tcpbench-$f-$t run-tcpbench-$f-$t: @@ -170,7 +172,7 @@ run-tcpbench-$f-$t: tcpbench -4 -t 5 -V ${N$f} -b ${IP_${N$f}} ${IP_${N$t}} .if $f == "3" && $t == "1" # path MTU discovery must create a dynamic route - route -T ${N$f} -n get -host -inet ${IP_${N$t}} | grep DYNAMIC + /sbin/route -T ${N$f} -n get -host -inet ${IP_${N$t}} | grep DYNAMIC .endif REGRESS_TARGETS += run-tcpbench6-$f-$t @@ -185,7 +187,7 @@ run-tcpbench6-$f-$t: tcpbench -6 -t 5 -V ${N$f} -b ${IP6_${N$f}} ${IP6_${N$t}} .if $f == "3" && $t == "1" # path MTU discovery in other rtable does not work in ip6_output() - route -T ${N$f} -n get -host -inet6 ${IP6_${N$t}} + /sbin/route -T ${N$f} -n get -host -inet6 ${IP6_${N$t}} @echo DISABLED .endif diff --git a/regress/sys/net/pf_opts/Makefile b/regress/sys/net/pf_opts/Makefile index a1d870b8586..1917596dfc4 100644 --- a/regress/sys/net/pf_opts/Makefile +++ b/regress/sys/net/pf_opts/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2022/04/29 09:45:05 bluhm Exp $ +# $OpenBSD: Makefile,v 1.4 2022/04/29 17:27:37 bluhm Exp $ # Copyright (c) 2022 Alexander Bluhm # @@ -39,7 +39,7 @@ NUMS = ${N1} ${N2} .if ! (make(clean) || make(cleandir) || make(obj)) -PF_STATUS != ${SUDO} pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' +PF_STATUS != ${SUDO} /sbin/pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' .if empty(PF_STATUS:MEnabled) regress: @echo pf status: "${PF_STATUS}" @@ -47,7 +47,7 @@ regress: @echo SKIPPED .endif -PF_SKIP != ${SUDO} pfctl -sI -v | sed -n 's/ (skip)//p' +PF_SKIP != ${SUDO} /sbin/pfctl -sI -v | sed -n 's/ (skip)//p' .if ! empty(PF_SKIP:Mlo*:Nlo0) regress: @echo pf skip: "${PF_SKIP}" @@ -55,7 +55,8 @@ regress: @echo SKIPPED .endif -PF_ANCHOR != ${SUDO} pfctl -sr | sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' +PF_ANCHOR != ${SUDO} /sbin/pfctl -sr |\ + sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' .if empty(PF_ANCHOR:Mregress) regress: @echo pf anchor: "${PF_ANCHOR}" @@ -85,13 +86,22 @@ ifconfig: unconfig ${SUDO} /sbin/ifconfig lo$n inet6 ::1/128 ${SUDO} /sbin/ifconfig lo$n inet6 fe80::$n/64 .endfor - ${SUDO} /sbin/route -n -T ${N1} add -inet -host 127.0.0.${N2} 127.0.0.1 - ${SUDO} /sbin/route -n -T ${N2} add -inet -host 127.0.0.${N1} 127.0.0.1 + # Wait until IPv6 addresses are no longer tentative. + for i in `jot 50`; do\ + if ! { /sbin/ifconfig lo${N1}; /sbin/ifconfig lo${N2}; }\ + | fgrep -q tentative; then\ + break;\ + fi;\ + sleep .1;\ + done + ! { /sbin/ifconfig lo${N1}; /sbin/ifconfig lo${N2}; }\ + | fgrep tentative REGRESS_CLEANUP += unconfig unconfig: stamp-stop # Destroy interfaces. .for n in ${NUMS} + -${SUDO} /sbin/ifconfig lo$n rdomain $n -${SUDO} /sbin/ifconfig lo$n inet 127.0.0.1 delete -${SUDO} /sbin/ifconfig lo$n inet 127.0.0.$n delete -${SUDO} /sbin/ifconfig lo$n inet6 ::1 delete @@ -114,7 +124,7 @@ REGRESS_SETUP_ONCE += pfctl pfctl: addr.py pf.conf # Load the pf rules into the kernel. cat addr.py ${.CURDIR}/pf.conf | /sbin/pfctl -n -f - - cat addr.py ${.CURDIR}/pf.conf | ${SUDO} pfctl -a regress -f - + cat addr.py ${.CURDIR}/pf.conf | ${SUDO} /sbin/pfctl -a regress -f - # run tcpdump on lo and pflog device DUMPCMD = /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni @@ -144,10 +154,8 @@ stamp-stop: # Only do that if necessary to keep visible output short. .if ${.CURDIR} == ${.OBJDIR} PYTHON = python3 -u ./ -PYPATH = .else -PYTHON = python3 -u ${.CURDIR}/ -PYPATH = PYTHONPATH=${.OBJDIR} +PYTHON = env PYTHONPATH=${.OBJDIR} python3 -u ${.CURDIR}/ .endif # ping @@ -194,13 +202,13 @@ run-bpf-ping-record: stamp-stop REGRESS_TARGETS += run-icmp run-icmp: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp.py N2 REGRESS_TARGETS += run-icmp6 run-icmp6: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp6.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp6.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp6.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp6.py N2 REGRESS_TARGETS += run-bpf-icmp run-bpf-icmp: stamp-stop @@ -216,13 +224,13 @@ run-bpf-icmp: stamp-stop REGRESS_TARGETS += run-icmp6-hop run-icmp6-hop: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp6_hop.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp6_hop.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp6_hop.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp6_hop.py N2 REGRESS_TARGETS += run-icmp6-dst run-icmp6-dst: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp6_dst.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp6_dst.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp6_dst.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp6_dst.py N2 REGRESS_TARGETS += run-bpf-ext run-bpf-ext: stamp-stop @@ -235,38 +243,38 @@ run-bpf-ext: stamp-stop REGRESS_TARGETS += run-icmp-pad run-icmp-pad: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp_pad.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp_pad.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp_pad.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp_pad.py N2 REGRESS_TARGETS += run-icmp-eol run-icmp-eol: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp_eol.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp_eol.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp_eol.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp_eol.py N2 REGRESS_TARGETS += run-icmp6-pad run-icmp6-pad: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp6_hop_pad.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp6_hop_pad.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp6_hop_pad.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp6_hop_pad.py N2 REGRESS_TARGETS += run-icmp-ra run-icmp-ra: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp_ra.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp_ra.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp_ra.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp_ra.py N2 REGRESS_TARGETS += run-icmp6-ra run-icmp6-ra: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp6_hop_ra.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp6_hop_ra.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp6_hop_ra.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp6_hop_ra.py N2 REGRESS_TARGETS += run-icmp-bad run-icmp-bad: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp_bad.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp_bad.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp_bad.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp_bad.py N2 REGRESS_TARGETS += run-icmp6-bad run-icmp6-bad: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp6_hop_bad.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp6_hop_bad.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp6_hop_bad.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp6_hop_bad.py N2 REGRESS_TARGETS += run-bpf-opts run-bpf-opts: stamp-stop @@ -285,13 +293,13 @@ run-bpf-opts: stamp-stop REGRESS_TARGETS += run-igmp run-igmp: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}igmp_ra.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}igmp_ra.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}igmp_ra.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}igmp_ra.py N2 REGRESS_TARGETS += run-icmp6-mld run-icmp6-mld: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp6_mld_ra.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp6_mld_ra.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp6_mld_ra.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp6_mld_ra.py N2 REGRESS_TARGETS += run-bpf-mcast run-bpf-mcast: stamp-stop @@ -305,13 +313,13 @@ run-bpf-mcast: stamp-stop REGRESS_TARGETS += run-igmp-bad run-igmp-bad: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}igmp_bad.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}igmp_bad.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}igmp_bad.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}igmp_bad.py N2 REGRESS_TARGETS += run-icmp6-mld-bad run-icmp6-mld-bad: stamp-bpf - ${SUDO} env ${PYPATH} /sbin/route -T ${N1} exec ${PYTHON}icmp6_mld_bad.py N1 - ${SUDO} env ${PYPATH} /sbin/route -T ${N2} exec ${PYTHON}icmp6_mld_bad.py N2 + ${SUDO} /sbin/route -T ${N1} exec ${PYTHON}icmp6_mld_bad.py N1 + ${SUDO} /sbin/route -T ${N2} exec ${PYTHON}icmp6_mld_bad.py N2 REGRESS_TARGETS += run-bpf-mcast-bad run-bpf-mcast-bad: stamp-stop diff --git a/regress/sys/net/pflog/Makefile b/regress/sys/net/pflog/Makefile index 87b61efff61..4f833a930b6 100644 --- a/regress/sys/net/pflog/Makefile +++ b/regress/sys/net/pflog/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2021/01/20 13:50:09 bluhm Exp $ +# $OpenBSD: Makefile,v 1.8 2022/04/29 17:27:37 bluhm Exp $ # Copyright (c) 2021 Alexander Bluhm # @@ -33,7 +33,7 @@ UID !!= id -u .if ! (make(clean) || make(cleandir) || make(obj)) -PF_STATUS != ${SUDO} pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' +PF_STATUS != ${SUDO} /sbin/pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' .if empty(PF_STATUS:MEnabled) regress: @echo pf status: "${PF_STATUS}" @@ -41,7 +41,7 @@ regress: @echo SKIPPED .endif -PF_SKIP != ${SUDO} pfctl -sI -v | sed -n 's/ (skip)//p' +PF_SKIP != ${SUDO} /sbin/pfctl -sI -v | sed -n 's/ (skip)//p' .if ! empty(PF_SKIP:Mlo*:Nlo0) regress: @echo pf skip: "${PF_SKIP}" @@ -49,7 +49,8 @@ regress: @echo SKIPPED .endif -PF_ANCHOR != ${SUDO} pfctl -sr | sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' +PF_ANCHOR != ${SUDO} /sbin/pfctl -sr |\ + sed -n 's/^anchor "\([^"]*\)" all$$/\1/p' .if empty(PF_ANCHOR:Mregress) regress: @echo pf anchor: "${PF_ANCHOR}" @@ -78,27 +79,39 @@ REGRESS_SETUP_ONCE += ifconfig ifconfig: unconfig # Create and configure pflog and loopback interfaces. .for n in ${NUMS} - ${SUDO} ifconfig pflog$n create + ${SUDO} /sbin/ifconfig pflog$n create .endfor - ${SUDO} ifconfig lo$N rdomain $N - ${SUDO} ifconfig lo$N inet 127.0.0.1/8 - ${SUDO} ifconfig lo$N inet6 ::1/128 + ${SUDO} /sbin/ifconfig lo$N rdomain $N + ${SUDO} /sbin/ifconfig lo$N inet 127.0.0.1/8 + ${SUDO} /sbin/ifconfig lo$N inet6 ::1/128 .for i in ${IPS} 21 22 23 24 - ${SUDO} ifconfig lo$N inet 169.254.0.$i/32 alias - ${SUDO} ifconfig lo$N inet6 fc00::$i/128 + ${SUDO} /sbin/ifconfig lo$N inet 169.254.0.$i/32 alias + ${SUDO} /sbin/ifconfig lo$N inet6 fc00::$i/128 .endfor + # Wait until IPv6 addresses are no longer tentative. + for i in `jot 50`; do\ + if ! { /sbin/ifconfig pair${N1}; /sbin/ifconfig pair${N2};\ + /sbin/ifconfig lo${N3}; } | fgrep -q tentative; then\ + break;\ + fi;\ + sleep .1;\ + done + ! { /sbin/ifconfig pair${N1}; /sbin/ifconfig pair${N2};\ + /sbin/ifconfig lo${N3}; } | fgrep tentative + REGRESS_CLEANUP += unconfig unconfig: stamp-stop # Destroy interfaces. + -${SUDO} /sbin/ifconfig lo$N rdomain $N .for i in ${IPS} 21 22 23 24 - -${SUDO} ifconfig lo$N inet 169.254.0.$i delete - -${SUDO} ifconfig lo$N inet6 fc00::$i delete + -${SUDO} /sbin/ifconfig lo$N inet 169.254.0.$i delete + -${SUDO} /sbin/ifconfig lo$N inet6 fc00::$i delete .endfor - -${SUDO} ifconfig lo$N inet 127.0.0.1 delete - -${SUDO} ifconfig lo$N inet6 ::1 delete + -${SUDO} /sbin/ifconfig lo$N inet 127.0.0.1 delete + -${SUDO} /sbin/ifconfig lo$N inet6 ::1 delete .for n in ${NUMS} - -${SUDO} ifconfig pflog$n destroy + -${SUDO} /sbin/ifconfig pflog$n destroy .endfor rm -f stamp-ifconfig @@ -117,7 +130,7 @@ REGRESS_SETUP_ONCE += pfctl pfctl: addr.py pf.conf # Load the pf rules into the kernel. cat addr.py ${.CURDIR}/pf.conf | /sbin/pfctl -n -f - - cat addr.py ${.CURDIR}/pf.conf | ${SUDO} pfctl -a regress -f - + cat addr.py ${.CURDIR}/pf.conf | ${SUDO} /sbin/pfctl -a regress -f - # Run tcpdump on pflog devices. DUMPCMD = /usr/sbin/tcpdump -l -e -vvv -s 2048 -ni @@ -146,11 +159,11 @@ stamp-stop: .for i in ${IPS} REGRESS_TARGETS += run-ping-$i run-ping-$i: stamp-bpf - ping -n -w 1 -c 1 -V $N 169.254.0.$i + /sbin/ping -n -w 1 -c 1 -V $N 169.254.0.$i REGRESS_TARGETS += run-ping6-$i run-ping6-$i: stamp-bpf - ping6 -n -w 1 -c 1 -V $N fc00::$i + /sbin/ping6 -n -w 1 -c 1 -V $N fc00::$i REGRESS_TARGETS += run-udp-$i run-udp-$i: stamp-bpf @@ -165,7 +178,7 @@ run-udp6-$i: stamp-bpf REGRESS_TARGETS += run-ping6-0 run-ping6-0: stamp-bpf - ping6 -n -w 1 -c 1 -V $N ::1 + /sbin/ping6 -n -w 1 -c 1 -V $N ::1 REGRESS_TARGETS += run-udp6-0 run-udp6-0: stamp-bpf diff --git a/regress/sys/net/pflow/Makefile b/regress/sys/net/pflow/Makefile index 70a8ebd9fac..4fb21325b4e 100644 --- a/regress/sys/net/pflow/Makefile +++ b/regress/sys/net/pflow/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2021/10/02 07:07:08 anton Exp $ +# $OpenBSD: Makefile,v 1.10 2022/04/29 17:27:38 bluhm Exp $ # # template_v10 # ---------------- @@ -34,7 +34,7 @@ LDADD= -levent .if ! (make(clean) || make(cleandir) || make(obj)) -PF_STATUS != ${SUDO} pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' +PF_STATUS != ${SUDO} /sbin/pfctl -si | sed -n 's/^Status: \([^ ]*\) .*/\1/p' .if empty(PF_STATUS:MEnabled) regress: @echo pf status: "${PF_STATUS}" diff --git a/regress/sys/net/vxlan/Makefile b/regress/sys/net/vxlan/Makefile index b9898e69b0b..7a982ac2eeb 100644 --- a/regress/sys/net/vxlan/Makefile +++ b/regress/sys/net/vxlan/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2021/10/02 07:07:47 anton Exp $ +# $OpenBSD: Makefile,v 1.5 2022/04/29 17:27:38 bluhm Exp $ REGRESS_TARGETS= vxlan_1 vxlan_2.inet vxlan_2.dyn REGRESS_ROOT_TARGETS= vxlan_1 vxlan_2.inet vxlan_2.dyn @@ -13,12 +13,14 @@ vxlan_2.inet: ${SUDO} ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet vxlan_2.dyn: - env SUDO="${SUDO}" DYNAMIC=1 ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet + env SUDO="${SUDO}" DYNAMIC=1 \ + ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet vxlan_2.inet6: ${SUDO} ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet6 vxlan_2.dyn6: - env SUDO="${SUDO}" DYNAMIC=1 ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet6 + env SUDO="${SUDO}" DYNAMIC=1 \ + ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet6 .include -- 2.20.1