Commit 601bc1c1 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

selftests: forwarding: lib: Support NUM_NETIFS of 0

So far the case of NUM_NETIFS of 0 has not been interesting. However if
one wishes to reuse the lib.sh routines in a setup of a separate
namespace, being able to import like this is handy.

Therefore replace the {1..$NUM_NETIFS} references, which cause iteration
over 1 and 0, with an explicit for loop like we do in setup_wait() and
tc_offload_check(), so that for NUM_NETIFS of 0 no iteration is done.
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6f9a5069
...@@ -104,7 +104,7 @@ create_netif_veth() ...@@ -104,7 +104,7 @@ create_netif_veth()
{ {
local i local i
for i in $(eval echo {1..$NUM_NETIFS}); do for ((i = 1; i <= NUM_NETIFS; ++i)); do
local j=$((i+1)) local j=$((i+1))
ip link show dev ${NETIFS[p$i]} &> /dev/null ip link show dev ${NETIFS[p$i]} &> /dev/null
...@@ -135,7 +135,7 @@ if [[ "$NETIF_CREATE" = "yes" ]]; then ...@@ -135,7 +135,7 @@ if [[ "$NETIF_CREATE" = "yes" ]]; then
create_netif create_netif
fi fi
for i in $(eval echo {1..$NUM_NETIFS}); do for ((i = 1; i <= NUM_NETIFS; ++i)); do
ip link show dev ${NETIFS[p$i]} &> /dev/null ip link show dev ${NETIFS[p$i]} &> /dev/null
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "SKIP: could not find all required interfaces" echo "SKIP: could not find all required interfaces"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment