Subject: Re: [PATCH net-next v4 4/4] net: geneve: enable binding geneve sockets to local addresses

From: Simon Horman <[email-masked]>
Date: Fri, 18 Jul 2025 08:31:41 +0100

On Thu, Jul 17, 2025 at 01:54:12PM +0200, Richard Gobert wrote:

...

> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c

...

>  static struct geneve_sock *geneve_find_sock(struct geneve_net *gn,
>  					    sa_family_t family,
> -					    __be16 dst_port)
> +					    __be16 dst_port,
> +						union geneve_addr *saddr)
>  {
>  	struct geneve_sock *gs;
>  
>  	list_for_each_entry(gs, &gn->sock_list, list) {
> -		if (inet_sk(gs->sock->sk)->inet_sport == dst_port &&
> +		struct sock *sk = gs->sock->sk;
> +		struct inet_sock *inet = inet_sk(sk);
> +
> +		if (family == AF_INET &&
> +		    inet->inet_rcv_saddr != saddr->sin.sin_addr.s_addr)
> +			continue;
> +
> +		else if (ipv6_addr_cmp(&sk->sk_v6_rcv_saddr,
> +				       &saddr->sin6.sin6_addr) != 0)
> +			continue;

Hi Richard,

Unfortunately this fails to build when CONFIG_IPV6 is not set.

  .../geneve.c:685:31: error: no member named 'skc_v6_rcv_saddr' in 'struct sock_common'; did you mean 'skc_rcv_saddr'?
    685 |                 else if (ipv6_addr_cmp(&sk->sk_v6_rcv_saddr,
        |                                             ^
  ./include/net/sock.h:385:37: note: expanded from macro 'sk_v6_rcv_saddr'
    385 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
        |                                     ^
  ./include/net/sock.h:155:11: note: 'skc_rcv_saddr' declared here
    155 |                         __be32  skc_rcv_saddr;
        |                                 ^

> +
> +		if (inet->inet_sport == dst_port &&
>  		    geneve_get_sk_family(gs) == family) {
>  			return gs;
>  		}

...

-- 
pw-bot: changes-requested