Skip to content

Commit

Permalink
sit: Fail to create tunnel, if it already exists
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
shlusiak authored and davem330 committed May 19, 2009
1 parent 9643f45 commit 8db99e5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/ipv6/sit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8db99e5

Please sign in to comment.