Netdev List
 help / color / mirror / Atom feed
* [PATCH] sit: 6to4: honour routing table
@ 2009-08-22 10:47 Sascha Hlusiak
  2009-08-24  2:05 ` David Miller
  2009-08-24  6:37 ` Rémi Denis-Courmont
  0 siblings, 2 replies; 4+ messages in thread
From: Sascha Hlusiak @ 2009-08-22 10:47 UTC (permalink / raw)
  To: netdev; +Cc: Sascha Hlusiak

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(-)

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;
-- 
1.6.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-29  6:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-22 10:47 [PATCH] sit: 6to4: honour routing table Sascha Hlusiak
2009-08-24  2:05 ` David Miller
2009-08-24  6:37 ` Rémi Denis-Courmont
     [not found]   ` <200908241148.17012.contact@saschahlusiak.de>
     [not found]     ` <f40a9bc1410c815bf1932e27086162d8@chewa.net>
2009-08-29  6:55       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox