--- zzzz-none-000/linux-2.6.32.61/net/ipv6/route.c 2013-06-10 09:43:48.000000000 +0000 +++ ar9-7330-650/linux-2.6.32.61/net/ipv6/route.c 2011-10-21 12:21:44.000000000 +0000 @@ -59,6 +59,9 @@ #ifdef CONFIG_SYSCTL #include #endif +#ifdef CONFIG_MAPPING +#include "proto_trans.h" +#endif /* Set to 3 to get tracing. */ #define RT6_DEBUG 2 @@ -709,7 +712,9 @@ int attempts = 3; int err; int reachable = net->ipv6.devconf_all->forwarding ? 0 : RT6_LOOKUP_F_REACHABLE; - +#ifdef CONFIG_MAPPING + struct sk_buff *skb = fl->skb; +#endif strict |= flags & RT6_LOOKUP_F_IFACE; relookup: @@ -721,6 +726,16 @@ restart: rt = rt6_select(fn, oif, strict | reachable); +#ifdef CONFIG_MAPPING + if ((rt->rt6i_flags & RTF_MAPPING)) { + if (!ip6_mapping(skb)) + printk("Mapping6 Failed!\n"); + dst_hold(&rt->u.dst); + read_unlock_bh(&table->tb6_lock); + skb_dst_set(skb,NULL); + return rt; + } +#endif BACKTRACK(net, &fl->fl6_src); if (rt == net->ipv6.ip6_null_entry || rt->rt6i_flags & RTF_CACHE) @@ -769,7 +784,12 @@ out2: rt->u.dst.lastuse = jiffies; rt->u.dst.__use++; - +#ifdef CONFIG_MAPPING + if (rt->rt6i_flags & RTF_MAPPING) + rt->u.dst.mapping = 1; + else + rt->u.dst.mapping = 0; +#endif return rt; } @@ -785,6 +805,9 @@ struct net *net = dev_net(skb->dev); int flags = RT6_LOOKUP_F_HAS_SADDR; struct flowi fl = { +#ifdef CONFIG_MAPPING + .skb = skb, +#endif .iif = skb->dev->ifindex, .nl_u = { .ip6_u = { @@ -1015,10 +1038,11 @@ int icmp6_dst_gc(void) { - struct dst_entry *dst, *next, **pprev; + /*--- struct dst_entry *dst, *next, **pprev; ---*/ + struct dst_entry *dst, **pprev; int more = 0; - next = NULL; + /*--- next = NULL; ---*/ spin_lock_bh(&icmp6_dst_lock); pprev = &icmp6_dst_gc_list; @@ -1281,6 +1305,12 @@ } rt->rt6i_flags = cfg->fc_flags; +#ifdef CONFIG_MAPPING + if (rt->rt6i_flags&RTF_MAPPING) + rt->u.dst.mapping = 1; + else + rt->u.dst.mapping = 0; +#endif install_route: if (cfg->fc_mx) {