garfieldcatcat
全部博文(12)
调试(2)
内核编程(3)
内核网络(6)
2014年(2)
2012年(1)
2010年(9)
qlmzldxz
Phyllis6
knm0224
fuyuande
someunix
suiming2
是chi不
along819
cyhshiti
分类: LINUX
2010-10-08 09:47:59
Linux-2.6.21.1 网络函数调用流程 本文档的Copyleft归yfydz所有,使用GPL发布,可以自由拷贝,转载,转载时请保持文档的完整性,严禁用于任何商业用途。msn: yfydz_no1@hotmail.com来源:http://yfydz.cublog.cn/接收以太帧: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 转发: 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_flowtcp_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_outputudp:udp_sendmsg -> ip_route_output_flow -> ip_append_data -> __skb_queue_tail( sk_write_queue ) -> udp_push_pending_frames -> ip_push_pending_framesraw:raw_sendmsg -> ip_route_output_flow -> ip_append_data -> __skb_queue_tail( sk_write_queue ) -> ip_push_pending_framesip_push_pending_frames -> __skb_dequeue(sk_write_queue) -> NF_HOOK(NF_OUTPUT) -> dst_outputip_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
上一篇:linux内核ini文件读取
下一篇:Linux 系统内核空间与用户空间通信的实现与分析
chinaunix网友2010-10-10 15:32:35
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com
登录 注册