aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-09-28 16:19:52 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-28 16:19:52 -0400
commit86fa9c424c8ff57fbc2278e90d91bb839ec84ab5 (patch)
treebc590a02ea4c79082993e0d026d9a6d60b894345
parent5a4ee9a9a066b1600509d968e1e9eab37c8501d8 (diff)
parentcd0a0bd9b8e157b19aa38eeac30c60f1a0d010bd (diff)
downloadlinux-86fa9c424c8ff57fbc2278e90d91bb839ec84ab5.tar.gz
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 8db99e57175 ("sit: Fail to create tunnel, if it already exists"). This patchset fixes the remaining ipv6 tunnels. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/ip6_gre.c2
-rw-r--r--net/ipv6/ip6_tunnel.c6
-rw-r--r--net/ipv6/ip6_vti.c6
3 files changed, 12 insertions, 2 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index d172ec4ec9d32e..f304471477dce4 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -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;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index f9de5a69507252..69a84b464009cc 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -364,8 +364,12 @@ 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;
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 7f52fd9fa7b0d6..5833a224446732 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -253,8 +253,12 @@ 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;