All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE
@ 2021-10-20 20:06 Stephen Suryaputra
  2021-10-21 12:52 ` Antonio Quartulli
  2021-10-22 21:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Suryaputra @ 2021-10-20 20:06 UTC (permalink / raw)
  To: netdev; +Cc: a, kuba, davem, Stephen Suryaputra

When addr_gen_mode is set to IN6_ADDR_GEN_MODE_NONE, the link-local addr
should not be generated. But it isn't the case for GRE (as well as GRE6)
and SIT tunnels. Make it so that tunnels consider the addr_gen_mode,
especially for IN6_ADDR_GEN_MODE_NONE.

Do this in add_v4_addrs() to cover both GRE and SIT only if the addr
scope is link.

Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
---
 net/ipv6/addrconf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d4fae16deec4..9e1463a2acae 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3110,6 +3110,9 @@ static void add_v4_addrs(struct inet6_dev *idev)
 	memcpy(&addr.s6_addr32[3], idev->dev->dev_addr + offset, 4);
 
 	if (idev->dev->flags&IFF_POINTOPOINT) {
+		if (idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_NONE)
+			return;
+
 		addr.s6_addr32[0] = htonl(0xfe800000);
 		scope = IFA_LINK;
 		plen = 64;
-- 
2.25.1


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

* Re: [PATCH net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE
  2021-10-20 20:06 [PATCH net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE Stephen Suryaputra
@ 2021-10-21 12:52 ` Antonio Quartulli
  2021-10-21 13:22   ` Stephen Suryaputra
  2021-10-22 21:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Antonio Quartulli @ 2021-10-21 12:52 UTC (permalink / raw)
  To: Stephen Suryaputra, netdev; +Cc: kuba, davem

Hi,

On 20/10/2021 22:06, Stephen Suryaputra wrote:
> When addr_gen_mode is set to IN6_ADDR_GEN_MODE_NONE, the link-local addr
> should not be generated. But it isn't the case for GRE (as well as GRE6)
> and SIT tunnels. Make it so that tunnels consider the addr_gen_mode,
> especially for IN6_ADDR_GEN_MODE_NONE.
> 
> Do this in add_v4_addrs() to cover both GRE and SIT only if the addr
> scope is link.
> 
> Signed-off-by: Stephen Suryaputra <ssuryaextr@gmail.com>
> ---
>  net/ipv6/addrconf.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index d4fae16deec4..9e1463a2acae 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -3110,6 +3110,9 @@ static void add_v4_addrs(struct inet6_dev *idev)
>  	memcpy(&addr.s6_addr32[3], idev->dev->dev_addr + offset, 4);
>  
>  	if (idev->dev->flags&IFF_POINTOPOINT) {
> +		if (idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_NONE)
> +			return;
> +

Maybe I am missing something, but why checking the mode only for
pointtopoint? If mode is NONE shouldn't this routine just abort
regardless of the interface setup?

Cheers,

>  		addr.s6_addr32[0] = htonl(0xfe800000);
>  		scope = IFA_LINK;
>  		plen = 64;
> 

-- 
Antonio Quartulli

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

* Re: [PATCH net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE
  2021-10-21 12:52 ` Antonio Quartulli
@ 2021-10-21 13:22   ` Stephen Suryaputra
  2021-10-21 13:41     ` Antonio Quartulli
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Suryaputra @ 2021-10-21 13:22 UTC (permalink / raw)
  To: Antonio Quartulli; +Cc: netdev, kuba, davem

On Thu, Oct 21, 2021 at 02:52:44PM +0200, Antonio Quartulli wrote:
> 
> Maybe I am missing something, but why checking the mode only for
> pointtopoint? If mode is NONE shouldn't this routine just abort
> regardless of the interface setup?
> 
If it isn't pointtopoint, the function sets up IPv4-compatible IPv6
address, i.e. non link-local (FE80::). addr_gen_mode NONE (1) is only
controlling the generation of link-local address. Quoting from the
sysctl doc:

addr_gen_mode - INTEGER
	Defines how link-local and autoconf addresses are generated.

	0: generate address based on EUI64 (default)
	1: do no generate a link-local address, use EUI64 for addresses generated
	   from autoconf
	2: generate stable privacy addresses, using the secret from
	   stable_secret (RFC7217)
	3: generate stable privacy addresses, using a random secret if unset

So, I thought the checking should be strictly when the link-local
address is about to be generated.

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

* Re: [PATCH net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE
  2021-10-21 13:22   ` Stephen Suryaputra
@ 2021-10-21 13:41     ` Antonio Quartulli
  0 siblings, 0 replies; 5+ messages in thread
From: Antonio Quartulli @ 2021-10-21 13:41 UTC (permalink / raw)
  To: Stephen Suryaputra; +Cc: netdev, kuba, davem

Hi,

On 21/10/2021 15:22, Stephen Suryaputra wrote:
> On Thu, Oct 21, 2021 at 02:52:44PM +0200, Antonio Quartulli wrote:
>>
>> Maybe I am missing something, but why checking the mode only for
>> pointtopoint? If mode is NONE shouldn't this routine just abort
>> regardless of the interface setup?
>>
> If it isn't pointtopoint, the function sets up IPv4-compatible IPv6
> address, i.e. non link-local (FE80::). addr_gen_mode NONE (1) is only
> controlling the generation of link-local address. Quoting from the
> sysctl doc:
> 
> addr_gen_mode - INTEGER
> 	Defines how link-local and autoconf addresses are generated.
> 
> 	0: generate address based on EUI64 (default)
> 	1: do no generate a link-local address, use EUI64 for addresses generated
> 	   from autoconf
> 	2: generate stable privacy addresses, using the secret from
> 	   stable_secret (RFC7217)
> 	3: generate stable privacy addresses, using a random secret if unset
> 
> So, I thought the checking should be strictly when the link-local
> address is about to be generated.

Right.

IMHO it makes sense.

Acked-by: Antonio Quartulli <a@unstable.cc>

-- 
Antonio Quartulli

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

* Re: [PATCH net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE
  2021-10-20 20:06 [PATCH net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE Stephen Suryaputra
  2021-10-21 12:52 ` Antonio Quartulli
@ 2021-10-22 21:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-22 21:40 UTC (permalink / raw)
  To: Stephen Suryaputra; +Cc: netdev, a, kuba, davem

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 20 Oct 2021 16:06:18 -0400 you wrote:
> When addr_gen_mode is set to IN6_ADDR_GEN_MODE_NONE, the link-local addr
> should not be generated. But it isn't the case for GRE (as well as GRE6)
> and SIT tunnels. Make it so that tunnels consider the addr_gen_mode,
> especially for IN6_ADDR_GEN_MODE_NONE.
> 
> Do this in add_v4_addrs() to cover both GRE and SIT only if the addr
> scope is link.
> 
> [...]

Here is the summary with links:
  - [net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE
    https://git.kernel.org/netdev/net-next/c/61e18ce7348b

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] 5+ messages in thread

end of thread, other threads:[~2021-10-22 21:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 20:06 [PATCH net-next] gre/sit: Don't generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE Stephen Suryaputra
2021-10-21 12:52 ` Antonio Quartulli
2021-10-21 13:22   ` Stephen Suryaputra
2021-10-21 13:41     ` Antonio Quartulli
2021-10-22 21:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.