Chapter 19. Internet Protocol Version 4 (IPv4): Linux Foundations and Features

The previous chapter laid out what an operating system needs to do to support the IP protocol; this chapter introduces the data structures and basic activities through which Linux supports IP, such as how ingress IP packets are delivered to the IP reception routine, how the checksum is verified, and how IP options are processed.

Main IPv4 Data Structures

This section introduces the major data structures used by the IPv4 protocol. You can refer to Chapter 23 for a detailed description of their fields.

I have not included a picture to show the relationships among the data structures because most of them are independent and do not keep cross-references.

iphdr structure

IP header. The meaning of its fields has already been covered in the section "IP Header" in Chapter 18.

ip_options structure

This structure, defined in include/linux/ip.h, represents the options for a packet that needs to be transmitted or forwarded. The options are stored in this structure because it is easier to read than the corresponding portion of the IP header itself.

ipcm_cookie structure

This structure combines various pieces of information needed to transmit a packet.

ipq structure

Collection of fragments of an IP packet. See the section "Organization of the IP Fragments Hash Table" in Chapter 22.

inet_peer structure

The kernel keeps an instance of this structure for each remote host it has been talking to in the recent past. In the ...

Get Understanding Linux Network Internals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.