summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/rtnetlink.sh
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2017-09-26 08:40:42 +0300
committerDavid S. Miller <davem@davemloft.net>2017-09-28 20:14:16 +0300
commit61f26d92510ea1e30f9b69097b34b6a522daa1d2 (patch)
tree826f6c1f9ce3f9d4aecb6decee8f34742708d19b /tools/testing/selftests/net/rtnetlink.sh
parente7614370d6f04711c4e4b48f7055e5008fa4ed42 (diff)
downloadlinux-61f26d92510ea1e30f9b69097b34b6a522daa1d2.tar.xz
selftests: rtnetlink.sh: add rudimentary vrf test
Acked-by: David Ahern <dsahern@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/rtnetlink.sh')
-rwxr-xr-xtools/testing/selftests/net/rtnetlink.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 4b48de565cae..a048f7a5f94c 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -291,6 +291,47 @@ kci_test_ifalias()
echo "PASS: set ifalias $namewant for $devdummy"
}
+kci_test_vrf()
+{
+ vrfname="test-vrf"
+ ret=0
+
+ ip link show type vrf 2>/dev/null
+ if [ $? -ne 0 ]; then
+ echo "SKIP: vrf: iproute2 too old"
+ return 0
+ fi
+
+ ip link add "$vrfname" type vrf table 10
+ check_err $?
+ if [ $ret -ne 0 ];then
+ echo "FAIL: can't add vrf interface, skipping test"
+ return 0
+ fi
+
+ ip -br link show type vrf | grep -q "$vrfname"
+ check_err $?
+ if [ $ret -ne 0 ];then
+ echo "FAIL: created vrf device not found"
+ return 1
+ fi
+
+ ip link set dev "$vrfname" up
+ check_err $?
+
+ ip link set dev "$devdummy" master "$vrfname"
+ check_err $?
+ ip link del dev "$vrfname"
+ check_err $?
+
+ if [ $ret -ne 0 ];then
+ echo "FAIL: vrf"
+ return 1
+ fi
+
+ echo "PASS: vrf"
+}
+
kci_test_rtnl()
{
kci_add_dummy
@@ -306,6 +347,7 @@ kci_test_rtnl()
kci_test_bridge
kci_test_addrlabel
kci_test_ifalias
+ kci_test_vrf
kci_del_dummy
}