Skip to content

Commit ce913b2

Browse files
committed
Merge branch 'gre-fix-default-ipv6-multicast-route-creation'
Guillaume Nault says: ==================== gre: Fix default IPv6 multicast route creation. When fixing IPv6 link-local address generation on GRE devices with commit 3e6a024 ("gre: Fix again IPv6 link-local address generation."), I accidentally broke the default IPv6 multicast route creation on these GRE devices. Fix that in patch 1, making the GRE specific code yet a bit closer to the generic code used by most other network interface types. Then extend the selftest in patch 2 to cover this case. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 2dfa4e3 + 4d61a8a commit ce913b2

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

net/ipv6/addrconf.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,11 +3525,9 @@ static void addrconf_gre_config(struct net_device *dev)
35253525

35263526
ASSERT_RTNL();
35273527

3528-
idev = ipv6_find_idev(dev);
3529-
if (IS_ERR(idev)) {
3530-
pr_debug("%s: add_dev failed\n", __func__);
3528+
idev = addrconf_add_dev(dev);
3529+
if (IS_ERR(idev))
35313530
return;
3532-
}
35333531

35343532
/* Generate the IPv6 link-local address using addrconf_addr_gen(),
35353533
* unless we have an IPv4 GRE device not bound to an IP address and
@@ -3543,9 +3541,6 @@ static void addrconf_gre_config(struct net_device *dev)
35433541
}
35443542

35453543
add_v4_addrs(idev);
3546-
3547-
if (dev->flags & IFF_POINTOPOINT)
3548-
addrconf_add_mroute(dev);
35493544
}
35503545
#endif
35513546

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)