深入了解协议栈内核源码

三次握手内核源码

深入理解 Linux 的 TCP 三次握手_tcp_v4_conn_request-CSDN博客

socket.c 内核态函数入口

三次状态变化

创建socket入口

ping

Breakpoint 7, SyS_socket (family=2, type=3, protocol=1) at net/socket.c:1325
1325    SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
(gdb) bt
#0  SyS_socket (family=2, type=3, protocol=1) at net/socket.c:1325
#1  0xffffffff81001bfb in do_syscall_64 (regs=0xffffc900000bff58) at arch/x86/entry/common.c:292
#2  0xffffffff81a00075 in entry_SYSCALL_64 () at arch/x86/entry/entry_64.S:233
#3  0x0000000000000002 in irq_stack_union ()
#4  0x0000000000000000 in ?? ()

2 表示AF_NET

3表示原始套接字类型

1表示ICMP

ping完后对端响应处理

#0  icmp_reply (icmp_param=0xffff888007c03c48, skb=0xffff8880067b6400) at ./include/linux/skbuff.h:883
#1  0xffffffff817fde46 in icmp_echo (skb=) at net/ipv4/icmp.c:946
#2  0xffffffff817fde77 in icmp_echo (skb=) at net/ipv4/icmp.c:949
#3  0xffffffff817fe34a in icmp_rcv (skb=0xffff8880067b6400) at net/ipv4/icmp.c:1071
#4  0xffffffff817c8563 in ip_local_deliver_finish (net=0xffffffff822ea780 , sk=, skb=0xffff8880067b6400) at net/ipv4/ip_input.c:216
#5  0xffffffff817705db in __netif_receive_skb_core (skb=0xffff8880067b6400, pfmemalloc=) at net/core/dev.c:4474
#6  0xffffffff817728bf in netif_receive_skb_internal (skb=0xffff8880067b6400) at net/core/dev.c:4585
#7  0xffffffff817730d7 in napi_skb_finish (skb=, ret=GRO_NORMAL) at net/core/dev.c:4946
#8  napi_gro_receive (napi=, skb=0xffff8880067b6400) at net/core/dev.c:4977
#9  0xffffffff815e4125 in e1000_receive_skb (skb=, vlan=, status=, adapter=) at drivers/net/ethernet/intel/e1000/e1000_main.c:4033
#10 e1000_clean_rx_irq (adapter=0xffff888007176840, rx_ring=, work_done=, work_to_do=) at drivers/net/ethernet/intel/e1000/e1000_main.c:4489
#11 0xffffffff815e589c in e1000_clean (napi=0xffff888007176af0, budget=64) at drivers/net/ethernet/intel/e1000/e1000_main.c:3834
#12 0xffffffff817734b8 in napi_poll (repoll=, n=) at net/core/dev.c:5595
#13 net_rx_action (h=) at net/core/dev.c:5661
#14 0xffffffff81c000c3 in __do_softirq () at kernel/softirq.c:288
#15 0xffffffff8105e9eb in invoke_softirq () at kernel/softirq.c:368
#16 irq_exit () at kernel/softirq.c:409
#17 0xffffffff81a01fae in exiting_irq () at ./arch/x86/include/asm/apic.h:648
#18 do_IRQ (regs=0xffffffff82203e48 ) at arch/x86/kernel/irq.c:242
#19 0xffffffff81a00906 in common_interrupt () at arch/x86/entry/entry_64.S:576
#20 0xffffffff82203e48 in init_thread_union ()
#21 0x0000000000000000 in ?? ()

内核版本:4.14.191

你可能感兴趣的:(服务器,linux,.net,.netcore)