Skip to content

Commit

Permalink
test: Fix mk_if creating iptables chains
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
  • Loading branch information
pqarmitage committed Jun 25, 2020
1 parent 8db0c70 commit a9a0566
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/mk_if
Expand Up @@ -141,23 +141,27 @@ else
done
fi

[[ -z $CHAINS ]] && CHAINS=$DEFAULT_CHAINS

if [[ $CMD = add ]]; then
for n in $NS_LIST; do
[[ .$n = .$ROOT_NS ]] && continue

$ECHO unshare -n ip netns add $n
$ECHO ip netns exec $n ip link set up lo
done
fi

for n in $NS_LIST; do
[[ $n = $ROOT_NS ]] && NETNS_CMD= || NETNS_CMD="ip netns exec $p"
for v in "" 6; do
for c in $CHAINS; do
$ECHO $NETNS_CMD ip${v}tables -N $c
done
for n in $NS_LIST; do
[[ $CMD = del ]] && IPT_CMD=X || IPT_CMD=N

[[ $n = $ROOT_NS ]] && NETNS_CMD= || NETNS_CMD="ip netns exec $n"
for v in "" 6; do
for c in $CHAINS; do
$ECHO $NETNS_CMD ip${v}tables -$IPT_CMD $c
done
done
fi
done

for n in $(seq $LOW $HIGH); do
if [[ $CMD = add || $CMD = remake ]]; then
Expand Down

0 comments on commit a9a0566

Please sign in to comment.