IPROUTE compilation problem
Hello,
The IPROUTE patch failed to build (latest CVS + 2.6.6):
CC [M] net/ipv4/netfilter/ipt_ROUTE.onet/ipv4/netfilter/ipt_ROUTE.c: In function `route':net/ipv4/netfilter/ipt_ROUTE.c:56: error: variable key' has initializer but incomplete type net/ipv4/netfilter/ipt_ROUTE.c:57: error: unknown field dst' specified in initializer net/ipv4/netfilter/ipt_ROUTE.c:57: warning: excess elements in struct initializer net/ipv4/netfilter/ipt_ROUTE.c:57: warning: (near initialization for key') net/ipv4/netfilter/ipt_ROUTE.c:58: error: unknown field src' specified in initializer net/ipv4/netfilter/ipt_ROUTE.c:58: warning: excess elements in struct initializer net/ipv4/netfilter/ipt_ROUTE.c:58: warning: (near initialization for key') net/ipv4/netfilter/ipt_ROUTE.c:59: error: unknown field oif' specified in initializer net/ipv4/netfilter/ipt_ROUTE.c:59: warning: excess elements in struct initializer net/ipv4/netfilter/ipt_ROUTE.c:59: warning: (near initialization for key') net/ipv4/netfilter/ipt_ROUTE.c:60: error: unknown field tos' specified in initializer net/ipv4/netfilter/ipt_ROUTE.c:61: warning: excess elements in struct initializer net/ipv4/netfilter/ipt_ROUTE.c:61: warning: (near initialization for key') net/ipv4/netfilter/ipt_ROUTE.c:56: error: storage size of key' isn't known net/ipv4/netfilter/ipt_ROUTE.c:56: warning: unused variable key' net/ipv4/netfilter/ipt_ROUTE.c: In function ipt_route_target':net/ipv4/netfilter/ipt_ROUTE.c:262: warning: implicit declaration of function `ip_route_output' make[4]: *** [net/ipv4/netfilter/ipt_ROUTE.o] Error 1
make[3]: *** [net/ipv4/netfilter] Error 2
Thanks
Signature · 3 lines
Daniel 'NebuchadnezzaR' Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x4CA73DC6
Quoted 3 lines · Daniel Dehennin
Hello,
The IPROUTE patch failed to build (latest CVS + 2.6.6):
I read the help of the ipv4 and ipv6 route extension, in v6 it says that it's not working as a module (so a bug in Kconfig entry cause I set it to a module ?)
Noting particuliar in v4.
Signature · 3 lines
Daniel 'NebuchadnezzaR' Dehennin Récupérer ma clef GPG: gpg --keyserver pgp.mit.edu --recv-keys 0x4CA73DC6
PATCH 1/1 ipt_ROUTE fix for 2.6 kernels [was: IPROUTE compilation problem]
In reply to Daniel 'NebuchadnezzaR' DehenninQuoted 1 line · Daniel 'NebuchadnezzaR' Dehennin
The IPROUTE patch failed to build (latest CVS + 2.6.6):
Yes, I know. The ROUTE target is not yet converted to kernel 2.6 series. Here is a patch that updates it.
Changes include :
- conversion from struct rt_key to struct flowi
- checksum fix from Rickard Molin
Please apply ;)
Thanks,
Cedric
ROUTE/linux-2.6/net/ipv4/netfilter/ipt_ROUTE.c renamed from ROUTE/linux-2.6/net/ipv4/netfilter/ipt_ROUTE.c.orig +41 -13
@@ -4,7 +4,7 @@* * Copyright (C) 2002 Cedric de Launois <[email protected]> * -* v 1.8 2003/07/25 +* v 1.9 2004/05/14 * * This software is distributed under GNU GPL v2, 1991 */
@@ -19,6 +19,7 @@#include <net/ip.h> #include <net/route.h> #include <net/icmp.h> +#include <net/checksum.h> #if 0 #define DEBUGP printk
@@ -28,6 +29,7 @@MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Cedric de Launois <[email protected]>" ); +MODULE_DESCRIPTION ("iptables ROUTE target module" );/* Try to route the packet according to the routing keys specified in * route_info. Keys are :
@@ -53,19 +55,24 @@int err;struct rtable *rt;struct iphdr *iph = skb->nh.iph; -struct rt_key key = { - dst:iph->daddr, - src:0 , - oif:ifindex, - tos:RT_TOS (iph->tos) +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) - key.dst = route_info->gw; + fl.fld_dst = route_info->gw;/* Trying to route the packet using the standard routing table. */ -if ((err =ip_route_output_key (&rt, &key))) { +if ((err =ip_route_output_key (&rt, &fl))) {if (net_ratelimit ())DEBUGP ("ipt_ROUTE: couldn't route pkt (err: %i)" ,err);return -1 ;
@@ -217,7 +224,7 @@ skb->dev = dev_in;dst_release (skb->dst); skb->dst =NULL ; - +netif_rx (skb);dev_put (dev_in);return NF_STOLEN ;
@@ -258,10 +265,21 @@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 (&rt, iph->saddr, iph->daddr, -RT_TOS (iph->tos) |RTO_CONN , -0 )) { +if (ip_route_output_key (&rt, &fl)) {return NF_DROP ; }
@@ -279,7 +297,17 @@return NF_DROP ; } -ip_decrease_ttl (iph); +/* +* 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); + } }/* Tell conntrack to forget this packet since it may get confused
Re: [PATCH] ipt_ROUTE fix for 2.6 kernels [was: IPROUTE compilation problem]
Quoted 10 lines · Cedric de Launois
Quoted 1 line · Daniel 'NebuchadnezzaR' Dehennin
The IPROUTE patch failed to build (latest CVS + 2.6.6):
Yes, I know. The ROUTE target is not yet converted to kernel 2.6 series. Here is a patch that updates it.
Changes include :
- conversion from structrt_keyto struct flowi
- checksum fix from Rickard MolinPlease apply ;)
Patch is applied, thank you Cedric.
Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary