selftests: add 'ip get' to rtnetlink.sh
authorFlorian Westphal <fw@strlen.de>
Tue, 15 Aug 2017 14:34:41 +0000 (16:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Aug 2017 00:20:54 +0000 (17:20 -0700)
exercise ip/ip6 RTM_GETROUTE doit() callpath.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/rtnetlink.sh

index 5b04ad91252522f30dd29ac89345777f5e094d7f..84b4acf5baa9834deb7615e54d1c93a6c9cc84ad 100755 (executable)
@@ -164,6 +164,37 @@ kci_test_polrouting()
        echo "PASS: policy routing"
 }
 
+kci_test_route_get()
+{
+       ret=0
+
+       ip route get 127.0.0.1 > /dev/null
+       check_err $?
+       ip route get 127.0.0.1 dev "$devdummy" > /dev/null
+       check_err $?
+       ip route get ::1 > /dev/null
+       check_err $?
+       ip route get fe80::1 dev "$devdummy" > /dev/null
+       check_err $?
+       ip route get 127.0.0.1 from 127.0.0.1 oif lo tos 0x1 mark 0x1 > /dev/null
+       check_err $?
+       ip route get ::1 from ::1 iif lo oif lo tos 0x1 mark 0x1 > /dev/null
+       check_err $?
+       ip addr add dev "$devdummy" 10.23.7.11/24
+       check_err $?
+       ip route get 10.23.7.11 from 10.23.7.12 iif "$devdummy" > /dev/null
+       check_err $?
+       ip addr del dev "$devdummy" 10.23.7.11/24
+       check_err $?
+
+       if [ $ret -ne 0 ];then
+               echo "FAIL: route get"
+               return 1
+       fi
+
+       echo "PASS: route get"
+}
+
 kci_test_rtnl()
 {
        kci_add_dummy
@@ -173,6 +204,7 @@ kci_test_rtnl()
        fi
 
        kci_test_polrouting
+       kci_test_route_get
        kci_test_tc
        kci_test_gre
        kci_test_bridge