Sending an IP packet

2013-02-22 Thread Adel Qodmani
Hey, My question is quite simple, I have an sk_buff that I want to transmit, the sk_buff is an ICMP message and so far, I've built the headers and set up everything. The problem is, when I want to do such a thing, I typically use a function called: dev_queue_xmit which takes the skb and

Re: Sending an IP packet

2013-02-22 Thread Rami Rosen
Hi, Adel, You should use ip_route_output_flow(). For this you should construct a flowi4 instance. ip_route_output_flow() is exported via EXPORT_SYMBOL_GPL. See for example how this is done in udp_sendmsg(). Good luck! Rami Rosen http://ramirose.wix.com/ramirosen On Fri, Feb 22, 2013 at 2:36

Re: Sending an IP packet

2013-02-22 Thread Adel Qodmani
On Fri, Feb 22, 2013 at 3:47 PM, Rami Rosen roszenr...@gmail.com wrote: Hi, Adel, You should use ip_route_output_flow(). For this you should construct a flowi4 instance. ip_route_output_flow() is exported via EXPORT_SYMBOL_GPL. See for example how this is done in udp_sendmsg(). Good

Re: Sending an IP packet

2013-02-22 Thread Rami Rosen
Hi, Adel, ip_route_output_flow() calls __ip_route_output_key(). The return value is the routing entry, rtable. the parameters for __ip_route_output_key() do not include sock; only net and flow (flp4). And the __ip_route_output_key() is exported. There is a call for xfrm_lookup() which does need

Re: Sending an IP packet

2013-02-22 Thread Valdis . Kletnieks
On Fri, 22 Feb 2013 14:36:17 +0200, Adel Qodmani said: My question is quite simple, I have an sk_buff that I want to transmit, the sk_buff is an ICMP message and so far, I've built the headers and set up everything. Others have given some details on how. A better question is why. Sending an

Re: Sending an IP packet

2013-02-22 Thread Rami Rosen
Hi, Adel, - In your first message you said you are using kernel modules. - In case you intend to add code in ICMP for your special requirements from the control protocol, then this seems not a good idea (because this means patching the kernel for using your module; and probably such patches

Re: Sending an IP packet

2013-02-22 Thread Valdis . Kletnieks
On Fri, 22 Feb 2013 17:15:35 +0200, you said: I am trying to implement a new protocol that we've designed which works on top of the IP layer, so I am using ICMP messages to carry control information for the protocol. Why using ICMP, it seemed natural since our protocol is a Network-layer

Re: Sending an IP packet

2013-02-22 Thread Adel Qodmani
On Fri, Feb 22, 2013 at 5:40 PM, valdis.kletni...@vt.edu wrote: In that case, you *really* want to go look at how TCP and SCTP and other protocols handle ICMP integration. You want an API that integrates your ICMP handling with the rest of the protocol stack, because otherwise you'll end up