netif_rx
-> queue
-> netif_receive_skb
-> bond
-> packet_type_all: deliver_skb
-> bridge
-> packet_type(IPV4)->func == ip_rcv
接收IPv4包:
ip_rcv
-> NF_HOOK(PREROUTING)
->ip_rcv_finish
-> ip_route_input
-> ip_route_input_cached
-> ip_route_input_slow
-> ip_mkroute_input
-> __mkroute_input
dst->input = ip_forward
dst->output = ip_output
-> dst_input
-> LOCAL_IN: dst->input == ip_local_deliver
-> NF_HOOK(NF_INPUT)
-> ip_local_deliver_finish
-> ipprot->handler(tcp, udp, icmp ...)
-> FORWARD: dst->input == ip_forward
Forward:
ip_forward
-> xfrm4_route_forward (net/xfrm.h, get xfrm_dst)
-> xfrm_route_forward
-> __xfrm_route_forward
-> xfrm_lookup
-> xfrm_find_bundle
-> afinfo->find_bundle == __xfrm4_find_bundle
-> xfrm_bundle_create
-> afinfo->bundle_create == __xfrm4_bundle_create
tunnel mode
-> xfrm_dst_lookup
-> afinfo->dst_lookup == xfrm4_dst_lookup
-> __ip_route_output_key
-> dst_list: dst->list=policy_bundles, policy->bundles = dst
-> NF_HOOK(NF_FORWARD)
-> ip_forward_finish
-> dst_output
输出:
icmp:
icmp_send
-> ip_route_output_key
-> ip_route_output_flow
-> icmp_push_reply
-> ip_append_data
-> skb_queue_walk
-> ip_push_appending_frames
tcp:
tcp_connect
-> ip_route_connect
-> ip_route_output_flow
tcp_sendmsg
-> __tcp_push_appending_frames
-> tcp_write_xmit
-> tcp_transmit_skb
-> net_xmit_eval
-> icsk->icsk_af_ops->queue_xmit == ipv4_specific->queue_xmit == ip_queue_xmit
-> tcp_push_one
-> tcp_transmit_skb
-> net_xmit_eval
-> icsk->icsk_af_ops->queue_xmit == ipv4_specific->queue_xmit == ip_queue_xmit
tcp_protocol->handler == tcp_v4_rcv
-> __inet_lookup
-> xfrm_policy_check
-> tcp_v4_do_rcv
-> tcp_rcv_state_process
-> icsk->icsk_af_ops->conn_request == tcp_v4_conn_request
-> tcp_v4_send_synack
-> ip_build_and_send_pkt
-> NF_HOOK( NF_OUTPUT )
-> dst_output
udp:
udp_sendmsg
-> ip_route_output_flow
-> ip_append_data
-> __skb_queue_tail( sk_write_queue )
-> udp_push_pending_frames
-> ip_push_pending_frames
raw:
raw_sendmsg
-> ip_route_output_flow
-> ip_append_data
-> __skb_queue_tail( sk_write_queue )
-> ip_push_pending_frames
ip_push_pending_frames
-> __skb_dequeue(sk_write_queue)
-> NF_HOOK(NF_OUTPUT)
-> dst_output
ip_queue_xmit
-> ip_route_output_flow
-> xfrm_lookup
-> xfrm_find_bundle
-> bundle_create
-> afinfo->bundle_create == __xfrm4_bundle_create
-> xfrm_dst_lookup
-> afinfo->dst_lookup == xfrm4_dst_lookup
-> __ip_route_output_key
-> dst_list
-> dst->list=policy_bundles, policy->bundles = dst
-> NF_HOOK(NF_OUTPUT)
-> dst_output
-> dst->output
dst_output: dst_list循环
-> dst->output == xfrm_dst->output == xfrm4_output == xfrm4_state_afinfo->output
-> NF_HOOK(POSTROUTING)
-> xfrm4_output_finish
-> gso ?
-> xfrm4_output_finish2
-> xfrm4_output_one
-> mode->output
-> type->output
-> skb->dst=dst_pop(skb->dst)
-> nf_hook(NF_OUTPUT)
-> !dst->xfrm
-> dst_output
-> nf_hook(POSTROUTING)
-> dst->output == ip_output
-> NF_HOOK(POSTROUTING)
-> ip_finish_output
-> ip_finish_output2
-> hh_output == dev_queue_xmit
本文檔的Copyleft歸yfydz所有,使用GPL發布,可以自由拷貝,轉載,轉載時請保持文檔的完整性,嚴禁用於任何商業用途。
msn: yfydz_no1@hotmail.com 來源:http://yfydz.cublog.cn
沒有留言:
張貼留言