i had a similar problem where in i was using SKB_PUSH to add extra header,,,, i used this... structure called flowi.... which can be used to define a sort of traffic class...based on some combination of fields<div><br><div>
<br></div><div><div>iph->daddr =htonl(xxxxxx);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>struct rtable *rt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>struct flowi fl;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>memset(&fl, 0x0, sizeof(struct flowi));</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>fl.fl4_dst = htonl(xxxxxxx);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>fl.proto = IPPROTO_TCP;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>if (!ip_route_output_key(&init_net, &rt, &fl)) </div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>iph->saddr= htonl(ntohl(rt->rt_src)); </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>skb_dst_set(skb2, &rt->u.dst);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div></div><div><br><br><div class="gmail_quote">
On Mon, Apr 2, 2012 at 2:12 PM, Kesava Srinivas <span dir="ltr"><<a href="mailto:vunnavafuture@gmail.com">vunnavafuture@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font face="courier new,monospace">HI Friends,<br>Looking for a Confirmation on my analysis. <br><br>Once after Capturing the Socket Buffer in PRE_ROUTING Hook; Manipulated the Socket Buffer by using the "skb_pull" Kernel Function. Using skb_pull; stripped 28 bytes (IP+UDP) which are the Part of outer UDP/IP Header. Now; My intention was to route the skb based on the Inner IP Header which is sitting after stripping 28 bytes. At the END; returned NF_ACCEPT.<br>
<br>Even though; skb_pull worked Fine., Kernel's Stack is still looking in to Outer Header only for Routing the Packet.I expected ;Kernel will look the Inner Header (As data Pointer was incremented by 28 bytes via skb_pull) and Take decision based on the Inner one. But; that didn't happened. It looks to me like; we need to always use NF_STOLEN & should write our own code to route based on the INNER HEADER. Was my conclusion correct ??<br>
<br clear="all"></font><span style="font-family:courier new,monospace">-Thanks in Advance,</span><br><font style="font-family:courier new,monospace" size="2">VKS</font><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"></span><br>
<br>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br></div></div>