Hi I am getting error when getting the 'rt'(route entry) using 'ip_route_output'. I do not know why 'ip_route_output' is failing even when all params are correct and and required route is present for the passed source&dest ip addresses. What value we should give for the field 'tos'. I am passing the params &rt,destIp,SrcIP,0,0. -- venu.m ----- Original Message ----- From: "Ravi Kumar" <ravivsn@rocsys.com> To: "venum" <venum@intoto.com> Cc: <kernelnewbies@nl.linux.org> Sent: Monday, July 05, 2004 3:35 AM Subject: Re: netif_rx dropping the packet > Hi Venu Maya, > May be you know that there are differenet types of NF_HOOKS. If a > firewall wants to hook for packets, generally they do at Pre-routing and > post routing. In the virtual tunnel, you create, the packets will be of > SELF to OUTGOING type. The in and outgoing self packets will defnitely > hit the above hooks. So, you need not bother about Netfilter hooks. You > can use IPTUNNEL_XMIT macro ,defined in ipip.h > > #define IPTUNNEL_XMIT() do { \ > int err; \ > int pkt_len = skb->len; \ > \ > skb->ip_summed = CHECKSUM_NONE; \ > iph->tot_len = htons(skb->len); \ > printk("<1>Total Length:%d\n",skb->len); \ > ip_select_ident(iph, &rt->u.dst, NULL); \ > ip_send_check(iph); \ > err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, > rt->u.dst.dev, do_ip_send); \ > } while (0) > > static inline int do_ip_send(struct sk_buff *skb) > { > return ip_send(skb); > } > > Cheers, > -Ravi > ROCSYS Technologies Ltd., > http://www.rocsys.com > > > venum wrote: > > >Hi Ravi Kumar, > > > >Thanks for the response. > >I am encapsulating the packet in the dummy ethernet device. > >>From the Send function of this dummy device,I am passing the packet to the > >stack using 'netif_rx' so that it will go through all the 'net filter' > >hooks. > >I do not know if I can use 'ip_send' for the same purpose. > > > >--- venu maya > > > >----- Original Message ----- > >From: "Ravi Kumar" <ravivsn@rocsys.com> > >To: "venum" <venum@intoto.com> > >Cc: <kernelnewbies@nl.linux.org> > >Sent: Monday, July 05, 2004 9:52 AM > >Subject: Re: netif_rx dropping the packet > > > > > > > > > >>Hi Venu Maya, > >> There are numerous ways to take in packet. Apart from netfilter hooks, > >>dev_add_pack and ether hooks , packets can also taken by creating dummy > >>ethernet device. > >>As I understand, the problem is in encapsulation module. You would like > >>to see ipip.c/ip_gre.c as a proof of concept. After you attach the IP > >>header+ UDP Header + Your payload, and based on route look up , you get > >>device onto which the packet has to be sent to. use ip_send to send > >>packets to stack. (Refer to ipip.h, you can use IPTUNNEL_XMIT ) > >> > >>/* remember this to set in sk_buff */ > >>skb->dst = &rt->u.dst; > >> > >>Let me know how it goes, > >>-Ravi > >>ROCSYS Technologies Ltd > >>http://www.rocsys.com > >> > >>bhaskar wrote: > >> > >> > >> > >>>Hi, > >>>How did you capture the packet. I mean netfilter hooks, or using > >>>dev_add_pack or .... > >>> > >>>Regards > >>>bhaskar > >>> > >>> > >>>venum wrote: > >>> > >>> > >>> > >>>>Hi > >>>> > >>>>I am facing a problem with the part of kernel code that I am > >>>>developing for > >>>>a linux router. The objective is to encapsulate the received IP > >>>>packet with > >>>>a UDP header and an extra IP header and forward it to a different > >>>>destination. > >>>>I am encapsulating the original packet and passing it to the stack > >>>> > >>>> > >using > > > > > >>>>'netif_rx'. I want the stack to forward the packet to changed > >>>>destination. > >>>>At the destination the packet will be decapsulated. > >>>>But once the packet is given to the 'netif_rx', stack is dropping the > >>>>packet > >>>>silently. > >>>>I don't know which part of the stack code is dropping the packet. > >>>> > >>>>I need help in debugging this problem.I am giving the following details > >>>>about the encapsulation: > >>>> > >>>>Dump of the ICMP ping packet received: > >>>>0 0 24 c0 2d 63 0 80 48 18 9e 5a 8 0 45 0 > >>>>0 3c 1 cb 0 0 80 1 dc 18 ac 10 2 5c ac 10 > >>>>2 61 8 0 4a 5c 2 0 1 0 61 62 63 64 65 66 > >>>>67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 > >>>>77 61 62 63 64 65 66 67 68 69 > >>>> > >>>>Packet Dump after Encapsulation: This packet is given to stack using > >>>>'netif_rx' > >>>>45 0 0 74 56 34 0 0 f0 11 ba 8b ac 10 16 1 > >>>>ac 10 16 3 d4 31 d4 31 0 8 0 0 1 1 1 11 > >>>>22 33 44 55 66 0 0 0 0 0 0 0 24 c0 2d 63 > >>>>0 80 48 18 9e 5a 8 0 45 0 0 3c 1 cb 0 0 > >>>>80 1 dc 18 ac 10 2 5c ac 10 2 61 8 0 4a 5c > >>>>2 0 1 0 61 62 63 64 65 66 67 68 69 6a 6b 6c > >>>>6d 6e 6f 70 71 72 73 74 75 76 77 61 62 63 64 65 > >>>>66 67 68 69 > >>>>I want this packet to be routed to IP address 172.16.22.3. The required > >>>>route is configured. > >>>>Is any thing wrong in the above encapsulated packet ? > >>>>I am modifiying the follwing skb params: > >>>> > >>>>pSkb->ip_summed = CHECKSUM_UNNECESSARY; > >>>>/* I have tried others like NONE,HW with no improvements > >>>>*/ > >>>> > >>>>pSkb->protocol = htons(ETH_P_IP); > >>>>/* Since it is always an IP packet */ > >>>> > >>>>Can anyone help me find out the problem. I will provide any other > >>>>details if > >>>>required. > >>>> > >>>>TIA, > >>>> venu maya > >>>> > >>>> > >>>> > >>>>-- > >>>>Kernelnewbies: Help each other learn about the Linux kernel. > >>>>Archive: http://mail.nl.linux.org/kernelnewbies/ > >>>>FAQ: http://kernelnewbies.org/faq/ > >>>> > >>>> > >>>> > >>>> > >>>> > >>>-- > >>>Kernelnewbies: Help each other learn about the Linux kernel. > >>>Archive: http://mail.nl.linux.org/kernelnewbies/ > >>>FAQ: http://kernelnewbies.org/faq/ > >>> > >>> > >>> > >> > >> > >>-- > >>Kernelnewbies: Help each other learn about the Linux kernel. > >>Archive: http://mail.nl.linux.org/kernelnewbies/ > >>FAQ: http://kernelnewbies.org/faq/ > >> > >> > > > > > >-- > >Kernelnewbies: Help each other learn about the Linux kernel. > >Archive: http://mail.nl.linux.org/kernelnewbies/ > >FAQ: http://kernelnewbies.org/faq/ > > > > > > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/