On Saturday, May 3, 2014, Rami Rosen <roszenrami@gmail.com> wrote:
Hi, Pranay,
First, let's assume that you are talking about IPv4, though you did not mention it explicitly. (The principles in IPv6 are quite similar, though)
A packet is sent out in the usual case with the ip_queue_xmit() method. The ip_queue_xmit() method calls the ip_route_output_ports() method in order to perform a lookup in the IPv4 routing tables.
see: http://lxr.free-electrons.com/source/net/ipv4/ip_output.c#L352
The results of this IPv4 routing lookup determines on which network device (net_device) the packet will be sent. You should look at the code of ip_route_output_ports() method in net/ipv4/route.c in order to understand the IPv4 routing subsystem and the IPv4 routing lookup.
Packets can, under certain circumstances, be sent by the ip_send_skb() method, but this happens when the flow (which consists also of the net_device to be used) is known before.
Best Regards, Rami Rosen http://ramirose.wix.com/ramirosen
On Sat, May 3, 2014 at 11:33 AM, Pranay Srivastava <pranjas@gmail.com> wrote:
Hi,
This is probably a stupid question, but i'm not able to find the answer. How does the networking subsystem decides which device to use for sending the skb. Can some one please guide me to the particular code. I seem to get lost in there :(
-- ---P.K.S
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Thanks a lot Professor. It will take some time to digest all of it. The book and slides are great resource. Could you also answer my queries on net_device structure as well?