Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 12: Networks


calls. This is unavoidable because of the numerous ways in which the layers can be combined — but this
does not make the code path any clearer or easier to follow. In addition, the data structures involved
are generally very closely linked with each other. To reduce complexity, the information below relates
primarily to the Internet protocols.

The layer model is mirrored not only in the design of the network layer, but also in the way data are
transmitted (or, to be more precise, the way in which the data generated and transmitted by the individ-
ual layers are packaged). In general, the data of each layer are made up of a header section and a data
section, as shown in Figure 12-4.

Header Payload

Data of a protocol session

Figure 12-4: Division into header and data sections.

Whereas the header contains metadata (destination address, length, transport protocol type, etc.) on the
data section, the data section itself consists of the useful data (or payload).

The base unit of transmission is the (Ethernet) frame used by the network card to transmit data. The main
entry in the frame header is the hardware address of the destination system to which the data are to be
transmitted and which is needed for transmission via cable.

The data of the higher-level protocol are packaged in the Ethernet frame by including the header and
data tuple generated by the protocol in the data section of the frame. This is the IP layer data in Internet
networks.

Because not only IP packets but also, for example, Appletalk or IPX packets can be transmitted via Eth-
ernet, the receiving system must be able to distinguish between protocol types in order to forward the
data to the correct routines for further processing. Analyzing data to find out which transport protocol
is used is very time-consuming. As a result, the Ethernet header (and the headers of all other modern
protocols) includes an identifier to uniquely identify the protocol type in the data section. The identifiers
(for Ethernet) are assigned by an international organization (IEEE).

This division is continued for all protocols in the protocol stack. For this reason, each frame transmitted
starts with a series of headers followed by the data of the application layer, as shown in Figure 12-5.^7

Mac
Header

IP
Header

TCP


Header

HTTP
Header HTML Data

Ethernet-Frame

Payload of Ethernet Frame
Payload of IP
Payload of TCP

Figure 12-5: Transporting HTTP data via TCP/IP in an Ethernet frame.

(^7) The boundary between the HTTP header and the data section is indicated by a change of shading because this distinction is made
in userspace and not in the kernel.

Free download pdf