Skip to content

Commit 0f1b724

Browse files
fmaurer-rhNobody
authored and
Nobody
committed
selftests: bpf: Make test_lwt_ip_encap more stable and faster
In test_lwt_ip_encap, the ingress IPv6 encap test failed from time to time. The failure occured when an IPv4 ping through the IPv6 GRE encapsulation did not receive a reply within the timeout. The IPv4 ping and the IPv6 ping in the test used different timeouts (1 sec for IPv4 and 6 sec for IPv6), probably taking into account that IPv6 might need longer to successfully complete. However, when IPv4 pings (with the short timeout) are encapsulated into the IPv6 tunnel, the delays of IPv6 apply. The actual reason for the long delays with IPv6 was that the IPv6 neighbor discovery sometimes did not complete in time. This was caused by the outgoing interface only having a tentative link local address, i.e., not having completed DAD for that lladdr. The ND was successfully retried after 1 sec but that was too late for the ping timeout. The IPv6 addresses for the test were already added with nodad. However, for the lladdrs, DAD was still performed. We now disable DAD in the test netns completely and just assume that the two lladdrs on each veth pair do not collide. This removes all the delays for IPv6 traffic in the test. Without the delays, we can now also reduce the delay of the IPv6 ping to 1 sec. This makes the whole test complete faster because we don't need to wait for the excessive timeout for each IPv6 ping that is supposed to fail. Fixes: 0fde56e ("selftests: bpf: add test_lwt_ip_encap selftest") Signed-off-by: Felix Maurer <[email protected]>
1 parent 3e76d40 commit 0f1b724

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tools/testing/selftests/bpf/test_lwt_ip_encap.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ setup()
120120
ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0
121121
ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0
122122

123+
# disable IPv6 DAD because it sometimes takes too long and fails tests
124+
ip netns exec ${NS1} sysctl -wq net.ipv6.conf.all.accept_dad=0
125+
ip netns exec ${NS2} sysctl -wq net.ipv6.conf.all.accept_dad=0
126+
ip netns exec ${NS3} sysctl -wq net.ipv6.conf.all.accept_dad=0
127+
ip netns exec ${NS1} sysctl -wq net.ipv6.conf.default.accept_dad=0
128+
ip netns exec ${NS2} sysctl -wq net.ipv6.conf.default.accept_dad=0
129+
ip netns exec ${NS3} sysctl -wq net.ipv6.conf.default.accept_dad=0
130+
123131
ip link add veth1 type veth peer name veth2
124132
ip link add veth3 type veth peer name veth4
125133
ip link add veth5 type veth peer name veth6
@@ -289,7 +297,7 @@ test_ping()
289297
ip netns exec ${NS1} ping -c 1 -W 1 -I veth1 ${IPv4_DST} 2>&1 > /dev/null
290298
RET=$?
291299
elif [ "${PROTO}" == "IPv6" ] ; then
292-
ip netns exec ${NS1} ping6 -c 1 -W 6 -I veth1 ${IPv6_DST} 2>&1 > /dev/null
300+
ip netns exec ${NS1} ping6 -c 1 -W 1 -I veth1 ${IPv6_DST} 2>&1 > /dev/null
293301
RET=$?
294302
else
295303
echo " test_ping: unknown PROTO: ${PROTO}"

0 commit comments

Comments
 (0)