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

Commit 86fa9c42 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ipv6_tunnel'



Steffen Klassert says:

====================
ipv6: Return an error when adding an already existing tunnel

The ipv6 tunnel locate functions 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.

All our ipv6 tunnels have this bug from the very beginning.
Only the sit tunnel was fixed some years ago with:

commit 8db99e57 ("sit: Fail to create tunnel, if it already exists").

This patchset fixes the remaining ipv6 tunnels.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 5a4ee9a9 cd0a0bd9
Loading
Loading
Loading
Loading
+2 −0
Original line number 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);

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

+5 −1
Original line number Diff line number Diff line
@@ -364,9 +364,13 @@ static struct ip6_tnl *ip6_tnl_locate(struct net *net,
	     (t = rtnl_dereference(*tp)) != NULL;
	     tp = &t->next) {
		if (ipv6_addr_equal(local, &t->parms.laddr) &&
		    ipv6_addr_equal(remote, &t->parms.raddr))
		    ipv6_addr_equal(remote, &t->parms.raddr)) {
			if (create)
				return NULL;

			return t;
		}
	}
	if (!create)
		return NULL;
	return ip6_tnl_create(net, p);
+5 −1
Original line number Diff line number Diff line
@@ -253,9 +253,13 @@ static struct ip6_tnl *vti6_locate(struct net *net, struct __ip6_tnl_parm *p,
	     (t = rtnl_dereference(*tp)) != NULL;
	     tp = &t->next) {
		if (ipv6_addr_equal(local, &t->parms.laddr) &&
		    ipv6_addr_equal(remote, &t->parms.raddr))
		    ipv6_addr_equal(remote, &t->parms.raddr)) {
			if (create)
				return NULL;

			return t;
		}
	}
	if (!create)
		return NULL;
	return vti6_tnl_create(net, p);