summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/rtnetlink.sh
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2019-06-27 15:03:33 +0300
committerDavid S. Miller <davem@davemloft.net>2019-06-27 19:54:35 +0300
commitbb2bd090854cc608d4d8a4d14955eb13dffa94ab (patch)
tree485cac7117ac0bb3dd6713baaedaa37f5d7a7094 /tools/testing/selftests/net/rtnetlink.sh
parent6a9e9cea4c51dd7137f381710bb42e2ad6e7e285 (diff)
downloadlinux-bb2bd090854cc608d4d8a4d14955eb13dffa94ab.tar.xz
selftests: rtnetlink: add small test case with 'promote_secondaries' enabled
This exercises the 'promote_secondaries' code path. Without previous fix, this triggers infinite loop/soft lockup: ifconfig process spinning at 100%, never to return. 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.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index ed606a2e3865..505628884783 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -269,6 +269,25 @@ kci_test_addrlft()
echo "PASS: preferred_lft addresses have expired"
}
+kci_test_promote_secondaries()
+{
+ promote=$(sysctl -n net.ipv4.conf.$devdummy.promote_secondaries)
+
+ sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=1
+
+ for i in $(seq 2 254);do
+ IP="10.23.11.$i"
+ ip -f inet addr add $IP/16 brd + dev "$devdummy"
+ ifconfig "$devdummy" $IP netmask 255.255.0.0
+ done
+
+ ip addr flush dev "$devdummy"
+
+ [ $promote -eq 0 ] && sysctl -q net.ipv4.conf.$devdummy.promote_secondaries=0
+
+ echo "PASS: promote_secondaries complete"
+}
+
kci_test_addrlabel()
{
ret=0
@@ -1161,6 +1180,7 @@ kci_test_rtnl()
kci_test_polrouting
kci_test_route_get
kci_test_addrlft
+ kci_test_promote_secondaries
kci_test_tc
kci_test_gre
kci_test_gretap