tcp_connect()
--> tcp_transmit_skb() # tcp_output.c // actually transmits TCP packets queued in by tcp_do_sendmsg().
--> icsk->icsk_af_ops->queue_xmit # kernel/net/ipv4/tcp_output.c ( .queue_xmit = ip_queue_xmit )
--> ip_queue_xmit() # kernel/net/ipv4/ip_output.c
* --> ip_local_out() # kernel/net/ipv4/ip_output.c
--> __ip_local_out() # kernel/net/ipv4/ip_output.c //调用netfilter,返回值为1说明允许报文通过
--> nf_hook() # kernel/include/linux/netfilter.h
--> nf_hook_thresh() # kernel/include/linux/netfilter.h \
Returns 1 if the hook has allowed the packet to pass.
ip_forward --> dst_output() # kernel/include/net/dst.h
--> skb_dst(skb)->output(net, sk, skb) # kernel/include/net/dst.h // //实际调用 ip_output 函数
* --> ip_output() # kernel/net/ipv4/ip_output.c
--> ip_finish_output() # kernel/net/ipv4/ip_output.c
* --> ip_finish_output2() # kernel/net/ipv4/ip_output.c
* --> dst_neigh_output() # kernel/include/net/dst.h
--> neigh_hh_output() # kernel/include/net/neighbour.h //支持硬件缓存头方法的发送
--> dev_queue_xmit() # kernel/net/core/dev.c
--> n->output() # //不支持硬件缓存头的方法的发送
* --> neigh_resolve_output() # kernel/net/core/neighbour.c
--> neigh_event_send() # kernel/include/net/neighbour.h
--> __neigh_event_send() # kernel/net/core/neighbour.c
* --> neigh_probe() # kernel/net/core/neighbour.c
--> neigh->ops->solicit # 实际调用 arp_solicit 函数,该函数会发送 arp 请求
* --> arp_solicit() # kernel/net/ipv4/arp.c
* --> arp_send_dst() # kernel/net/ipv4/arp.c // Create and send an arp packet.
* --> arp_create() # kernel/net/ipv4/arp.c
* --> arp_xmit() # kernel/net/ipv4/arp.c
* --> arp_xmit_finish() # kernel/net/ipv4/arp.c
* --> dev_queue_xmit() # kernel/net/core/dev.c
--> __dev_queue_xmit() # kernel/net/core/dev.c
--> dev_queue_xmit() # kernel/net/core/dev.c
* --> __dev_queue_xmit() # kernel/net/core/dev.c
* --> __dev_xmit_skb() # kernel/net/core/dev.c
--> neigh_update() # kernel/net/core/neighbour.c
--> neigh_connect(neigh); # 修改output函数为neigh_connected_output
--> n1->output(n1, skb); # 调用neigh的output函数,此时已经改成connect函数
--> neigh_connected_output() # kernel/net/core/neighbour.c
--> dev_queue_xmit() # kernel/net/core/dev.c