Interface to the Neighboring Subsystem
As shown in Figure 18-1 in Chapter 18, transmissions end with a call to
ip_finish_output. The latter is a simple wrapper for
a Netfilter hook point. Note that ip_finish_output does
not follow the naming convention do_something +
do_something_finish, but instead the convention
do_something + do_something2. ip_finish_output2 is
described in the section "Interaction Between
Neighboring Protocols and L3 Transmission Functions" in Chapter 27.
int ip_finish_output(struct sk_buff *skb)
{
struct net_device *dev = skb->dst->dev;
skb->dev = dev;
skb->protocol = _ _constant_htons(ETH_P_IP);
return NF_HOOK(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev,
ip_finish_output2);
}When everything is finally in place (including the L2 header), the dev_queue_xmit function is called (via hh->hh_output or dst->neighbour->output) to do the "hard job" of transmission. We
already discussed in detail how that function works in Chapter 11.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access