]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
sit: Fail to create tunnel, if it already exists
authorSascha Hlusiak <contact@saschahlusiak.de>
Tue, 19 May 2009 12:56:48 +0000 (12:56 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 May 2009 23:02:00 +0000 (16:02 -0700)
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>
net/ipv6/sit.c

index 664ab82e03b2ed1a1191a5111fb01e4014410235..e62504133c77d6e3a60045045b35249cc976579c 100644 (file)
@@ -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;