lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJxaYt7aPxuU9iN6@shredder>
Date: Wed, 13 Aug 2025 12:26:58 +0300
From: Ido Schimmel <idosch@...dia.com>
To: Richard Gobert <richardbgobert@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, horms@...nel.org,
	donald.hunter@...il.com, andrew+netdev@...n.ch, dsahern@...nel.org,
	shuah@...nel.org, daniel@...earbox.net, jacob.e.keller@...el.com,
	razor@...ckwall.org, petrm@...dia.com, menglong8.dong@...il.com,
	martin.lau@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v5 3/5] net: vxlan: bind vxlan sockets to their
 local address if configured

On Tue, Aug 12, 2025 at 02:51:53PM +0200, Richard Gobert wrote:
> Bind VXLAN sockets to the local addresses if the IFLA_VXLAN_LOCALBIND
> option is set. This is the new default.

Drop the last sentence?

> 
> Change vxlan_find_sock to search for the socket using the listening
> address.
> 
> This is implemented by copying the VXLAN local address to the udp_port_cfg
> passed to udp_sock_create. The freebind option is set because VXLAN
> interfaces may be UP before their outgoing interface is.
> 
> This fixes multiple VXLAN selftests that fail because of that race.

This sentence is no longer relevant as well.

> 
> Signed-off-by: Richard Gobert <richardbgobert@...il.com>
> ---
>  drivers/net/vxlan/vxlan_core.c | 59 ++++++++++++++++++++++++++--------
>  1 file changed, 46 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
> index 15fe9d83c724..12da9595436e 100644
> --- a/drivers/net/vxlan/vxlan_core.c
> +++ b/drivers/net/vxlan/vxlan_core.c
> @@ -78,18 +78,34 @@ static inline bool vxlan_collect_metadata(struct vxlan_sock *vs)
>  }
>  
>  /* Find VXLAN socket based on network namespace, address family, UDP port,
> - * enabled unshareable flags and socket device binding (see l3mdev with
> - * non-default VRF).
> + * bound address, enabled unshareable flags and socket device binding
> + * (see l3mdev with non-default VRF).
>   */
>  static struct vxlan_sock *vxlan_find_sock(struct net *net, sa_family_t family,
> -					  __be16 port, u32 flags, int ifindex)
> +					  __be16 port, u32 flags, int ifindex,
> +					  union vxlan_addr *saddr)
>  {
>  	struct vxlan_sock *vs;
>  
>  	flags &= VXLAN_F_RCV_FLAGS;
>  
>  	hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) {
> -		if (inet_sk(vs->sock->sk)->inet_sport == port &&
> +		struct sock *sk = vs->sock->sk;
> +		struct inet_sock *inet = inet_sk(sk);

https://docs.kernel.org/process/maintainer-netdev.html#local-variable-ordering-reverse-xmas-tree-rcs

> +
> +		if (flags & VXLAN_F_LOCALBIND) {
> +			if (family == AF_INET &&
> +			    inet->inet_rcv_saddr != saddr->sin.sin_addr.s_addr)
> +				continue;
> +#if IS_ENABLED(CONFIG_IPV6)
> +			else if (family == AF_INET6 &&
> +				 ipv6_addr_cmp(&sk->sk_v6_rcv_saddr,
> +					       &saddr->sin6.sin6_addr) != 0)
> +				continue;
> +#endif
> +		}
> +
> +		if (inet->inet_sport == port &&
>  		    vxlan_get_sk_family(vs) == family &&
>  		    vs->flags == flags &&
>  		    vs->sock->sk->sk_bound_dev_if == ifindex)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ