netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] gre: Fix default IPv6 multicast route creation.
@ 2025-07-09 14:30 Guillaume Nault
  2025-07-09 14:30 ` [PATCH net 1/2] gre: Fix " Guillaume Nault
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Guillaume Nault @ 2025-07-09 14:30 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Simon Horman, David Ahern, Ido Schimmel, Aiden Yang,
	Gary Guo

When fixing IPv6 link-local address generation on GRE devices with
commit 3e6a0243ff00 ("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.

Guillaume Nault (2):
  gre: Fix IPv6 multicast route creation.
  selftests: Add IPv6 multicast route generation tests for GRE devices.

 net/ipv6/addrconf.c                           |  9 ++-----
 .../testing/selftests/net/gre_ipv6_lladdr.sh  | 27 ++++++++++++-------
 2 files changed, 19 insertions(+), 17 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net 1/2] gre: Fix IPv6 multicast route creation.
  2025-07-09 14:30 [PATCH net 0/2] gre: Fix default IPv6 multicast route creation Guillaume Nault
@ 2025-07-09 14:30 ` Guillaume Nault
  2025-07-10 11:32   ` Ido Schimmel
  2025-07-10 12:57   ` Gary Guo
  2025-07-09 14:30 ` [PATCH net 2/2] selftests: Add IPv6 multicast route generation tests for GRE devices Guillaume Nault
  2025-07-11  1:30 ` [PATCH net 0/2] gre: Fix default IPv6 multicast route creation patchwork-bot+netdevbpf
  2 siblings, 2 replies; 9+ messages in thread
From: Guillaume Nault @ 2025-07-09 14:30 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Simon Horman, David Ahern, Ido Schimmel, Aiden Yang,
	Gary Guo

Use addrconf_add_dev() instead of ipv6_find_idev() in
addrconf_gre_config() so that we don't just get the inet6_dev, but also
install the default ff00::/8 multicast route.

Before commit 3e6a0243ff00 ("gre: Fix again IPv6 link-local address
generation."), the multicast route was created at the end of the
function by addrconf_add_mroute(). But this code path is now only taken
in one particular case (gre devices not bound to a local IP address and
in EUI64 mode). For all other cases, the function exits early and
addrconf_add_mroute() is not called anymore.

Using addrconf_add_dev() instead of ipv6_find_idev() in
addrconf_gre_config(), fixes the problem as it will create the default
multicast route for all gre devices. This also brings
addrconf_gre_config() a bit closer to the normal netdevice IPv6
configuration code (addrconf_dev_config()).

Fixes: 3e6a0243ff00 ("gre: Fix again IPv6 link-local address generation.")
Reported-by: Aiden Yang <ling@moedove.com>
Closes: https://lore.kernel.org/netdev/CANR=AhRM7YHHXVxJ4DmrTNMeuEOY87K2mLmo9KMed1JMr20p6g@mail.gmail.com/
Reviewed-by: Gary Guo <gary@garyguo.net>
Tested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
 net/ipv6/addrconf.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ba2ec7c870cc..870a0bd6c2ba 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3525,11 +3525,9 @@ static void addrconf_gre_config(struct net_device *dev)
 
 	ASSERT_RTNL();
 
-	idev = ipv6_find_idev(dev);
-	if (IS_ERR(idev)) {
-		pr_debug("%s: add_dev failed\n", __func__);
+	idev = addrconf_add_dev(dev);
+	if (IS_ERR(idev))
 		return;
-	}
 
 	/* Generate the IPv6 link-local address using addrconf_addr_gen(),
 	 * 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)
 	}
 
 	add_v4_addrs(idev);
-
-	if (dev->flags & IFF_POINTOPOINT)
-		addrconf_add_mroute(dev);
 }
 #endif
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 2/2] selftests: Add IPv6 multicast route generation tests for GRE devices.
  2025-07-09 14:30 [PATCH net 0/2] gre: Fix default IPv6 multicast route creation Guillaume Nault
  2025-07-09 14:30 ` [PATCH net 1/2] gre: Fix " Guillaume Nault
@ 2025-07-09 14:30 ` Guillaume Nault
  2025-07-10 11:33   ` Ido Schimmel
  2025-07-11  1:30 ` [PATCH net 0/2] gre: Fix default IPv6 multicast route creation patchwork-bot+netdevbpf
  2 siblings, 1 reply; 9+ messages in thread
From: Guillaume Nault @ 2025-07-09 14:30 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
  Cc: netdev, Simon Horman, David Ahern, Ido Schimmel, Aiden Yang,
	Gary Guo

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 limitted to link-local address generation.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
 .../testing/selftests/net/gre_ipv6_lladdr.sh  | 27 ++++++++++++-------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/net/gre_ipv6_lladdr.sh b/tools/testing/selftests/net/gre_ipv6_lladdr.sh
index 5b34f6e1f831..48eb999a3120 100755
--- a/tools/testing/selftests/net/gre_ipv6_lladdr.sh
+++ b/tools/testing/selftests/net/gre_ipv6_lladdr.sh
@@ -24,7 +24,10 @@ setup_basenet()
 	ip -netns "${NS0}" address add dev lo 2001:db8::10/64 nodad
 }
 
-# Check if network device has an IPv6 link-local address assigned.
+# Check the IPv6 configuration of a network device.
+#
+# We currently check the generation of the link-local IPv6 address and the
+# creation of the ff00::/8 multicast route.
 #
 # Parameters:
 #
@@ -35,7 +38,7 @@ setup_basenet()
 #         a link-local address)
 #   * $4: The user visible name for the scenario being tested
 #
-check_ipv6_ll_addr()
+check_ipv6_device_config()
 {
 	local DEV="$1"
 	local EXTRA_MATCH="$2"
@@ -45,7 +48,11 @@ check_ipv6_ll_addr()
 	RET=0
 	set +e
 	ip -netns "${NS0}" -6 address show dev "${DEV}" scope link | grep "fe80::" | grep -q "${EXTRA_MATCH}"
-	check_err_fail "${XRET}" $? ""
+	check_err_fail "${XRET}" $? "IPv6 link-local address generation"
+
+	ip -netns "${NS0}" -6 route show table local type multicast ff00::/8 proto kernel | grep -q "${DEV}"
+	check_err_fail 0 $? "IPv6 multicast route creation"
+
 	log_test "${MSG}"
 	set -e
 }
@@ -102,20 +109,20 @@ test_gre_device()
 		;;
 	esac
 
-	# Check that IPv6 link-local address is generated when device goes up
+	# Check the IPv6 device configuration when it goes up
 	ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode="${ADDR_GEN_MODE}"
 	ip -netns "${NS0}" link set dev gretest up
-	check_ipv6_ll_addr gretest "${MATCH_REGEXP}" "${XRET}" "config: ${MSG}"
+	check_ipv6_device_config gretest "${MATCH_REGEXP}" "${XRET}" "config: ${MSG}"
 
 	# Now disable link-local address generation
 	ip -netns "${NS0}" link set dev gretest down
 	ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode=1
 	ip -netns "${NS0}" link set dev gretest up
 
-	# Check that link-local address generation works when re-enabled while
-	# the device is already up
+	# Check the IPv6 device configuration when link-local address
+	# generation is re-enabled while the device is already up
 	ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode="${ADDR_GEN_MODE}"
-	check_ipv6_ll_addr gretest "${MATCH_REGEXP}" "${XRET}" "update: ${MSG}"
+	check_ipv6_device_config gretest "${MATCH_REGEXP}" "${XRET}" "update: ${MSG}"
 
 	ip -netns "${NS0}" link del dev gretest
 }
@@ -126,7 +133,7 @@ test_gre4()
 	local MODE
 
 	for GRE_TYPE in "gre" "gretap"; do
-		printf "\n####\nTesting IPv6 link-local address generation on ${GRE_TYPE} devices\n####\n\n"
+		printf "\n####\nTesting IPv6 configuration of ${GRE_TYPE} devices\n####\n\n"
 
 		for MODE in "eui64" "none" "stable-privacy" "random"; do
 			test_gre_device "${GRE_TYPE}" 192.0.2.10 192.0.2.11 "${MODE}"
@@ -142,7 +149,7 @@ test_gre6()
 	local MODE
 
 	for GRE_TYPE in "ip6gre" "ip6gretap"; do
-		printf "\n####\nTesting IPv6 link-local address generation on ${GRE_TYPE} devices\n####\n\n"
+		printf "\n####\nTesting IPv6 configuration of ${GRE_TYPE} devices\n####\n\n"
 
 		for MODE in "eui64" "none" "stable-privacy" "random"; do
 			test_gre_device "${GRE_TYPE}" 2001:db8::10 2001:db8::11 "${MODE}"
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/2] gre: Fix IPv6 multicast route creation.
  2025-07-09 14:30 ` [PATCH net 1/2] gre: Fix " Guillaume Nault
@ 2025-07-10 11:32   ` Ido Schimmel
  2025-07-10 12:57   ` Gary Guo
  1 sibling, 0 replies; 9+ messages in thread
From: Ido Schimmel @ 2025-07-10 11:32 UTC (permalink / raw)
  To: Guillaume Nault
  Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
	Simon Horman, David Ahern, Aiden Yang, Gary Guo

On Wed, Jul 09, 2025 at 04:30:10PM +0200, Guillaume Nault wrote:
> Use addrconf_add_dev() instead of ipv6_find_idev() in
> addrconf_gre_config() so that we don't just get the inet6_dev, but also
> install the default ff00::/8 multicast route.
> 
> Before commit 3e6a0243ff00 ("gre: Fix again IPv6 link-local address
> generation."), the multicast route was created at the end of the
> function by addrconf_add_mroute(). But this code path is now only taken
> in one particular case (gre devices not bound to a local IP address and
> in EUI64 mode). For all other cases, the function exits early and
> addrconf_add_mroute() is not called anymore.
> 
> Using addrconf_add_dev() instead of ipv6_find_idev() in
> addrconf_gre_config(), fixes the problem as it will create the default
> multicast route for all gre devices. This also brings
> addrconf_gre_config() a bit closer to the normal netdevice IPv6
> configuration code (addrconf_dev_config()).
> 
> Fixes: 3e6a0243ff00 ("gre: Fix again IPv6 link-local address generation.")
> Reported-by: Aiden Yang <ling@moedove.com>
> Closes: https://lore.kernel.org/netdev/CANR=AhRM7YHHXVxJ4DmrTNMeuEOY87K2mLmo9KMed1JMr20p6g@mail.gmail.com/
> Reviewed-by: Gary Guo <gary@garyguo.net>
> Tested-by: Gary Guo <gary@garyguo.net>
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 2/2] selftests: Add IPv6 multicast route generation tests for GRE devices.
  2025-07-09 14:30 ` [PATCH net 2/2] selftests: Add IPv6 multicast route generation tests for GRE devices Guillaume Nault
@ 2025-07-10 11:33   ` Ido Schimmel
  2025-07-11 16:56     ` Guillaume Nault
  0 siblings, 1 reply; 9+ messages in thread
From: Ido Schimmel @ 2025-07-10 11:33 UTC (permalink / raw)
  To: Guillaume Nault
  Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
	Simon Horman, David Ahern, Aiden Yang, Gary Guo

On Wed, Jul 09, 2025 at 04:30:17PM +0200, Guillaume Nault wrote:
> 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 limitted to link-local address generation.

In case you have v2: s/limitted/limited/

> 
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/2] gre: Fix IPv6 multicast route creation.
  2025-07-09 14:30 ` [PATCH net 1/2] gre: Fix " Guillaume Nault
  2025-07-10 11:32   ` Ido Schimmel
@ 2025-07-10 12:57   ` Gary Guo
  2025-07-11 17:07     ` Guillaume Nault
  1 sibling, 1 reply; 9+ messages in thread
From: Gary Guo @ 2025-07-10 12:57 UTC (permalink / raw)
  To: Guillaume Nault
  Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
	Simon Horman, David Ahern, Ido Schimmel, Aiden Yang

On Wed, 9 Jul 2025 16:30:10 +0200
Guillaume Nault <gnault@redhat.com> wrote:

> Use addrconf_add_dev() instead of ipv6_find_idev() in
> addrconf_gre_config() so that we don't just get the inet6_dev, but also
> install the default ff00::/8 multicast route.
> 
> Before commit 3e6a0243ff00 ("gre: Fix again IPv6 link-local address
> generation."), the multicast route was created at the end of the
> function by addrconf_add_mroute(). But this code path is now only taken
> in one particular case (gre devices not bound to a local IP address and
> in EUI64 mode). For all other cases, the function exits early and
> addrconf_add_mroute() is not called anymore.
> 
> Using addrconf_add_dev() instead of ipv6_find_idev() in
> addrconf_gre_config(), fixes the problem as it will create the default
> multicast route for all gre devices. This also brings
> addrconf_gre_config() a bit closer to the normal netdevice IPv6
> configuration code (addrconf_dev_config()).
> 
> Fixes: 3e6a0243ff00 ("gre: Fix again IPv6 link-local address generation.")
> Reported-by: Aiden Yang <ling@moedove.com>
> Closes: https://lore.kernel.org/netdev/CANR=AhRM7YHHXVxJ4DmrTNMeuEOY87K2mLmo9KMed1JMr20p6g@mail.gmail.com/
> Reviewed-by: Gary Guo <gary@garyguo.net>
> Tested-by: Gary Guo <gary@garyguo.net>
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

You probably also want to

Cc: stable@vger.kernel.org

so this gets picked up by the stable team after it's merged.

Best,
Gary

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/2] gre: Fix default IPv6 multicast route creation.
  2025-07-09 14:30 [PATCH net 0/2] gre: Fix default IPv6 multicast route creation Guillaume Nault
  2025-07-09 14:30 ` [PATCH net 1/2] gre: Fix " Guillaume Nault
  2025-07-09 14:30 ` [PATCH net 2/2] selftests: Add IPv6 multicast route generation tests for GRE devices Guillaume Nault
@ 2025-07-11  1:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-11  1:30 UTC (permalink / raw)
  To: Guillaume Nault
  Cc: davem, kuba, pabeni, edumazet, netdev, horms, dsahern, idosch,
	ling, gary

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 9 Jul 2025 16:30:04 +0200 you wrote:
> When fixing IPv6 link-local address generation on GRE devices with
> commit 3e6a0243ff00 ("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.
> 
> [...]

Here is the summary with links:
  - [net,1/2] gre: Fix IPv6 multicast route creation.
    https://git.kernel.org/netdev/net/c/4e914ef063de
  - [net,2/2] selftests: Add IPv6 multicast route generation tests for GRE devices.
    https://git.kernel.org/netdev/net/c/4d61a8a73343

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 2/2] selftests: Add IPv6 multicast route generation tests for GRE devices.
  2025-07-10 11:33   ` Ido Schimmel
@ 2025-07-11 16:56     ` Guillaume Nault
  0 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2025-07-11 16:56 UTC (permalink / raw)
  To: Ido Schimmel
  Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
	Simon Horman, David Ahern, Aiden Yang, Gary Guo

On Thu, Jul 10, 2025 at 02:33:20PM +0300, Ido Schimmel wrote:
> On Wed, Jul 09, 2025 at 04:30:17PM +0200, Guillaume Nault wrote:
> > 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 limitted to link-local address generation.
> 
> In case you have v2: s/limitted/limited/

Forgot to run the spell-checker, sorry.
Anyway, it seems Jakub fixed it while merging.
Thank you both!

> > 
> > Signed-off-by: Guillaume Nault <gnault@redhat.com>
> 
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/2] gre: Fix IPv6 multicast route creation.
  2025-07-10 12:57   ` Gary Guo
@ 2025-07-11 17:07     ` Guillaume Nault
  0 siblings, 0 replies; 9+ messages in thread
From: Guillaume Nault @ 2025-07-11 17:07 UTC (permalink / raw)
  To: Gary Guo
  Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
	Simon Horman, David Ahern, Ido Schimmel, Aiden Yang

On Thu, Jul 10, 2025 at 01:57:57PM +0100, Gary Guo wrote:
> On Wed, 9 Jul 2025 16:30:10 +0200
> Guillaume Nault <gnault@redhat.com> wrote:
> 
> > Use addrconf_add_dev() instead of ipv6_find_idev() in
> > addrconf_gre_config() so that we don't just get the inet6_dev, but also
> > install the default ff00::/8 multicast route.
> > 
> > Before commit 3e6a0243ff00 ("gre: Fix again IPv6 link-local address
> > generation."), the multicast route was created at the end of the
> > function by addrconf_add_mroute(). But this code path is now only taken
> > in one particular case (gre devices not bound to a local IP address and
> > in EUI64 mode). For all other cases, the function exits early and
> > addrconf_add_mroute() is not called anymore.
> > 
> > Using addrconf_add_dev() instead of ipv6_find_idev() in
> > addrconf_gre_config(), fixes the problem as it will create the default
> > multicast route for all gre devices. This also brings
> > addrconf_gre_config() a bit closer to the normal netdevice IPv6
> > configuration code (addrconf_dev_config()).
> > 
> > Fixes: 3e6a0243ff00 ("gre: Fix again IPv6 link-local address generation.")
> > Reported-by: Aiden Yang <ling@moedove.com>
> > Closes: https://lore.kernel.org/netdev/CANR=AhRM7YHHXVxJ4DmrTNMeuEOY87K2mLmo9KMed1JMr20p6g@mail.gmail.com/
> > Reviewed-by: Gary Guo <gary@garyguo.net>
> > Tested-by: Gary Guo <gary@garyguo.net>
> > Signed-off-by: Guillaume Nault <gnault@redhat.com>
> 
> You probably also want to
> 
> Cc: stable@vger.kernel.org
> 
> so this gets picked up by the stable team after it's merged.

Yeah, I forgot that the policy had changed.
It seems that Jakub took care of it anyway.
Thanks again!

> Best,
> Gary
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-07-11 17:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 14:30 [PATCH net 0/2] gre: Fix default IPv6 multicast route creation Guillaume Nault
2025-07-09 14:30 ` [PATCH net 1/2] gre: Fix " Guillaume Nault
2025-07-10 11:32   ` Ido Schimmel
2025-07-10 12:57   ` Gary Guo
2025-07-11 17:07     ` Guillaume Nault
2025-07-09 14:30 ` [PATCH net 2/2] selftests: Add IPv6 multicast route generation tests for GRE devices Guillaume Nault
2025-07-10 11:33   ` Ido Schimmel
2025-07-11 16:56     ` Guillaume Nault
2025-07-11  1:30 ` [PATCH net 0/2] gre: Fix default IPv6 multicast route creation patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).