[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <13f3cb64-4e5a-7792-91b6-795c89903fe3@6wind.com>
Date: Fri, 27 Mar 2020 19:15:35 +0100
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
To: William Dauchy <w.dauchy@...teo.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net] net, ip_tunnel: fix interface lookup with no key
Le 27/03/2020 à 15:54, William Dauchy a écrit :
> when creating a new ipip interface with no local/remote configuration,
> the lookup is done with TUNNEL_NO_KEY flag, making it impossible to
> match the new interface (only possible match being fallback or metada
> case interface); e.g: `ip link add tunl1 type ipip dev eth0`
>
> To fix this case, adding a flag check before the key comparison so we
> permit to match an interface with no local/remote config; it also avoids
> breaking possible userland tools relying on TUNNEL_NO_KEY flag and
> uninitialised key.
>
> context being on my side, I'm creating an extra ipip interface attached
> to the physical one, and moving it to a dedicated namespace.
>
> Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
> Signed-off-by: William Dauchy <w.dauchy@...teo.com>
> ---
> net/ipv4/ip_tunnel.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index 74e1d964a615..b30485615426 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -142,11 +142,8 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
> cand = t;
> }
>
> - if (flags & TUNNEL_NO_KEY)
> - goto skip_key_lookup;
> -
> hlist_for_each_entry_rcu(t, head, hash_node) {
> - if (t->parms.i_key != key ||
> + if ((flags & TUNNEL_KEY && t->parms.i_key != key) ||
I saw this flag, and frankly, having a flag named TUNNEL_KEY and another named
TUNNEL_NO_KEY is an horrible API design.
But I prefer to be conservative and avoid (ugly) surprise, thus I think it's
better to keep TUNNEL_NO_KEY.
Regards,
Nicolas
Powered by blists - more mailing lists