Linux Kernel Networking Programming Class
* C-language programmers
* Network application developers, and those porting to Linux
* Network device driver developers, and those porting to Linux
* Systems programmers who want a grasp of kernel internals
* Kernel programmers who want a good grasp of networking internals
NOT TARGETED AT:
* Networking administrators with not much programming experience
* Programmers used to working in only Java or C++
* Anyone looking for an introduction to Linux
* Anyone looking to solve the "problem du jour" with a magic bullet
* Anyone looking for the bleeding edge
WHAT THIS COURSE IS AND IS NOT:
Linux Kernel Network Programming class is a follow on to Linux kernel
and drivers classes.
It is designed to prepare experienced programmers to write networking
applications for Linux, and of furnishing them with a solid
understanding of the implementation of networking layer of the Linux kernel.
This class will take a layered approach to networking, working inward
from application (socket) programming methods, to the network and
transport layers, and finally through the device (datalink) layer.
While this is an ambitious class of the most advantage to those students
who already have a good knowledge of operating system architecture in
general, and Linux in specific, other students will still derive solid
benefits and will walk away with a good grasp of Linux and its
This is NOT a class in network administration, performance tuning, or
kernel hacking. We will not discuss specialized hardware or cutting
edge technologies. This IS a class that will give students the
framework to pursue those areas with a good foundation.
Linux Kernel Network Programming is designed to prepare experienced
programmers to write networking applications for Linux, and of
furnishing them with a solid understanding of the implementation of
networking layer of the Linux kernel.
There are three principal sub-areas which we will address:
1. The application layer: how to write socket-based applications,
dealing with addressing issues and writing both client and server
2. The network and transport layers: How the Linux kernel is structured
to deal with the various protocols and routing issues.
3. The device driver and datalink layers: How networking device drivers
are written for Linux and hardware protocols are satisfied.
In order to do this we will also have a brief introduction to Linux
kernel programming, including basic architecture, methods, and
This class is not a general class on networking; we are going to
concentrate on Linux-specific issues.
This class is not a class on kernel hacking; we don't expect you to come
out of this fully prepared to join the upper ranks of kernel developers.
Instead, you should have a thorough grasp of the whole picture from
which you can embark down that road.
This class is not a class on performance tuning. Such a class would be
very different, and not be as code-based.
Networking is a very big subject and we can not cover all of the
details. However, upon completion of this class students should have
enough of a grasp of how Linux networking is accomplished to study
particularities and many implementation details we will not cover.
There is more printed material than we can possibly cover in class; it
is here for background reference and for flexibility in choice of topics
to suit your interests and needs.
* Be proficient in the C programming language.
* Be familiar with basic Linux (Unix) utilities, such as ls, rm, grep,
tar, and have a familiarity with command shells and scripts.
* Be comfortable using any of the available text editors (i.e., emacs, vi.)
* Have seen the X-Window system before.
* Know the basics of compiling and linking programs, constructing
Makefiles etc.; i.e., be comfortable doing application developing in a
Linux or Unix environment.
* Have a good understanding of systems programming in a Unix or Linux
environment, from the stand point of writing applications.
Students who have:
1. some experience configuring and compiling kernels, and writing
kernel modules and or device drivers;
2. a good grasp of operating system fundamentals, and familiarity with
the insides of any other operating system;
3. a good knowledge of networking fundamentals...will gain much more
from this class.
4. Ambitious students could be weak on any of the above except
familiarity with the C language, and still profit from this class.
* Each student will have a computer installed with the current Red Hat
* The emphasis will be on hands-on programming, with the time divided
roughly equally between lecture and labs.
* Where feasible labs will build upon previous lab assignments.
* Lab solutions will be made available so students can see at least one
successful implementation, and have a possible template to begin the
next lab exercise if it is a follow up.
* In addition, examples as shown during the lectures will also be made
available as part of the solutions package, in the EXAMPLES
* If you have any questions or feedback on the course material after
completion of the class, you can contact your instructor, or the
courseware maintainer, Jerry Cooperstein at Coop@axian.com.
Linux Kernel Networking Programming Class
Session 01: Introduction
1.2 Course Objectives
1.5 Kernel Versions and Backwards Compatibility
Session 02: Networking
2.2 Network Programming
2.3 Historical Considerations
2.6 Transport and Network Layers and Encapsulation
2.7 Datalink Layer and Device Drivers
Session 03: Sockets
3.2 What are Sockets?
3.3 Stream Sockets
3.4 Datagram Sockets
3.5 Raw Sockets
3.6 Byte Ordering
Session 04: Sockets - Addresses and Hosts
4.2 Socket Address Structures
4.3 Converting IP Addresses
4.4 Host Information
Session 05: Sockets - Service Port and Protocol Information
5.2 Service Port Information
5.3 Protocol Information
Session 06: Sockets - Clients
6.2 Basic Client Sequence
6.5 close() and shutdown()
6.6 Unix Client
6.7 Internet Client
Session 07: Sockets - Servers
7.2 Basic Server Sequence
7.6 Unix Server
7.7 Internet Server
Session 08: Sockets - Input/Output Operations
8.2 write(), read()
8.3 send(), recv()
8.4 sendto(), recvfrom()
8.5 sendmsg(), recvmsg()
Session 09: Sockets - Options
9.2 Getting and Setting Socket Options
9.5 getsockopt(), setsockopt()
Session 10: Sockets - select() and poll()
10.2 Multiplexed and Asynchronous Socket I/O
10.6 Signal Driven and Asynchronous I/O
10.7 Concurrent Servers
Session 11: Sockets - IPV6
11.2 What is IPV6?
11.3 Main Features
11.4 Main Functions
11.5 Writing Portable Code
Session 12: Kernel Layout and Configuration
12.2 Layout of the Kernel Source
12.3 Mixing User and Kernel Space Headers
12.4 Making a Kernel Patch
12.5 Kernel Configuration
Session 13: Modules
13.2 What are Modules?
13.3 A Simple Example
13.4 Compiling Modules
13.5 Modules vs Built-in
13.6 Loading and Unloading Modules
13.7 Module Usage Count
13.8 Module Licensing
13.9 Exporting Symbols
Session 14: Kernel Programming Preview
14.2 Process Descriptor
14.3 Memory Allocation
14.4 Transferring Data between User and Kernel Space
Session 15: The proc Filesystem
15.2 What is the proc Filesystem?
15.3 Creating Entries
15.4 Reading Entries
15.5 Writing Entries
Session 16: Synchronization Methods
16.2 Atomic Functions
16.3 Bit Operations
16.4 Memory Barriers
16.7 Completion Functions
16.8 Linked Lists
Session 17: Timing and Timers
17.3 Precise Timing
17.4 Inserting Delays
17.5 Kernel Timers
Session 18: Sleeping, Waking, Task Queues and Tasklets
18.2 Wait Queues
18.4 Task Queues
Session 19: Kernel Network Code
19.2 Network Code Roadmap
19.3 Object-Oriented Methods
19.4 Main Data Structures
19.5 socket structure
19.6 proto_ops structure
19.7 sock structure
19.8 softnet_data structure
Session 20: Connections
20.2 Establishing Connections
20.3 Socket Creation
20.4 Connecting, Binding, and Listening
20.5 Accepting Connections
20.6 Socket Disconnection
Session 21: Sending and Receiving Messages
21.2 I/O Through Sockets
Session 22: Kernel Network Initialization
22.2 Basic Setup
22.3 Socket Initialization
22.4 Unix Protocol Initialization
22.5 Internet Protocol Initialization
22.6 Initializing TCP
22.7 Initializing softnet
Session 23: Packet Transmission
23.2 Getting Data from the Application
23.3 Sending a TCP/UDP Packet for AF_UNIX
23.4 Sending a TCP/UDP Packet for AF_INET
23.5 Getting Data to the Device Using softirqs
Session 24: Packet Reception
24.2 Getting Data to the Application
24.3 Receiving a TCP/UDP Packet for AF_UNIX
24.4 Receiving a TCP/UDP Packet for AF_INET
24.5 Getting Data from the Device Using softirqs
Session 25: IP Forwarding
25.2 What is IP Forwarding?
25.3 Examining and Deciding
25.4 Forwarding Packets
Session 26: Kernel Network Routing
26.2 Routing in Linux
26.3 Routing Tables
26.4 Forwarding Information Base
26.5 Routing Cache
26.6 Keeping Information up to Date
Session 27: Zero-Copy Networking
27.2 What is Zero-Copy Networking
Session 28: select() and alternatives
28.2 Problems with select() and poll()
28.4 kevent() and kqueue()
28.5 Using Real Time Signals
Session 29: Asynchronous I/O
29.2 What is Asynchronous I/O?
29.3 The Asyncrhonous I/O API
29.4 Linux Implementation
Session 30: In Kernel Web Server Acceleration
30.2 What is in-Kernel Web Service Acceleration?
30.5 User-space Solutions
Session 31: Network File Systems
31.2 Available Network File Systems
31.5 NFS Versions
Session 32: Introduction to Network Drivers
32.2 Network Drivers
Session 33: Network Driver Data Structures
33.2 netdevice Structure
33.3 sk_buff Structure
Session 34: Transmission and Reception
34.2 Packet Transmission
34.3 Packet Reception
Session 35: Network Driver Facilities
35.4 Changes in Link State