Index: head/tests/sys/netpfil/pf/utils.subr =================================================================== --- head/tests/sys/netpfil/pf/utils.subr (revision 325019) +++ head/tests/sys/netpfil/pf/utils.subr (revision 325020) @@ -1,67 +1,67 @@ # $FreeBSD$ # Utility functions ## pft_init() { if [ ! -c /dev/pf ]; then atf_skip "This test requires pf" fi if [ "`sysctl -i -n kern.features.vimage`" != 1 ]; then atf_skip "This test requires VIMAGE" fi } pft_mkepair() { ifname=$(ifconfig epair create) echo $ifname >> created_interfaces.lst echo ${ifname%a} } pft_mkjail() { jailname=$1 shift vnet_interfaces= for ifname in $@ do vnet_interfaces="${vnet_interfaces} vnet.interface=${ifname}" done jail -c name=${jailname} persist vnet ${vnet_interfaces} echo $jailname >> created_jails.lst } pft_set_rules() { jname=$1 shift # Flush all states, rules, fragments, ... jexec ${jname} pfctl -F all while [ $# -gt 0 ]; do printf "$1\n" shift done | jexec ${jname} pfctl -f - } pft_cleanup() { - if [ -f created_interfaces.lst ]; then - for ifname in `cat created_interfaces.lst` + if [ -f created_jails.lst ]; then + for jailname in `cat created_jails.lst` do - ifconfig ${ifname} destroy + jail -r ${jailname} done fi - if [ -f created_jails.lst ]; then - for jailname in `cat created_jails.lst` + if [ -f created_interfaces.lst ]; then + for ifname in `cat created_interfaces.lst` do - jail -r ${jailname} + ifconfig ${ifname} destroy done fi }