Message ID | 20170922061008.14723-2-fw@strlen.de |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
Series | rtnetlink: preparation patches for further rtnl lock pushdown/removal | expand |
On 9/22/17 12:10 AM, Florian Westphal wrote: > Cc: David Ahern <dsahern@gmail.com> > Signed-off-by: Florian Westphal <fw@strlen.de> > --- > tools/testing/selftests/net/rtnetlink.sh | 42 ++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) Acked-by: David Ahern <dsahern@gmail.com>
On 9/22/17 12:10 AM, Florian Westphal wrote: > +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 BTW, if there is a v3 of this set, that ip command is shifted - uses spaces instead of tab.
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh index 4b48de565cae..6ee2bbaebcd4 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 }
Cc: David Ahern <dsahern@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de> --- tools/testing/selftests/net/rtnetlink.sh | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)