Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 12: Networks


also for forwarding and routing packets between systems not directly connected with each other. Finding
the best route and selecting a suitable network device to send the packet also involves handling lower-
level address families (such as hardware-specific MAC addresses), which accounts for why the layer is
at least loosely associated with network cards. The assignment between the addresses of the network
layer and the network access layer is made in this layer — another reason why the IP layer is not fully
divorced from the hardware.

Fragmentation of larger data packets into smaller units cannot be performed without taking the underly-
ing hardware into account (in fact, the properties of the hardware are what make this necessary in the first
place). Because each transmission technique supports a maximum packet size, the IP protocol must offer
ways of splitting larger packets into smaller unitsthat can be reassembled by the receiver — unnoticed
by the higher layers. The size of the fragmented packets depends on the capabilities of the particular
transmission protocol.

IP was formally defined in 1981 (in RFC 791) and is therefore of ripe old age.^14 Even though the situation
on the ground is not as represented in the usual company press releases that praise, for example, each
new version of a spreadsheet as the greatest invention since the beginning of mankind, the last two
decades have left their mark on today’s technology. Deficiencies and unforeseen problems occasioned
by the strong growth of the Internet are now more and more evident. This is why the IPv6 standard has
been developed as the successor to the present IPv4. Unfortunately, this future standard is only slowly
being adopted owing to the lack of a central control authority. In this chapter, our interest focuses on
the implementation of the algorithms for Version 4, but we also take a cursory look at future practicable
techniques and their implementation in the Linux kernel.

To understand how the IP protocol is implemented in the kernel, it is necessary to briefly examine how
it works. Naturally, we can only touch on the relevant topics in this huge area. For detailed descriptions,
see the many specialized publications, particularly [Ste00] and [Ste94].

12.8.1 IPv4


IP packets use a protocol header as shown in Figure 12-14.

Version IHL Codepoint/Type of service Total length
Fragment Identification Flags Fragment Offset
TTL Protocol Header Checksum
Source address
Destination address
Options Padding

Payload

04 8 16 20 24 32

Figure 12-14: Structure of an IP header.

The meanings of the individual components of the structure are explained below.

(^14) Even though the marketing departments of some companies suggest the opposite, the Internet is older than most of its users.

Free download pdf