<div dir="ltr">On Fri, Feb 22, 2013 at 3:47 PM, Rami Rosen <span dir="ltr"><<a href="mailto:roszenrami@gmail.com" target="_blank">roszenrami@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, Adel,<br>
<br>
You should use<br>
ip_route_output_flow().<br>
For this you should construct a<br>
flowi4 instance.<br>
ip_route_output_flow() is exported via EXPORT_SYMBOL_GPL.<br>
<br>
See for example how this is done in udp_sendmsg().<br>
<br>
Good luck!<br>
<br>
Rami Rosen<br>
<a href="http://ramirose.wix.com/ramirosen" target="_blank">http://ramirose.wix.com/ramirosen</a><br>
<div><div class="h5"><br>
On Fri, Feb 22, 2013 at 2:36 PM, Adel Qodmani <<a href="mailto:mpcadel@gmail.com">mpcadel@gmail.com</a>> wrote:<br>
> Hey,<br>
><br>
> My question is quite simple, I have an sk_buff that I want to transmit, the<br>
> sk_buff is an ICMP message and so far, I've built the headers and set up<br>
> everything.<br>
><br>
> The problem is, when I want to do such a thing, I typically use a function<br>
> called:<br>
> dev_queue_xmit which takes the skb and transmits the packet using the<br>
> net_device specified in the skb; but time time I can't set the net_device, I<br>
> need the packet to go through the routing code and get it sent normally; so<br>
> what function can I use to that?<br>
><br>
> Some notes:<br>
> *The kernel I am working on is 3.2.0-37<br>
> *I am working using Modules, so symbols that are not exported are<br>
> unreachable for me<br>
> *I set the IP header using htons, so my header data is already in network<br>
> byte-order.<br>
><br>
> Regards,<br>
> Adel<br>
><br>
</div></div>> _______________________________________________<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>Hi Rami, </div><div class="gmail_extra" style><br>Using ip_route_output_flow() or using udp_sendmsg() would require not only constructing a flowi4 but also a sock; I am intentionally trying to avoid building a sock at the time being.</div>
<div class="gmail_extra" style>Is there a way I can deliver my sk_buff to the routing code so that it'd set the net_device in there or at least tell me which interface to use and then I'd set it up myself?<br><br>
</div><div class="gmail_extra" style>Thankful, </div><div class="gmail_extra" style>Adel</div></div>