aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSascha Hlusiak <contact@saschahlusiak.de>2009-05-19 08:56:48 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-19 19:02:00 -0400
commit8db99e5717507729a9eb49108facb7e528340376 (patch)
treeba0ed4ecdb3386540bdcbb4bc6af14e1ad9166f5 /net
parent9643f4551255ce8b3ef7470aaaf7f435a20f9182 (diff)
sit: Fail to create tunnel, if it already exists
When locating the tunnel, do not continue if it is found. Otherwise a different tunnel with similar configuration would be returned and parts could be overwritten. Signed-off-by: Sascha Hlusiak <contact@saschahlusiak.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/sit.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 664ab82e03b2..e62504133c77 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -165,8 +165,13 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct net *net,
165 struct sit_net *sitn = net_generic(net, sit_net_id); 165 struct sit_net *sitn = net_generic(net, sit_net_id);
166 166
167 for (tp = __ipip6_bucket(sitn, parms); (t = *tp) != NULL; tp = &t->next) { 167 for (tp = __ipip6_bucket(sitn, parms); (t = *tp) != NULL; tp = &t->next) {
168 if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr) 168 if (local == t->parms.iph.saddr &&
169 return t; 169 remote == t->parms.iph.daddr) {
170 if (create)
171 return NULL;
172 else
173 return t;
174 }
170 } 175 }
171 if (!create) 176 if (!create)
172 goto failed; 177 goto failed;