Chinaunix首页 | 论坛 | 博客
  • 博客访问: 399428
  • 博文数量: 74
  • 博客积分: 2088
  • 博客等级: 大尉
  • 技术积分: 703
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-22 13:04
文章分类

全部博文(74)

文章存档

2013年(1)

2012年(9)

2011年(57)

2010年(6)

2008年(1)

分类: LINUX

2013-06-29 10:41:53

接收以太帧:
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_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


























































































































阅读(2050) | 评论(0) | 转发(1) |
0

上一篇:APUE小结之 Unix/Linux core文件

下一篇:没有了

给主人留下些什么吧!~~