Http://hi.baidu.com/amy_yeni/blog/item/c54003004d9a080b738da5b3.html
Some layers of Linux kernel IPv4 networks:
BSD Socket Layer:This part handles BSD socket-related operations. Each socket is represented in a struct Socket Structure in the kernel. This part of the file
Mainly include:/NET/socket. C/NET/protocols. c etc
Inet Socket Layer:BSD socket is an interface that can be used for various network protocols. When it is used for TCP/IP, that is, a socket in the form of af_inet,
Some additional parameters need to be retained, so there is a struct sock structure. File main
Available:/NET/IPv4/protocol. C/NET/IPv4/af_inet.c/NET/CORE/sock. c etc
TCP/UDP layer:The transport layer is represented by the struct inet_protocol and struct proto structures. File main
Include:/NET/IPv4/UDP. c/NET/IPv4/datax. c/NET/IPv4/TCP. c/NET/IPv4/tcp_input.c/NET/IPv4 // tcp_output.c/NET/IPv4/tcp_minisocks.c/NET/IPv4/tcp_output.c/NET/IPv4/tcp_timer.c
Etc
IP layer:Processes operations at the network layer. The network layer is represented by the struct packet_type structure. Files mainly include:/NET/IPv4/ip_forward.c
Ip_fragment.c ip_input.c ip_output.c etc.
Data link layer and driver:Each network device is represented by struct net_device. The common processing is in Dev. C, and the driver program is in the/driver/NET directory.
Directory.
2. List of functions used to establish UDP communication between two hosts
^
| Sys_read fs/read_write.c
| Sock_read net/socket. c
| Sock_recvmsg net/socket. c
| Inet_recvmsg net/IPv4/af_inet.c
| Udp_recvmsg net/IPv4/udp. c
| Skb_recv_datw.net/CORE/datw.c
| -------------------------------------------
| Sock_queue_rcv_skb include/NET/sock. h
| Udp_queue_rcv_skb net/IPv4/udp. c
| Udp_rcv net/IPv4/udp. c
| Ip_local_deliver_finish net/IPv4/ip_input.c
| Ip_local_deliver net/IPv4/ip_input.c
| Ip_recv net/IPv4/ip_input.c
| Net_rx_action net/dev. c
| -------------------------------------------
| Netif_rx net/dev. c
| El3_rx driver/NET/3c309. c
| El3_interrupt driver/NET/3c309. c
======================================
| Sys_write fs/read_write.c
| Sock_writev net/socket. c
| Sock_sendmsg net/socket. c
| Inet_sendmsg net/IPv4/af_inet.c
| Udp_sendmsg net/IPv4/udp. c
| Ip_build_xmit net/IPv4/ip_output.c
| Output_maybe_reroute net/IPv4/ip_output.c
| Ip_output net/IPv4/ip_output.c
| Ip_finish_output net/IPv4/ip_output.c
| Dev_queue_xmit net/dev. c
| --------------------------------------------
| El3_start_xmit driver/NET/3c309. c
V
3. network path diagram, key data structure sk_buffer and route Introduction
Linux-net.pdf Chapter 2.1 Chapter 2.3
4. process from connection, sending, to receiving data packets
Linux-net.pdf 4th, 5, 6 chapter in detail