-+ int err;
-+ struct rtable *rt;
-+ struct iphdr *iph = skb->nh.iph;
-+ struct flowi fl = {
-+ .oif = ifindex,
-+ .nl_u = {
-+ .ip4_u = {
-+ .daddr = iph->daddr,
-+ .saddr = 0,
-+ .tos = RT_TOS(iph->tos),
-+ .scope = RT_SCOPE_UNIVERSE,
-+ }
-+ }
-+ };
-+
-+ /* The destination address may be overloaded by the target */
-+ if (route_info->gw)
-+ fl.fl4_dst = route_info->gw;
-+
-+ /* Trying to route the packet using the standard routing table. */
-+ if ((err = ip_route_output_key(&rt, &fl))) {
-+ if (net_ratelimit())
-+ DEBUGP("ipt_ROUTE: couldn't route pkt (err: %i)",err);
-+ return -1;
-+ }
-+
-+ /* Drop old route. */
-+ dst_release(skb->dst);
-+ skb->dst = NULL;
-+
-+ /* Success if no oif specified or if the oif correspond to the
-+ * one desired */
-+ if (!ifindex || rt->u.dst.dev->ifindex == ifindex) {
-+ skb->dst = &rt->u.dst;
-+ skb->dev = skb->dst->dev;
-+ skb->protocol = htons(ETH_P_IP);
-+ return 1;
-+ }
-+
-+ /* The interface selected by the routing table is not the one
-+ * specified by the user. This may happen because the dst address
-+ * is one of our own addresses.
-+ */
-+ if (net_ratelimit())
-+ DEBUGP("ipt_ROUTE: failed to route as desired gw=%u.%u.%u.%u oif=%i (got oif=%i)\n",
-+ NIPQUAD(route_info->gw), ifindex, rt->u.dst.dev->ifindex);
-+
-+ return 0;
++ int err;
++ struct rtable *rt;
++ struct iphdr *iph = skb->nh.iph;
++ struct flowi fl = {
++ .oif = ifindex,
++ .nl_u = {
++ .ip4_u = {
++ .daddr = iph->daddr,
++ .saddr = 0,
++ .tos = RT_TOS(iph->tos),
++ .scope = RT_SCOPE_UNIVERSE,
++ }
++ }
++ };
++
++ /* The destination address may be overloaded by the target */
++ if (route_info->gw)
++ fl.fl4_dst = route_info->gw;
++
++ /* Trying to route the packet using the standard routing table. */
++ if ((err = ip_route_output_key(&rt, &fl))) {
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: couldn't route pkt (err: %i)",err);
++ return -1;
++ }
++
++ /* Drop old route. */
++ dst_release(skb->dst);
++ skb->dst = NULL;
++
++ /* Success if no oif specified or if the oif correspond to the
++ * one desired */
++ if (!ifindex || rt->u.dst.dev->ifindex == ifindex) {
++ skb->dst = &rt->u.dst;
++ skb->dev = skb->dst->dev;
++ skb->protocol = htons(ETH_P_IP);
++ return 1;
++ }
++
++ /* The interface selected by the routing table is not the one
++ * specified by the user. This may happen because the dst address
++ * is one of our own addresses.
++ */
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: failed to route as desired gw=%u.%u.%u.%u oif=%i (got oif=%i)\n",
++ NIPQUAD(route_info->gw), ifindex, rt->u.dst.dev->ifindex);
++
++ return 0;
-+ struct dst_entry *dst = skb->dst;
-+ struct hh_cache *hh = dst->hh;
-+ struct net_device *dev = dst->dev;
-+ int hh_len = LL_RESERVED_SPACE(dev);
-+
-+ /* Be paranoid, rather than too clever. */
-+ if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
-+ struct sk_buff *skb2;
-+
-+ skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
-+ if (skb2 == NULL) {
-+ kfree_skb(skb);
-+ return;
-+ }
-+ if (skb->sk)
-+ skb_set_owner_w(skb2, skb->sk);
-+ kfree_skb(skb);
-+ skb = skb2;
-+ }
-+
-+ if (hh) {
-+ int hh_alen;
-+
-+ read_lock_bh(&hh->hh_lock);
-+ hh_alen = HH_DATA_ALIGN(hh->hh_len);
-+ memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
-+ read_unlock_bh(&hh->hh_lock);
-+ skb_push(skb, hh->hh_len);
-+ hh->hh_output(skb);
-+ } else if (dst->neighbour)
-+ dst->neighbour->output(skb);
-+ else {
-+ if (net_ratelimit())
-+ DEBUGP(KERN_DEBUG "ipt_ROUTE: no hdr & no neighbour cache!\n");
-+ kfree_skb(skb);
-+ }
++ struct dst_entry *dst = skb->dst;
++ struct hh_cache *hh = dst->hh;
++ struct net_device *dev = dst->dev;
++ int hh_len = LL_RESERVED_SPACE(dev);
++
++ /* Be paranoid, rather than too clever. */
++ if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
++ struct sk_buff *skb2;
++
++ skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
++ if (skb2 == NULL) {
++ kfree_skb(skb);
++ return;
++ }
++ if (skb->sk)
++ skb_set_owner_w(skb2, skb->sk);
++ kfree_skb(skb);
++ skb = skb2;
++ }
++
++ if (hh) {
++ int hh_alen;
++
++ read_lock_bh(&hh->hh_lock);
++ hh_alen = HH_DATA_ALIGN(hh->hh_len);
++ memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
++ read_unlock_bh(&hh->hh_lock);
++ skb_push(skb, hh->hh_len);
++ hh->hh_output(skb);
++ } else if (dst->neighbour)
++ dst->neighbour->output(skb);
++ else {
++ if (net_ratelimit())
++ DEBUGP(KERN_DEBUG "ipt_ROUTE: no hdr & no neighbour cache!\n");
++ kfree_skb(skb);
++ }
-+ unsigned int ifindex = 0;
-+ struct net_device *dev_out = NULL;
-+
-+ /* The user set the interface name to use.
-+ * Getting the current interface index.
-+ */
-+ if ((dev_out = dev_get_by_name(route_info->oif))) {
-+ ifindex = dev_out->ifindex;
-+ } else {
-+ /* Unknown interface name : packet dropped */
-+ if (net_ratelimit())
-+ DEBUGP("ipt_ROUTE: oif interface %s not found\n", route_info->oif);
-+ return NF_DROP;
-+ }
-+
-+ /* Trying the standard way of routing packets */
-+ switch (route(skb, ifindex, route_info)) {
-+ case 1:
-+ dev_put(dev_out);
-+ if (route_info->flags & IPT_ROUTE_CONTINUE)
-+ return IPT_CONTINUE;
-+
-+ ip_direct_send(skb);
-+ return NF_STOLEN;
-+
-+ case 0:
-+ /* Failed to send to oif. Trying the hard way */
-+ if (route_info->flags & IPT_ROUTE_CONTINUE)
-+ return NF_DROP;
-+
-+ if (net_ratelimit())
-+ DEBUGP("ipt_ROUTE: forcing the use of %i\n",
-+ ifindex);
-+
-+ /* We have to force the use of an interface.
-+ * This interface must be a tunnel interface since
-+ * otherwise we can't guess the hw address for
-+ * the packet. For a tunnel interface, no hw address
-+ * is needed.
-+ */
-+ if ((dev_out->type != ARPHRD_TUNNEL)
-+ && (dev_out->type != ARPHRD_IPGRE)) {
-+ if (net_ratelimit())
-+ DEBUGP("ipt_ROUTE: can't guess the hw addr !\n");
-+ dev_put(dev_out);
-+ return NF_DROP;
-+ }
-+
-+ /* Send the packet. This will also free skb
-+ * Do not go through the POST_ROUTING hook because
-+ * skb->dst is not set and because it will probably
-+ * get confused by the destination IP address.
-+ */
-+ skb->dev = dev_out;
-+ dev_direct_send(skb);
-+ dev_put(dev_out);
-+ return NF_STOLEN;
-+
-+ default:
-+ /* Unexpected error */
-+ dev_put(dev_out);
-+ return NF_DROP;
-+ }
++ unsigned int ifindex = 0;
++ struct net_device *dev_out = NULL;
++
++ /* The user set the interface name to use.
++ * Getting the current interface index.
++ */
++ if ((dev_out = dev_get_by_name(route_info->oif))) {
++ ifindex = dev_out->ifindex;
++ } else {
++ /* Unknown interface name : packet dropped */
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: oif interface %s not found\n", route_info->oif);
++ return NF_DROP;
++ }
++
++ /* Trying the standard way of routing packets */
++ switch (route(skb, ifindex, route_info)) {
++ case 1:
++ dev_put(dev_out);
++ if (route_info->flags & IPT_ROUTE_CONTINUE)
++ return IPT_CONTINUE;
++
++ ip_direct_send(skb);
++ return NF_STOLEN;
++
++ case 0:
++ /* Failed to send to oif. Trying the hard way */
++ if (route_info->flags & IPT_ROUTE_CONTINUE)
++ return NF_DROP;
++
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: forcing the use of %i\n",
++ ifindex);
++
++ /* We have to force the use of an interface.
++ * This interface must be a tunnel interface since
++ * otherwise we can't guess the hw address for
++ * the packet. For a tunnel interface, no hw address
++ * is needed.
++ */
++ if ((dev_out->type != ARPHRD_TUNNEL)
++ && (dev_out->type != ARPHRD_IPGRE)) {
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: can't guess the hw addr !\n");
++ dev_put(dev_out);
++ return NF_DROP;
++ }
++
++ /* Send the packet. This will also free skb
++ * Do not go through the POST_ROUTING hook because
++ * skb->dst is not set and because it will probably
++ * get confused by the destination IP address.
++ */
++ skb->dev = dev_out;
++ dev_direct_send(skb);
++ dev_put(dev_out);
++ return NF_STOLEN;
++
++ default:
++ /* Unexpected error */
++ dev_put(dev_out);
++ return NF_DROP;
++ }
-+ const struct ipt_route_target_info *route_info = targinfo;
-+ struct sk_buff *skb = *pskb;
-+ unsigned int res;
-+
-+ if (skb->nfct == &route_tee_track.ct_general) {
-+ /* Loopback - a packet we already routed, is to be
-+ * routed another time. Avoid that, now.
-+ */
-+ if (net_ratelimit())
-+ DEBUGP(KERN_DEBUG "ipt_ROUTE: loopback - DROP!\n");
-+ return NF_DROP;
-+ }
-+
-+ /* If we are at PREROUTING or INPUT hook
-+ * the TTL isn't decreased by the IP stack
-+ */
-+ if (hooknum == NF_IP_PRE_ROUTING ||
-+ hooknum == NF_IP_LOCAL_IN) {
-+
-+ struct iphdr *iph = skb->nh.iph;
-+
-+ if (iph->ttl <= 1) {
-+ struct rtable *rt;
-+ struct flowi fl = {
-+ .oif = 0,
-+ .nl_u = {
-+ .ip4_u = {
-+ .daddr = iph->daddr,
-+ .saddr = iph->saddr,
-+ .tos = RT_TOS(iph->tos),
-+ .scope = ((iph->tos & RTO_ONLINK) ?
-+ RT_SCOPE_LINK :
-+ RT_SCOPE_UNIVERSE)
-+ }
-+ }
-+ };
-+
-+ if (ip_route_output_key(&rt, &fl)) {
-+ return NF_DROP;
-+ }
-+
-+ if (skb->dev == rt->u.dst.dev) {
-+ /* Drop old route. */
-+ dst_release(skb->dst);
-+ skb->dst = &rt->u.dst;
-+
-+ /* this will traverse normal stack, and
-+ * thus call conntrack on the icmp packet */
-+ icmp_send(skb, ICMP_TIME_EXCEEDED,
-+ ICMP_EXC_TTL, 0);
-+ }
-+
-+ return NF_DROP;
-+ }
-+
-+ /*
-+ * If we are at INPUT the checksum must be recalculated since
-+ * the length could change as the result of a defragmentation.
-+ */
-+ if(hooknum == NF_IP_LOCAL_IN) {
-+ iph->ttl = iph->ttl - 1;
-+ iph->check = 0;
-+ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
-+ } else {
-+ ip_decrease_ttl(iph);
-+ }
-+ }
-+
-+ if ((route_info->flags & IPT_ROUTE_TEE)) {
-+ /*
-+ * Copy the *pskb, and route the copy. Will later return
-+ * IPT_CONTINUE for the original skb, which should continue
-+ * on its way as if nothing happened. The copy should be
-+ * independantly delivered to the ROUTE --gw.
-+ */
-+ skb = skb_copy(*pskb, GFP_ATOMIC);
-+ if (!skb) {
-+ if (net_ratelimit())
-+ DEBUGP(KERN_DEBUG "ipt_ROUTE: copy failed!\n");
-+ return IPT_CONTINUE;
-+ }
-+ }
-+
-+ /* Tell conntrack to forget this packet since it may get confused
-+ * when a packet is leaving with dst address == our address.
-+ * Good idea ? Dunno. Need advice.
-+ *
-+ * NEW: mark the skb with our &route_tee_track, so we avoid looping
-+ * on any already routed packet.
-+ */
-+ if (!(route_info->flags & IPT_ROUTE_CONTINUE)) {
-+ nf_conntrack_put(skb->nfct);
-+ skb->nfct = &route_tee_track.ct_general;
-+ skb->nfctinfo = IP_CT_NEW;
-+ nf_conntrack_get(skb->nfct);
-+ }
-+
-+ if (route_info->oif[0] != '\0') {
-+ res = route_oif(route_info, skb);
-+ } else if (route_info->iif[0] != '\0') {
-+ res = route_iif(route_info, skb);
-+ } else if (route_info->gw) {
-+ res = route_gw(route_info, skb);
-+ } else {
-+ if (net_ratelimit())
-+ DEBUGP(KERN_DEBUG "ipt_ROUTE: no parameter !\n");
-+ res = IPT_CONTINUE;
-+ }
-+
-+ if ((route_info->flags & IPT_ROUTE_TEE))
-+ res = IPT_CONTINUE;
-+
-+ return res;
++ const struct ipt_route_target_info *route_info = targinfo;
++ struct sk_buff *skb = *pskb;
++ unsigned int res;
++
++ if (skb->nfct == &route_tee_track.ct_general) {
++ /* Loopback - a packet we already routed, is to be
++ * routed another time. Avoid that, now.
++ */
++ if (net_ratelimit())
++ DEBUGP(KERN_DEBUG "ipt_ROUTE: loopback - DROP!\n");
++ return NF_DROP;
++ }
++
++ /* If we are at PREROUTING or INPUT hook
++ * the TTL isn't decreased by the IP stack
++ */
++ if (hooknum == NF_IP_PRE_ROUTING ||
++ hooknum == NF_IP_LOCAL_IN) {
++
++ struct iphdr *iph = skb->nh.iph;
++
++ if (iph->ttl <= 1) {
++ struct rtable *rt;
++ struct flowi fl = {
++ .oif = 0,
++ .nl_u = {
++ .ip4_u = {
++ .daddr = iph->daddr,
++ .saddr = iph->saddr,
++ .tos = RT_TOS(iph->tos),
++ .scope = ((iph->tos & RTO_ONLINK) ?
++ RT_SCOPE_LINK :
++ RT_SCOPE_UNIVERSE)
++ }
++ }
++ };
++
++ if (ip_route_output_key(&rt, &fl)) {
++ return NF_DROP;
++ }
++
++ if (skb->dev == rt->u.dst.dev) {
++ /* Drop old route. */
++ dst_release(skb->dst);
++ skb->dst = &rt->u.dst;
++
++ /* this will traverse normal stack, and
++ * thus call conntrack on the icmp packet */
++ icmp_send(skb, ICMP_TIME_EXCEEDED,
++ ICMP_EXC_TTL, 0);
++ }
++
++ return NF_DROP;
++ }
++
++ /*
++ * If we are at INPUT the checksum must be recalculated since
++ * the length could change as the result of a defragmentation.
++ */
++ if(hooknum == NF_IP_LOCAL_IN) {
++ iph->ttl = iph->ttl - 1;
++ iph->check = 0;
++ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
++ } else {
++ ip_decrease_ttl(iph);
++ }
++ }
++
++ if ((route_info->flags & IPT_ROUTE_TEE)) {
++ /*
++ * Copy the *pskb, and route the copy. Will later return
++ * IPT_CONTINUE for the original skb, which should continue
++ * on its way as if nothing happened. The copy should be
++ * independantly delivered to the ROUTE --gw.
++ */
++ skb = skb_copy(*pskb, GFP_ATOMIC);
++ if (!skb) {
++ if (net_ratelimit())
++ DEBUGP(KERN_DEBUG "ipt_ROUTE: copy failed!\n");
++ return IPT_CONTINUE;
++ }
++ }
++
++ /* Tell conntrack to forget this packet since it may get confused
++ * when a packet is leaving with dst address == our address.
++ * Good idea ? Dunno. Need advice.
++ *
++ * NEW: mark the skb with our &route_tee_track, so we avoid looping
++ * on any already routed packet.
++ */
++ if (!(route_info->flags & IPT_ROUTE_CONTINUE)) {
++ nf_conntrack_put(skb->nfct);
++ skb->nfct = &route_tee_track.ct_general;
++ skb->nfctinfo = IP_CT_NEW;
++ nf_conntrack_get(skb->nfct);
++ }
++
++ if (route_info->oif[0] != '\0') {
++ res = route_oif(route_info, skb);
++ } else if (route_info->iif[0] != '\0') {
++ res = route_iif(route_info, skb);
++ } else if (route_info->gw) {
++ res = route_gw(route_info, skb);
++ } else {
++ if (net_ratelimit())
++ DEBUGP(KERN_DEBUG "ipt_ROUTE: no parameter !\n");
++ res = IPT_CONTINUE;
++ }
++
++ if ((route_info->flags & IPT_ROUTE_TEE))
++ res = IPT_CONTINUE;
++
++ return res;
-+ if (strcmp(tablename, "mangle") != 0) {
-+ printk("ipt_ROUTE: bad table `%s', use the `mangle' table.\n",
-+ tablename);
-+ return 0;
-+ }
-+
-+ if (hook_mask & ~( (1 << NF_IP_PRE_ROUTING)
-+ | (1 << NF_IP_LOCAL_IN)
-+ | (1 << NF_IP_FORWARD)
-+ | (1 << NF_IP_LOCAL_OUT)
-+ | (1 << NF_IP_POST_ROUTING))) {
-+ printk("ipt_ROUTE: bad hook\n");
-+ return 0;
-+ }
-+
-+ return 1;
++ if (strcmp(tablename, "mangle") != 0) {
++ printk("ipt_ROUTE: bad table `%s', use the `mangle' table.\n",
++ tablename);
++ return 0;
++ }
++
++ if (hook_mask & ~( (1 << NF_IP_PRE_ROUTING)
++ | (1 << NF_IP_LOCAL_IN)
++ | (1 << NF_IP_FORWARD)
++ | (1 << NF_IP_LOCAL_OUT)
++ | (1 << NF_IP_POST_ROUTING))) {
++ printk("ipt_ROUTE: bad hook\n");
++ return 0;
++ }
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
++ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_route_target_info))) {
++ printk(KERN_WARNING "ipt_ROUTE: targinfosize %u != %Zu\n",
++ targinfosize,
++ IPT_ALIGN(sizeof(struct ipt_route_target_info)));
++ return 0;
++ }
++#endif
++
++ return 1;
-+ tristate 'ROUTE target support'
-+ depends on IP_NF_MANGLE
-+ help
-+ This option adds a `ROUTE' target, which enables you to setup unusual
-+ routes. For example, the ROUTE lets you route a received packet through
-+ an interface or towards a host, even if the regular destination of the
-+ packet is the router itself. The ROUTE target is also able to change the
-+ incoming interface of a packet.
-+
-+ The target can be or not a final target. It has to be used inside the
-+ mangle table.
-+
-+ If you want to compile it as a module, say M here and read
-+ Documentation/modules.txt. The module will be called ipt_ROUTE.o.
-+ If unsure, say `N'.
-+
- config IP_NF_TARGET_NETMAP
- tristate "NETMAP target support"
- depends on IP_NF_NAT
-diff -urN linux-2.6.19.old/net/ipv4/netfilter/Makefile linux-2.6.19.dev/net/ipv4/netfilter/Makefile
---- linux-2.6.19.old/net/ipv4/netfilter/Makefile 2006-12-14 03:13:49.000000000 +0100
-+++ linux-2.6.19.dev/net/ipv4/netfilter/Makefile 2006-12-14 03:13:49.000000000 +0100
-@@ -74,6 +74,7 @@
++ tristate 'ROUTE target support'
++ depends on IP_NF_MANGLE
++ help
++ This option adds a `ROUTE' target, which enables you to setup unusual
++ routes. For example, the ROUTE lets you route a received packet through
++ an interface or towards a host, even if the regular destination of the
++ packet is the router itself. The ROUTE target is also able to change the
++ incoming interface of a packet.
++
++ The target can be or not a final target. It has to be used inside the
++ mangle table.
++
++ If you want to compile it as a module, say M here and read
++ Documentation/modules.txt. The module will be called ipt_ROUTE.o.
++ If unsure, say `N'.
++
+ endmenu
+
+diff -urN linux-2.6.21.1.old/net/ipv4/netfilter/Makefile linux-2.6.21.1.dev/net/ipv4/netfilter/Makefile
+--- linux-2.6.21.1.old/net/ipv4/netfilter/Makefile 2007-05-26 20:37:08.735892520 +0200
++++ linux-2.6.21.1.dev/net/ipv4/netfilter/Makefile 2007-05-26 20:37:09.002851936 +0200
+@@ -103,6 +103,7 @@
-+ ntohs((addr).s6_addr16[0]), \
-+ ntohs((addr).s6_addr16[1]), \
-+ ntohs((addr).s6_addr16[2]), \
-+ ntohs((addr).s6_addr16[3]), \
-+ ntohs((addr).s6_addr16[4]), \
-+ ntohs((addr).s6_addr16[5]), \
-+ ntohs((addr).s6_addr16[6]), \
-+ ntohs((addr).s6_addr16[7])
++ ntohs((addr).s6_addr16[0]), \
++ ntohs((addr).s6_addr16[1]), \
++ ntohs((addr).s6_addr16[2]), \
++ ntohs((addr).s6_addr16[3]), \
++ ntohs((addr).s6_addr16[4]), \
++ ntohs((addr).s6_addr16[5]), \
++ ntohs((addr).s6_addr16[6]), \
++ ntohs((addr).s6_addr16[7])
-+ struct rt6_info *rt = NULL;
-+ struct ipv6hdr *ipv6h = skb->nh.ipv6h;
-+ struct in6_addr *gw = (struct in6_addr*)&route_info->gw;
-+
-+ DEBUGP("ip6t_ROUTE: called with: ");
-+ DEBUGP("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(ipv6h->daddr));
-+ DEBUGP("GATEWAY=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(*gw));
-+ DEBUGP("OUT=%s\n", route_info->oif);
-+
-+ if (ipv6_addr_any(gw))
-+ rt = rt6_lookup(&ipv6h->daddr, &ipv6h->saddr, ifindex, 1);
-+ else
-+ rt = rt6_lookup(gw, &ipv6h->saddr, ifindex, 1);
-+
-+ if (!rt)
-+ goto no_route;
-+
-+ DEBUGP("ip6t_ROUTE: routing gives: ");
-+ DEBUGP("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(rt->rt6i_dst.addr));
-+ DEBUGP("GATEWAY=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(rt->rt6i_gateway));
-+ DEBUGP("OUT=%s\n", rt->rt6i_dev->name);
-+
-+ if (ifindex && rt->rt6i_dev->ifindex!=ifindex)
-+ goto wrong_route;
-+
-+ if (!rt->rt6i_nexthop) {
-+ DEBUGP("ip6t_ROUTE: discovering neighbour\n");
-+ rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_dst.addr);
-+ }
-+
-+ /* Drop old route. */
-+ dst_release(skb->dst);
-+ skb->dst = &rt->u.dst;
-+ skb->dev = rt->rt6i_dev;
-+ return 1;
++ struct rt6_info *rt = NULL;
++ struct ipv6hdr *ipv6h = skb->nh.ipv6h;
++ struct in6_addr *gw = (struct in6_addr*)&route_info->gw;
++
++ DEBUGP("ip6t_ROUTE: called with: ");
++ DEBUGP("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(ipv6h->daddr));
++ DEBUGP("GATEWAY=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(*gw));
++ DEBUGP("OUT=%s\n", route_info->oif);
++
++ if (ipv6_addr_any(gw))
++ rt = rt6_lookup(&ipv6h->daddr, &ipv6h->saddr, ifindex, 1);
++ else
++ rt = rt6_lookup(gw, &ipv6h->saddr, ifindex, 1);
++
++ if (!rt)
++ goto no_route;
++
++ DEBUGP("ip6t_ROUTE: routing gives: ");
++ DEBUGP("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(rt->rt6i_dst.addr));
++ DEBUGP("GATEWAY=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(rt->rt6i_gateway));
++ DEBUGP("OUT=%s\n", rt->rt6i_dev->name);
++
++ if (ifindex && rt->rt6i_dev->ifindex!=ifindex)
++ goto wrong_route;
++
++ if (!rt->rt6i_nexthop) {
++ DEBUGP("ip6t_ROUTE: discovering neighbour\n");
++ rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_dst.addr);
++ }
++
++ /* Drop old route. */
++ dst_release(skb->dst);
++ skb->dst = &rt->u.dst;
++ skb->dev = rt->rt6i_dev;
++ return 1;
-+ struct dst_entry *dst = skb->dst;
-+ struct hh_cache *hh = dst->hh;
-+
-+ if (hh) {
-+ read_lock_bh(&hh->hh_lock);
-+ memcpy(skb->data - 16, hh->hh_data, 16);
-+ read_unlock_bh(&hh->hh_lock);
-+ skb_push(skb, hh->hh_len);
-+ hh->hh_output(skb);
-+ } else if (dst->neighbour)
-+ dst->neighbour->output(skb);
-+ else {
-+ if (net_ratelimit())
-+ DEBUGP(KERN_DEBUG "ip6t_ROUTE: no hdr & no neighbour cache!\n");
-+ kfree_skb(skb);
-+ }
++ struct dst_entry *dst = skb->dst;
++ struct hh_cache *hh = dst->hh;
++
++ if (hh) {
++ read_lock_bh(&hh->hh_lock);
++ memcpy(skb->data - 16, hh->hh_data, 16);
++ read_unlock_bh(&hh->hh_lock);
++ skb_push(skb, hh->hh_len);
++ hh->hh_output(skb);
++ } else if (dst->neighbour)
++ dst->neighbour->output(skb);
++ else {
++ if (net_ratelimit())
++ DEBUGP(KERN_DEBUG "ip6t_ROUTE: no hdr & no neighbour cache!\n");
++ kfree_skb(skb);
++ }
-+ unsigned int ifindex = 0;
-+ struct net_device *dev_out = NULL;
-+
-+ /* The user set the interface name to use.
-+ * Getting the current interface index.
-+ */
-+ if ((dev_out = dev_get_by_name(route_info->oif))) {
-+ ifindex = dev_out->ifindex;
-+ } else {
-+ /* Unknown interface name : packet dropped */
-+ if (net_ratelimit())
-+ DEBUGP("ip6t_ROUTE: oif interface %s not found\n", route_info->oif);
-+
-+ if (route_info->flags & IP6T_ROUTE_CONTINUE)
-+ return IP6T_CONTINUE;
-+ else
-+ return NF_DROP;
-+ }
-+
-+ /* Trying the standard way of routing packets */
-+ if (route6(skb, ifindex, route_info)) {
-+ dev_put(dev_out);
-+ if (route_info->flags & IP6T_ROUTE_CONTINUE)
-+ return IP6T_CONTINUE;
-+
-+ ip_direct_send(skb);
-+ return NF_STOLEN;
-+ } else
-+ return NF_DROP;
++ unsigned int ifindex = 0;
++ struct net_device *dev_out = NULL;
++
++ /* The user set the interface name to use.
++ * Getting the current interface index.
++ */
++ if ((dev_out = dev_get_by_name(route_info->oif))) {
++ ifindex = dev_out->ifindex;
++ } else {
++ /* Unknown interface name : packet dropped */
++ if (net_ratelimit())
++ DEBUGP("ip6t_ROUTE: oif interface %s not found\n", route_info->oif);
++
++ if (route_info->flags & IP6T_ROUTE_CONTINUE)
++ return IP6T_CONTINUE;
++ else
++ return NF_DROP;
++ }
++
++ /* Trying the standard way of routing packets */
++ if (route6(skb, ifindex, route_info)) {
++ dev_put(dev_out);
++ if (route_info->flags & IP6T_ROUTE_CONTINUE)
++ return IP6T_CONTINUE;
++
++ ip_direct_send(skb);
++ return NF_STOLEN;
++ } else
++ return NF_DROP;
-+ const struct ip6t_route_target_info *route_info = targinfo;
-+ struct sk_buff *skb = *pskb;
-+ struct in6_addr *gw = (struct in6_addr*)&route_info->gw;
-+ unsigned int res;
-+
-+ if (route_info->flags & IP6T_ROUTE_CONTINUE)
-+ goto do_it;
-+
-+ /* If we are at PREROUTING or INPUT hook
-+ * the TTL isn't decreased by the IP stack
-+ */
-+ if (hooknum == NF_IP6_PRE_ROUTING ||
-+ hooknum == NF_IP6_LOCAL_IN) {
-+
-+ struct ipv6hdr *ipv6h = skb->nh.ipv6h;
-+
-+ if (ipv6h->hop_limit <= 1) {
-+ /* Force OUTPUT device used as source address */
-+ skb->dev = skb->dst->dev;
-+
-+ icmpv6_send(skb, ICMPV6_TIME_EXCEED,
-+ ICMPV6_EXC_HOPLIMIT, 0, skb->dev);
-+
-+ return NF_DROP;
-+ }
-+
-+ ipv6h->hop_limit--;
-+ }
-+
-+ if ((route_info->flags & IP6T_ROUTE_TEE)) {
-+ /*
-+ * Copy the *pskb, and route the copy. Will later return
-+ * IP6T_CONTINUE for the original skb, which should continue
-+ * on its way as if nothing happened. The copy should be
-+ * independantly delivered to the ROUTE --gw.
-+ */
-+ skb = skb_copy(*pskb, GFP_ATOMIC);
-+ if (!skb) {
-+ if (net_ratelimit())
-+ DEBUGP(KERN_DEBUG "ip6t_ROUTE: copy failed!\n");
-+ return IP6T_CONTINUE;
-+ }
-+ }
++ const struct ip6t_route_target_info *route_info = targinfo;
++ struct sk_buff *skb = *pskb;
++ struct in6_addr *gw = (struct in6_addr*)&route_info->gw;
++ unsigned int res;
++
++ if (route_info->flags & IP6T_ROUTE_CONTINUE)
++ goto do_it;
++
++ /* If we are at PREROUTING or INPUT hook
++ * the TTL isn't decreased by the IP stack
++ */
++ if (hooknum == NF_IP6_PRE_ROUTING ||
++ hooknum == NF_IP6_LOCAL_IN) {
++
++ struct ipv6hdr *ipv6h = skb->nh.ipv6h;
++
++ if (ipv6h->hop_limit <= 1) {
++ /* Force OUTPUT device used as source address */
++ skb->dev = skb->dst->dev;
++
++ icmpv6_send(skb, ICMPV6_TIME_EXCEED,
++ ICMPV6_EXC_HOPLIMIT, 0, skb->dev);
++
++ return NF_DROP;
++ }
++
++ ipv6h->hop_limit--;
++ }
++
++ if ((route_info->flags & IP6T_ROUTE_TEE)) {
++ /*
++ * Copy the *pskb, and route the copy. Will later return
++ * IP6T_CONTINUE for the original skb, which should continue
++ * on its way as if nothing happened. The copy should be
++ * independantly delivered to the ROUTE --gw.
++ */
++ skb = skb_copy(*pskb, GFP_ATOMIC);
++ if (!skb) {
++ if (net_ratelimit())
++ DEBUGP(KERN_DEBUG "ip6t_ROUTE: copy failed!\n");
++ return IP6T_CONTINUE;
++ }
++ }
-+ tristate "ROUTE target support"
-+ depends on IP6_NF_MANGLE
-+ help
-+ This option adds a `ROUTE' target, which enables you to setup unusual
-+ routes. The ROUTE target is also able to change the incoming interface
-+ of a packet.
-+
-+ The target can be or not a final target. It has to be used inside the
-+ mangle table.
-+
-+ Not working as a module.
-+
- config IP6_NF_MANGLE
- tristate "Packet mangling"
- depends on IP6_NF_IPTABLES
-diff -urN linux-2.6.19.old/net/ipv6/netfilter/Makefile linux-2.6.19.dev/net/ipv6/netfilter/Makefile
---- linux-2.6.19.old/net/ipv6/netfilter/Makefile 2006-12-14 03:13:49.000000000 +0100
-+++ linux-2.6.19.dev/net/ipv6/netfilter/Makefile 2006-12-14 03:13:49.000000000 +0100
++ tristate 'ROUTE target support'
++ depends on IP6_NF_MANGLE
++ help
++ This option adds a `ROUTE' target, which enables you to setup unusual
++ routes. The ROUTE target is also able to change the incoming interface
++ of a packet.
++
++ The target can be or not a final target. It has to be used inside the
++ mangle table.
++
++ Not working as a module.
++
+ endmenu
+
+diff -urN linux-2.6.21.1.old/net/ipv6/netfilter/Makefile linux-2.6.21.1.dev/net/ipv6/netfilter/Makefile
+--- linux-2.6.21.1.old/net/ipv6/netfilter/Makefile 2007-05-26 20:37:08.809881272 +0200
++++ linux-2.6.21.1.dev/net/ipv6/netfilter/Makefile 2007-05-26 20:37:09.003851784 +0200