Initialization of a neighbour Structure
As we saw in earlier chapters, a neighbour
structure stores all of the information needed to perform the neighboring protocol's
job—translating an L3 address to an L2 address—for a single L3-to-L2 address mapping. Each
protocol specifies the function used to create a neighbour structure in its neigh_table->constructor virtual function. ARP's initialization function, as you
can see from the definition of the arp_tbl structure in
the previous section, is arp_constructor.
Basic Initialization Sequence
Figure 28-11 shows the basic steps in creating a neighbor entry.

Figure 28-11. Initialization sequence for a new neighbour structure
We saw in the section "Creating a
neighbour Entry" in Chapter 27 that
a neighbor can be created for different reasons and in different initial states. Because
of that, the default values assigned to the fields of the neighbour structure can be overridden by the caller. For instance, neigh->nud_state is set to NUD_NONE when the neighbour structure is
created as a consequence of a transmission request toward the associated neighbor. But
it could also be NUD_PERMANENT or NUD_STALE if the entry was created from the command line.
Broadcast and multicast IP addresses do not need any help from ARP to be translated to
an L2 broadcast or multicast corresponding address, so in these cases, nud_state is set to NUD_NOARP.
Particularly ...
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