The journey of the IP package in the Linux 2.4 kernel.

xiaoxiao2021-03-06  40

1. Interrupt processing function:

NIC receives a frame ------------------------> trigger interrupts ------------------ -> CPU calls the corresponding interrupt handler (pointing to the corresponding processing function in this network card) (read this packet into the RAM) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > Call the Netif_RX function to play TimeStamp, put this SKB into the queue set by the CPU ---------------- à mark soft interrupt (__cpu_raise_softirq) -------- --------------- à interrupt completion.

2. When the soft interrupt is called (a total of three local calls), call net_rx_softirq (actually the NET_RX_ACTION () function) handles the network's soft interrupt. -----------------> net_rx_action () Find the corresponding protocol in the array ptype_base [16] according to the protocol type of the packet, and know the received handler, then The data package is assigned to the processing function, which is handed over to the upper process, and the actual call processing function is in the PT_PREV-> FUNC () in NET_RX_ACTION (). For example, if the packet is an IP protocol, ptype_base [eth_p_ip] -> func () (ip_rcv ()), then hand it over to the IP protocol. According to the type of package, find the corresponding package processing function registered in the system, for IPv4 IP packets, call IP_rcv -----------> nf_ip_pre_routing ---------- ----> IP_RCV_FINISH (Routing operation for this package) --------------------> According to the routing results, call ip_local_deliver (given the package ) / ip_forwardd (Package to Forward) / IP_ERROR () (error package) / IP_MR_INPUT () (multicast package processing)

IP_forward: Package to be forwarded, Check TTL, MTU, Call Nf_ip_forwards, --------------> ip_forwmard_finish (Check Other IP Options for ForwardD!) --------- -------- àip_send (if you need to sharpen, call ip_fragment, call ip_finish_output () (Call nf_ip_post_routing, then ip_finish_output2 (fill the link layer head to SKB structure) ----- ---------) hh-> hh_output / dsr-> neighbour-> Output

转载请注明原文地址:https://www.9cbs.com/read-63010.html

New Post(0)