Regarding skb and net_device.

Rami Rosen roszenrami at gmail.com
Sat May 3 06:35:00 EDT 2014


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 at 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 at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



More information about the Kernelnewbies mailing list