selftests: forwarding: Allow to get netdev interfaces names from commandline
authorJiri Pirko <jiri@mellanox.com>
Wed, 28 Feb 2018 10:25:15 +0000 (12:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Feb 2018 17:25:48 +0000 (12:25 -0500)
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/forwarding/lib.sh

index 083a16e..3385ba7 100644 (file)
@@ -46,6 +46,21 @@ if [[ ! -v NUM_NETIFS ]]; then
 fi
 
 ##############################################################################
+# Command line options handling
+
+count=0
+
+while [[ $# -gt 0 ]]; do
+       if [[ "$count" -eq "0" ]]; then
+               unset NETIFS
+               declare -A NETIFS
+       fi
+       count=$((count + 1))
+       NETIFS[p$count]="$1"
+       shift
+done
+
+##############################################################################
 # Network interfaces configuration
 
 for i in $(eval echo {1..$NUM_NETIFS}); do