diff mbox

sit: 6to4: honour routing table

Message ID 1250938072-5577-1-git-send-email-contact@saschahlusiak.de
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Sascha Hlusiak Aug. 22, 2009, 10:47 a.m. UTC
Using only the actual destination address to determine the IPv4 target in
try_6to4(&iph6->daddr) seems wrong to me and breaks, if a 6to4 address is
the next-hop, like ::192.88.99.1 written as 6to4:

default via 2002:c058:6301:: dev 6to4

A package to 2001:: would fall through the try_6to4 check to the
IPv4-compat check and die there.

This patch makes try_6to4 use the address of the Next-Hop instead, respecting
the routing table. Users are encouraged to have a route 2002::/16 to the
tunnel device anyway, making all other 6to4 hosts direct neighbours.

Signed-off-by: Sascha Hlusiak <contact@saschahlusiak.de>
---
 net/ipv6/sit.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

Comments

David Miller Aug. 24, 2009, 2:05 a.m. UTC | #1
From: Sascha Hlusiak <contact@saschahlusiak.de>
Date: Sat, 22 Aug 2009 12:47:52 +0200

> This patch makes try_6to4 use the address of the Next-Hop instead, respecting
> the routing table. Users are encouraged to have a route 2002::/16 to the
> tunnel device anyway, making all other 6to4 hosts direct neighbours.

This doesn't seem right to me at all, but I'm not a complete expert
in this area.

Can someone who is review this patch?  Thanks.
--
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
RĂ©mi Denis-Courmont Aug. 24, 2009, 6:37 a.m. UTC | #2
On Sat, 22 Aug 2009 12:47:52 +0200, Sascha Hlusiak
<contact@saschahlusiak.de> wrote:
> Using only the actual destination address to determine the IPv4 target in
> try_6to4(&iph6->daddr) seems wrong to me and breaks, if a 6to4 address is
> the next-hop, like ::192.88.99.1 written as 6to4:
> 
> default via 2002:c058:6301:: dev 6to4
> 
> A package to 2001:: would fall through the try_6to4 check to the
> IPv4-compat check and die there.

I don't understand what you're trying to fix. For a 6to4 tunnel, this has
always worked fine for me, as far as I remember:
default via ::192.88.99.1 dev 6to4

> This patch makes try_6to4 use the address of the Next-Hop instead,
> respecting
> the routing table. Users are encouraged to have a route 2002::/16 to the
> tunnel device anyway, making all other 6to4 hosts direct neighbours.

And where exactly is that "encouragement" coming from?
diff mbox

Patch

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 98b7327..8ae3028 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -656,8 +656,17 @@  static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
 			goto tx_error;
 	}
 
-	if (!dst)
-		dst = try_6to4(&iph6->daddr);
+	if (!dst) {
+		struct neighbour *neigh = NULL;
+
+		if (skb_dst(skb))
+			neigh = skb_dst(skb)->neighbour;
+
+		if (neigh) {
+			addr6 = (struct in6_addr *)&neigh->primary_key;
+			dst = try_6to4(addr6);
+		}
+	}
 
 	if (!dst) {
 		struct neighbour *neigh = NULL;