The Destination Cache

As we shall see in the later section Section 18.2.2, processes usually "assign names" to sockets — that is, they specify the remote IP address and port number of the host that should receive the data written onto the socket. The kernel shall also make available to the processes reading the sockets every packet received from the remote host carrying the proper port number.

Actually, the kernel has to keep in memory a bunch of data about the remote host identified by an in-use socket. To speed up the networking code, this data is stored in a so-called destination cache, whose entries are objects of type dst_entry. Each INET socket stores in the dst_cache field a pointer to a single dst_entry object, which corresponds to the destination host bound to the socket.

A dst_entry object stores a lot of data used by the kernel whenever it sends a packet to the corresponding remote host. For instance, it includes:

• A pointer to a net_device object describing the network device (for instance, a network card) that transmits or receives the packets

• A pointer to a neighbour structure relative to the router that forwards the packets to their final destination, if any (see the later section Section

• A pointer to a hh_cache structure, which describes the common header to be attached to every packet to be transmitted (see the later section Section

• The pointer to a function invoked whenever a packet is received from the remote host

• The pointer to a function invoked whenever a packet is to be transmitted

Continue reading here: Routing Data Structures

Was this article helpful?

+1 0