From: Sascha Hlusiak Date: Tue, 19 May 2009 12:56:48 +0000 (+0000) Subject: sit: Fail to create tunnel, if it already exists X-Git-Tag: firefly_0821_release~13604^2~426 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8db99e5717507729a9eb49108facb7e528340376;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: David S. Miller --- 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, struct sit_net *sitn = net_generic(net, sit_net_id); for (tp = __ipip6_bucket(sitn, parms); (t = *tp) != NULL; tp = &t->next) { - if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr) - return t; + if (local == t->parms.iph.saddr && + remote == t->parms.iph.daddr) { + if (create) + return NULL; + else + return t; + } } if (!create) goto failed;