Skip to content

Commit 4d61a8a

Browse files
Guillaume Naultkuba-moo
authored andcommitted
selftests: Add IPv6 multicast route generation tests for GRE devices.
The previous patch fixes a bug that prevented the creation of the default IPv6 multicast route (ff00::/8) for some GRE devices. Now let's extend the GRE IPv6 selftests to cover this case. Also, rename check_ipv6_ll_addr() to check_ipv6_device_config() and adapt comments and script output to take into account the fact that we're not limited to link-local address generation. Signed-off-by: Guillaume Nault <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Link: https://patch.msgid.link/65a89583bde3bf866a1922c2e5158e4d72c520e2.1752070620.git.gnault@redhat.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4e914ef commit 4d61a8a

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

tools/testing/selftests/net/gre_ipv6_lladdr.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ setup_basenet()
2424
ip -netns "${NS0}" address add dev lo 2001:db8::10/64 nodad
2525
}
2626

27-
# Check if network device has an IPv6 link-local address assigned.
27+
# Check the IPv6 configuration of a network device.
28+
#
29+
# We currently check the generation of the link-local IPv6 address and the
30+
# creation of the ff00::/8 multicast route.
2831
#
2932
# Parameters:
3033
#
@@ -35,7 +38,7 @@ setup_basenet()
3538
# a link-local address)
3639
# * $4: The user visible name for the scenario being tested
3740
#
38-
check_ipv6_ll_addr()
41+
check_ipv6_device_config()
3942
{
4043
local DEV="$1"
4144
local EXTRA_MATCH="$2"
@@ -45,7 +48,11 @@ check_ipv6_ll_addr()
4548
RET=0
4649
set +e
4750
ip -netns "${NS0}" -6 address show dev "${DEV}" scope link | grep "fe80::" | grep -q "${EXTRA_MATCH}"
48-
check_err_fail "${XRET}" $? ""
51+
check_err_fail "${XRET}" $? "IPv6 link-local address generation"
52+
53+
ip -netns "${NS0}" -6 route show table local type multicast ff00::/8 proto kernel | grep -q "${DEV}"
54+
check_err_fail 0 $? "IPv6 multicast route creation"
55+
4956
log_test "${MSG}"
5057
set -e
5158
}
@@ -102,20 +109,20 @@ test_gre_device()
102109
;;
103110
esac
104111

105-
# Check that IPv6 link-local address is generated when device goes up
112+
# Check the IPv6 device configuration when it goes up
106113
ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode="${ADDR_GEN_MODE}"
107114
ip -netns "${NS0}" link set dev gretest up
108-
check_ipv6_ll_addr gretest "${MATCH_REGEXP}" "${XRET}" "config: ${MSG}"
115+
check_ipv6_device_config gretest "${MATCH_REGEXP}" "${XRET}" "config: ${MSG}"
109116

110117
# Now disable link-local address generation
111118
ip -netns "${NS0}" link set dev gretest down
112119
ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode=1
113120
ip -netns "${NS0}" link set dev gretest up
114121

115-
# Check that link-local address generation works when re-enabled while
116-
# the device is already up
122+
# Check the IPv6 device configuration when link-local address
123+
# generation is re-enabled while the device is already up
117124
ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode="${ADDR_GEN_MODE}"
118-
check_ipv6_ll_addr gretest "${MATCH_REGEXP}" "${XRET}" "update: ${MSG}"
125+
check_ipv6_device_config gretest "${MATCH_REGEXP}" "${XRET}" "update: ${MSG}"
119126

120127
ip -netns "${NS0}" link del dev gretest
121128
}
@@ -126,7 +133,7 @@ test_gre4()
126133
local MODE
127134

128135
for GRE_TYPE in "gre" "gretap"; do
129-
printf "\n####\nTesting IPv6 link-local address generation on ${GRE_TYPE} devices\n####\n\n"
136+
printf "\n####\nTesting IPv6 configuration of ${GRE_TYPE} devices\n####\n\n"
130137

131138
for MODE in "eui64" "none" "stable-privacy" "random"; do
132139
test_gre_device "${GRE_TYPE}" 192.0.2.10 192.0.2.11 "${MODE}"
@@ -142,7 +149,7 @@ test_gre6()
142149
local MODE
143150

144151
for GRE_TYPE in "ip6gre" "ip6gretap"; do
145-
printf "\n####\nTesting IPv6 link-local address generation on ${GRE_TYPE} devices\n####\n\n"
152+
printf "\n####\nTesting IPv6 configuration of ${GRE_TYPE} devices\n####\n\n"
146153

147154
for MODE in "eui64" "none" "stable-privacy" "random"; do
148155
test_gre_device "${GRE_TYPE}" 2001:db8::10 2001:db8::11 "${MODE}"

0 commit comments

Comments
 (0)