[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <088b9c26-482d-49af-bd22-bc870aaae851@gmail.com>
Date: Wed, 13 Aug 2025 17:41:12 +0200
From: Richard Gobert <richardbgobert@...il.com>
To: Kuniyuki Iwashima <kuniyu@...gle.com>
Cc: andrew+netdev@...n.ch, daniel@...earbox.net, davem@...emloft.net,
donald.hunter@...il.com, dsahern@...nel.org, edumazet@...gle.com,
horms@...nel.org, idosch@...dia.com, jacob.e.keller@...el.com,
kuba@...nel.org, linux-kernel@...r.kernel.org, martin.lau@...nel.org,
menglong8.dong@...il.com, netdev@...r.kernel.org, pabeni@...hat.com,
petrm@...dia.com, razor@...ckwall.org, shuah@...nel.org
Subject: Re: [PATCH net-next v5 3/5] net: vxlan: bind vxlan sockets to their
local address if configured
Kuniyuki Iwashima wrote:
> From: Richard Gobert <richardbgobert@...il.com>
> Date: Tue, 12 Aug 2025 14:51:53 +0200
>> 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;
>
> VXLAN_F_LOCALBIND seems to be cleared ?
>
>>
>> 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);
>> +
>> + if (flags & VXLAN_F_LOCALBIND) {
>
> Does selftest exercise this path ?
>
>
>> + 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)
Nice catch. I don't think the new selftest exercises this path, but I'm
running the other vxlan selftests with the localbind option enabled by default
and ensuring that they pass.
Powered by blists - more mailing lists