以下是网路封包从driver一直到socket的流程
netif_rx() (在net/core/dev.c)
net_rx_action() (在net/core/dev.c)
process_backlog() (在net/core/dev.c)
netif_receive_skb() (在net/core/dev.c) =呼叫handle_bridge()
deliver_skb() (在net/core/dev.c)
ip_rcv() (在net/ipv4/ip_input.c)
netfilter prerouting hook
ip_rcv_finish() (在net/ipv4/ip_input.c)
call routing code
ip_route_input (在net/ipv4/route.c)
ip_local_deliver() (在net/ipv4/ip_input.c)
netfilter localin hook
ip_local_deliver [net/ipv4/ip_input.c] ip_defrag [net/ipv4/ip_fragment.c] ip_local_deliver_finish() (在net/ipv4/ip_input.c)
如果封包是udp
udp_rcv() (在net/ipv4/udp.c)
lookup socket, if any
udp_queue_rcv_skb()
sock_queue_rcv_skb() (在include/net/sock.h)
enqueue into socket receiver queue
sock_def_readable() (在net/core/sock.c)
wake_sup_interruptible() on socket waitqueue
return from recv() via socketcall
如果封包是tcp
tcp_v4_rcv (net/ipv4/tcp_ipv4.c)
__tcp_v4_lookup
tcp_v4_do_rcv
tcp_rcv_established (net/ipv4/tcp_input.c)
__skb_queue_tail (include/linux/skbuff.)
sock_def_readable (net/core/sock.c)
wake_up_interruptible (include/linux/sched.h) tcp_v4_hnd_req (net/ipv4/tcp_ipv4.c) tcp_v4_search_req tcp_check_req tcp_v4_syn_recv_sock __tcp_v4_lookup_established tcp_rcv_state_process (net/ipv4/tcp_input.c) tcp_v4_conn_request (net/ipv4/tcp_ipv4.c) tcp_v4_send_synack tcp_v4_synq_add tcp_rcv_synsent_state_process (net/ipv4/tcp_input.c) tcp_set_state (include/net/tcp.h) tcp_send_ack (net/ipv4/tcp_output.c]
其他相关
linux/net/ ipv4/ip_output.c
icmp: linux/net/ ipv4/icmp.c
linux/net/bridge/br_device.c |