linux kernel packet receive flow(内核封包处理流程)


Bridgecode

linux/net/bridge

Bridge function

netif_receive_skb

br_handle_frame_hook

br_handle_frame()(net/bridge/br_input.c)

Ip/icmp/bridge

Receive/transmit

Rx/tx 相关档案

以下是网路封包从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)

call ipv4 protocal

如果封包是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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值