Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd0a0bd9 authored by Steffen Klassert's avatar Steffen Klassert Committed by David S. Miller
Browse files

ip6_gre: Return an error when adding an existing tunnel.



ip6gre_tunnel_locate() should not return an existing tunnel if
create is true. Otherwise it is possible to add the same
tunnel multiple times without getting an error.

So return NULL if the tunnel that should be created already
exists.

Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d814b847
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -314,6 +314,8 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
	struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);
	struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);


	t = ip6gre_tunnel_find(net, parms, ARPHRD_IP6GRE);
	t = ip6gre_tunnel_find(net, parms, ARPHRD_IP6GRE);
	if (t && create)
		return NULL;
	if (t || !create)
	if (t || !create)
		return t;
		return t;