TCP/IP Architecture, Design, and Implementation in Linux (Practitioners) - Hardcover

Seth, Sameer; Venkatesulu, M. Ajaykumar

 
9780470147733: TCP/IP Architecture, Design, and Implementation in Linux (Practitioners)

Inhaltsangabe

This book provides thorough knowledge of Linux TCP/IP stack and kernel framework for its network stack, including complete knowledge of design and implementation. Starting with simple client-server socket programs and progressing to complex design and implementation of TCP/IP protocol in linux, this book provides different aspects of socket programming and major TCP/IP related algorithms. In addition, the text features netfilter hook framework, a complete explanation of routing sub-system, IP QOS implementation, and Network Soft IRQ. This book further contains elements on TCP state machine implementation,TCP timer implementation on Linux, TCP memory management on Linux, and debugging TCP/IP stack using lcrash

Die Inhaltsangabe kann sich auf eine andere Ausgabe dieses Titels beziehen.

Über die Autorin bzw. den Autor

Sameer Seth works at Juniper Networks as Senior Staff Engineer for JUNOS Kernel Team. Previously, he was a senior engineer at Sun Microsystems, where he worked on the TCP/IP stack in Solaris, sockets, streams, NFS, and related kernel framework. He has ten years of experience working with Linux in research and commercial environments. He has also worked on embedded TCP/IP Linux stack as well as on X86 architectures. Additionally, he has worked on different communication protocols on Motorola MPC8260 processors. His community work includes blogging for opensolaris technology (blogs.sun.com/sameer) and he delivers technical talks on open solaris technology. In his spare time he enjoys writing and talking on technical topics related to networking and Unix.

M. Ajaykumar Venkatesulu is currently working on networking and naming services. He has seven years of experience with Linux networking and kernel in research and commercial environments. His areas of interest include Linux kernel, embedded systems, IP routing, and IP QoS.

Von der hinteren Coverseite

The only single-source reference on the concept and implementation of TCP/IP in Linux

As open source software becomes a trusted part of business and research systems, it's no wonder that a combination of the Transmission Control Protocol/Internet Protocol (TCP/IP) and the Linux operating system is becoming more common. TCP/IP's prevalence allows easy communication among computers using various operating systems, whether Windows, Mac OS, Linux, or Unix. And Linux―because it is open source and thus modifiable―has become a frequent choice for developers who want a customizable operating system on which to build their applications.

This book describes the design and implementation of TCP/IP in Linux, from simple client-server applications to more complex executions. Topical coverage includes:

  • Basic socket concepts and implementations

  • The Linux implementation of network packets

  • TCP read/write

  • TCP algorithms for data transmission and congestion control

  • TCP timers

  • IP layer and routing tables implementation

  • IP forwarding and quality of service implementation

  • Netfilter hooks for the stacks

  • Network Soft IRQ

  • How to debug a TCP/IP stack

All topics are discussed in a concise, step-by-step manner and the book is complemented with helpful illustrations to give readers a better understanding of the subject. TCP/IP Architecture, Design, and Implementation in Linux is an indispensable resource for embedded-network product developers, network security product developers, IT network architects, researchers, and graduate students.

Aus dem Klappentext

The only single-source reference on the concept and implementation of TCP/IP in Linux

As open source software becomes a trusted part of business and research systems, it's no wonder that a combination of the Transmission Control Protocol/Internet Protocol (TCP/IP) and the Linux operating system is becoming more common. TCP/IP's prevalence allows easy communication among computers using various operating systems, whether Windows, Mac OS, Linux, or Unix. And Linux—because it is open source and thus modifiable—has become a frequent choice for developers who want a customizable operating system on which to build their applications.

This book describes the design and implementation of TCP/IP in Linux, from simple client-server applications to more complex executions. Topical coverage includes:

  • Basic socket concepts and implementations

  • The Linux implementation of network packets

  • TCP read/write

  • TCP algorithms for data transmission and congestion control

  • TCP timers

  • IP layer and routing tables implementation

  • IP forwarding and quality of service implementation

  • Netfilter hooks for the stacks

  • Network Soft IRQ

  • How to debug a TCP/IP stack

All topics are discussed in a concise, step-by-step manner and the book is complemented with helpful illustrations to give readers a better understanding of the subject. TCP/IP Architecture, Design, and Implementation in Linux is an indispensable resource for embedded-network product developers, network security product developers, IT network architects, researchers, and graduate students.

Auszug. © Genehmigter Nachdruck. Alle Rechte vorbehalten.

TCP/IP Architecture, Design and Implementation in Linux

By S. Seth M.A. Venkatesulu

John Wiley & Sons

Copyright © 2008 IEEE Computer Society
All right reserved.

ISBN: 978-0-470-14773-3

Chapter One

INTRODUCTION

Internetworking with Linux has been the most popular choice of developers. Not only in the server world where Linux has made its mark but also in the small embedded network OS market, Linux is the most popular choice. All this requires an understanding of the TCP/IP code base. Some products require implementation of firewall, and others require implementation of IPSec. There are products that require modifications in the TCP connection code for load balancing in a clustered environment. Some products require improving scalability on SMP machines. Most talked about is the embedded world, where networking is most popular. Real-time embedded products have very specific requirements and need huge modifications to the stack as far as buffer management is concerned or for performance reasons. All these require a complete understanding of stack implementation and the supporting framework.

As mentioned above, some of the embedded networking products require a minimum of the code to be complied because of the memory requirements. This requirement involves knowledge of source code organization in the Linux source distribution. Once we know how the code is distributed, it becomes easier to find out the relevant code in which we are interested.

Mostly all the networking application work on very basic client-server technology. The server is listening on a well-known port for connection requests while the client is sending out connection request to the server. Many complex arrangements are made for security reasons or sometimes for load balancing to the client-server technology. But the basic implementation is a simple client-server program in which the client and server talk to each other. For example, telnet or ftp services are accessed through the inet program which hides all the details of services. There are many tunable parameters available to tune your TCP/IP connections. These can be used to best tune the connection without disturbing overall system wide tuning.

Most of the network applications are written to exchange data. Once a connection is established, either (a) the client sends data to the server or (b) data flow in the opposite direction or may flow in both directions. There are different ways to send and receive data over the connection. These different techniques may differ in the way that application blocks once the socket connection either receive or send data.

In the entire book we discuss only TCP and no other transport protocol. So, we need to understand the TCP connection process. TCP is a connection-oriented protocol that has a set process for initializing connections, and similarly it has a set process for closing connection cleanly. TCP maintains state for the connection because of handshakes during connection initiation and closure processes. We need to understand the TCP states to completely understand the TCP connection process.

In this chapter we will present an overview of how the TCP/IP protocol stack is implemented on Linux. We need to understand the Linux operating system, including the process, the threads, the system call, and the kernel synchronization mechanism. All these topics are covered though not in great detail. We also need to understand the application programming interface that uses a TCP/IP protocol stack for data transmission, which is discussed. We discuss socket options with kernel implementation. Finally, we discuss the TCP state, which covers a three-way handshake for opening connection and a four-way handshake for connection closure.

1.1 OVERVIEW OF TCP/IP STACK

Let's see how the TCP/IP stack is implemented on Linux. First we just need to understand the network buffer that represents the packet on Linux. sk_buff represents the packet structure on Linux (see Fig. 1.1). sk_buff carries all the required information related to the packet along with a pointer to the route for the packet. head, data, tail, and end point to the start of the data block, actual start of data, end of data, and end of data block, respectively. skb_shared_info object is attached at the end of the sk_buff header which keeps additional information about paged data area. The actual packet is contained in the data block and is manipulated by data & tail pointers. This buffer is used everywhere in the networking code as well as network drivers. Details are discussed in Chapter 5.

Now we will have a look at how the stack is implemented in Linux. We will first start with down-the-stack processing of the packet from the socket layer to the driver layer and then move up the stack. We will take an example of sending TCP data down the stack. In general, more or less the same stack is used for other transport protocols also, but we will restrict our discussion to TCP only.

1.1.1 Moving Down the Stack

When an application wants to write data over the TCP socket, the kernel reaches the socket through VFS (see Fig. 1.2). inode for the file of the type socket contains a socket object, which is the starting point for the networking stack (see Section 3.2 for more details). The socket object has a pointer to a set of operations specific to the socket type pointed to by field ops. Object proto_ops has a pointer to socket-specific operations. In our case, the socket is of type INET, so send systemcall ends up calling inet_sendmsg() inside kernel via VFS. The next step is to call a protocol-specific send routine because there may be different protocols registered under INET socket (see Section 3.1). In our case, transport later is TCP, so inet_sendmsg() calls a protocol-specific send operation. The protocol-specific socket is represented by a sock object pointed to by the sk field of the socket object. A protocol-specific set of operation is maintained by a proto object pointed to by prot field of sock object. inet_sendmsg() calls a protocol-specific send routine, which is tcp_sendmsg().

In tcp_sendmsg(), user data are given to a TCP segmentation unit. The segmentation unit breaks big chunks of user data into small blocks and copies each small block to sk_buff. These sk_buffs are copied to the socket's send buffer, and then the TCP state machine is consulted to transmit data from socket send buffer. If the TCP state machine does not allow sending new data because of any reasons, we return. In such a case, data will be transmitted later by a TCP machine on some event which is discussed in Section 11.3.11.

If the TCP state machine is able to transmit sk_buff, it sends a segment to the IP layer for further processing. In the case of TCP, sk -> tp -> af_specific -> queue_xmit is called, which points to ip_queue_xmit(). This routine builds an IP header and takes an IP datagram through the firewall policy. If the policy allows, an IP layer checks if NAT/Masquerading needs to be applied to the outgoing packet. If so, a packet is processed and is finally given to the device for final transmission by a call to dev_queue_xmit(). Device refers to a network interface, which is represented by net_device object. At this point, the Linux stack implements QOS. Queuing disciplines are implemented at the device level.

Packet...

„Über diesen Titel“ kann sich auf eine andere Ausgabe dieses Titels beziehen.