All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Antonio Quartulli <antonio@mandelbit.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	 Simon Horman <horms@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	 Nikolay Aleksandrov <razor@blackwall.org>,
	Alice Mikityanska <alice.kernel@fastmail.im>,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] udp_tunnel: don't treat IPv4 sockets bound to an address as wildcard
Date: Thu, 12 Nov 2026 06:02:12 +0000	[thread overview]
Message-ID: <avVVzxL3pVZc6yQ5@google.com> (raw)
In-Reply-To: <20261110113306.3698438-1-antonio@mandelbit.com>

On Tue, 10 Nov 2026 12:33:06 +0100, Antonio Quartulli wrote:
> With IPv6 enabled, sk_saddr_any() checks sk_v6_rcv_saddr also for
> AF_INET sockets, where it is always zero. An IPv4 tunnel socket bound to
> a specific address (e.g. fou or geneve with "local") ends up in the GRO
> lookup fast path, although another socket may bind the same port on a
> different address: GRO then hands that socket's packets to the tunnel's
> gro_receive.
> 
> Check the IPv6 address only for AF_INET6 sockets.
> 
> Fixes: a36283e2b683 ("udp_tunnel: create a fastpath GRO lookup.")
> Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
> ---
>  net/ipv4/udp_tunnel_core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ipv4/udp_tunnel_core.c b/net/ipv4/udp_tunnel_core.c
> index a128fe85620d..29581c94fdcf 100644
> --- a/net/ipv4/udp_tunnel_core.c
> +++ b/net/ipv4/udp_tunnel_core.c
> @@ -62,10 +62,10 @@ EXPORT_SYMBOL(udp_sock_create4);
>  static bool sk_saddr_any(struct sock *sk)
>  {
>  #if IS_ENABLED(CONFIG_IPV6)
> -	return ipv6_addr_any(&sk->sk_v6_rcv_saddr);
> -#else
> -	return !sk->sk_rcv_saddr;
> +	if (sk->sk_family == AF_INET6)
> +		return ipv6_addr_any(&sk->sk_v6_rcv_saddr);
>  #endif
> +	return !sk->sk_rcv_saddr;

This is identical with inet_rcv_saddr_any().  As a follow-up
in net-next, please move sk_saddr_any() to include/net/sock.h
and use it everywhere.

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

  parent reply	other threads:[~2026-11-12  6:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 11:33 [PATCH net] udp_tunnel: don't treat IPv4 sockets bound to an address as wildcard Antonio Quartulli
2026-11-10 11:36 ` netdev-bot+sinfo
2026-11-10 13:11   ` Antonio Quartulli
2026-11-12  6:02 ` Kuniyuki Iwashima [this message]
2026-11-12  9:05   ` Antonio Quartulli
2026-11-12 18:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avVVzxL3pVZc6yQ5@google.com \
    --to=kuniyu@google.com \
    --cc=alice.kernel@fastmail.im \
    --cc=antonio@mandelbit.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.