ARP Protocol Initialization
The ARP protocol is initialized by arp_init in net/ipv4/arp.c.
The skeleton of a general protocol initialization routine was shown in the section "Protocol Initialization and Cleanup" in Chapter 27. In this chapter we'll examine what is ARP-specific.
The first step in the function is to register a table of virtual functions and other
general parameters used by ARP; this is done by neigh_table_init. The contents of the table, arp_tbl, are described in the next section.
We saw in Chapter 13 how dev_add_pack is used to install a protocol handler. If you
remember how that routine is used, from the following definition of arp_packet_type it should be clear that ARP packets will be
processed by the arp_rcv function (defined in the same
net/ipv4/arp.c file).
static struct packet_type arp_packet_type = {
.type: _ _constant_htons(ETH_P_ARP),
.func: arp_rcv,
};arp_proc_init creates the /proc/net/arp file, which can be read to see the contents of the ARP cache
(including proxy destinations).

Figure 28-10. arp_fwd_proxy function
When the kernel is compiled with support for sysctl, the directory /proc/sys/net/ipv4/neigh is created to export the default tuning parameters of
the neigh_parms structure by means of neigh_sysctl_register. Note that the first input parameter to
the latter is set to NULL, which, as we will see in the section "Directory creation," in Chapter 29, means ...
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