diff mbox

[1/5] sit: Fail to create tunnel, if it already exists,

Message ID 1242391971-32583-1-git-send-email-contact@saschahlusiak.de
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Sascha Hlusiak May 15, 2009, 12:52 p.m. UTC
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.
---
 net/ipv6/sit.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Comments

Jiri Pirko May 15, 2009, 1:30 p.m. UTC | #1
Fri, May 15, 2009 at 02:52:47PM CEST, contact@saschahlusiak.de wrote:
>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.

You are missing Signed-off-by line in the whole patchset.

>---
> net/ipv6/sit.c |    7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
>diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
>index 664ab82..bd63a7e 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;
>-- 
>1.6.3
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sascha Hlusiak May 15, 2009, 2:15 p.m. UTC | #2
Am Freitag 15 Mai 2009 15:30:08 schrieb Jiri Pirko:
> Fri, May 15, 2009 at 02:52:47PM CEST, contact@saschahlusiak.de wrote:
> >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.
>
> You are missing Signed-off-by line in the whole patchset.

Thanks. Resent patchset with Signed-off-by lines and fixed the other warnings.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 664ab82..bd63a7e 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;