linux路由基础知识(一)
创始人
2024-12-29 11:34:25
0

内核路由表:fib_table

路由表项的增加和查询,fib_table_insert和fib_table_lookup。

跟踪fib_table_insert和fib_table_lookup两个接口。

#!/usr/bin/env bpftrace  #include  #include   kprobe:fib_table_insert {     printf("fib_table_insert\n");     @[kstack]=count(); }  kprobe:fib_table_lookup {     printf("fib_table_lookup\n");     @[kstack]=count(); }

在创建路由的时候,可以捕获到fib_table_insert接口的使用。

正常的接受报文会触发路由表的查询。

1)一个是接收报文路径,会有入向input路由表的查找;

2)一个是用户态发起connec/bind,或者内核tcp接受路径回复ack的时候,会有出向output路由表的创建和查找。

[root@localhost leiyanjie]# bpftrace route.bt Attaching 2 probes... fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup fib_table_lookup ^C  @[     fib_table_lookup+1     ip_route_output_key_hash_rcu+942     ip_route_output_key_hash+90     ip_route_output_flow+25     inet_csk_route_req+221     tcp_conn_request+898     tcp_rcv_state_process+382     tcp_v4_do_rcv+186     tcp_v4_rcv+3577     ip_protocol_deliver_rcu+48     ip_local_deliver_finish+68     ip_local_deliver+255     ip_rcv+216     __netif_receive_skb_one_core+137     process_backlog+158     net_rx_action+309     __do_softirq+188     asm_call_sysvec_on_stack+15     do_softirq_own_stack+55     do_softirq.part.18+47     __local_bh_enable_ip+79     ip_finish_output2+384     ip_output+109     __ip_queue_xmit+359     __tcp_transmit_skb+2638     tcp_connect+2856     tcp_v4_connect+1237     __inet_stream_connect+210     inet_stream_connect+54     __sys_connect+154     __x64_sys_connect+22     do_syscall_64+48     entry_SYSCALL_64_after_hwframe+98 ]: 1 @[     fib_table_lookup+1     __inet_dev_addr_type.isra.28+167     __inet6_bind+675     __sys_bind+211     __x64_sys_bind+22     do_syscall_64+48     entry_SYSCALL_64_after_hwframe+98 ]: 1 @[     fib_table_lookup+1     ip_route_output_key_hash_rcu+942     ip_route_output_key_hash+90     ip_route_output_flow+25     inet_csk_route_child_sock+286     tcp_v4_syn_recv_sock+912     tcp_v6_syn_recv_sock+1568     tcp_check_req+306     tcp_v4_rcv+2456     ip_protocol_deliver_rcu+48     ip_local_deliver_finish+68     ip_local_deliver+255     ip_rcv+216     __netif_receive_skb_one_core+137     process_backlog+158     net_rx_action+309     __do_softirq+188     asm_call_sysvec_on_stack+15     do_softirq_own_stack+55     do_softirq.part.18+47     __local_bh_enable_ip+79     ip_finish_output2+384     ip_output+109     __ip_queue_xmit+359     __tcp_transmit_skb+2638     tcp_rcv_synsent_state_process+1803     tcp_rcv_state_process+235     tcp_v4_do_rcv+186     __release_sock+121     release_sock+43     inet_stream_connect+65     __sys_connect+154     __x64_sys_connect+22     do_syscall_64+48     entry_SYSCALL_64_after_hwframe+98 ]: 1 @[     fib_table_lookup+1     ip_route_output_key_hash_rcu+942     ip_route_output_key_hash+90     ip_route_output_flow+25     ip_send_unicast_reply+480     tcp_v4_send_ack+648     tcp_v4_rcv+1259     ip_protocol_deliver_rcu+48     ip_local_deliver_finish+68     ip_local_deliver+255     ip_rcv+216     __netif_receive_skb_one_core+137     process_backlog+158     net_rx_action+309     __do_softirq+188     asm_call_sysvec_on_stack+15     do_softirq_own_stack+55     do_softirq.part.18+47     flush_smp_call_function_from_idle+68     do_idle+328     cpu_startup_entry+25     start_secondary+276     secondary_startup_64_no_verify+176 ]: 3 @[     fib_table_lookup+1     ip_route_output_key_hash_rcu+942     ip_route_output_key_hash+90     ip_route_output_flow+25     tcp_v4_connect+1209     __inet_stream_connect+210     inet_stream_connect+54     __sys_connect+154     __x64_sys_connect+22     do_syscall_64+48     entry_SYSCALL_64_after_hwframe+98 ]: 4 @[     fib_table_lookup+1     ip_route_output_key_hash_rcu+942     ip_route_output_key_hash+90     ip_route_output_flow+25     tcp_v4_connect+357     __inet_stream_connect+210     inet_stream_connect+54     __sys_connect+154     __x64_sys_connect+22     do_syscall_64+48     entry_SYSCALL_64_after_hwframe+98 ]: 4 @[     fib_table_lookup+1     ip_route_output_key_hash_rcu+942     ip_route_output_key_hash+90     tcp_v4_connect+943     __inet_stream_connect+210     inet_stream_connect+54     __sys_connect+154     __x64_sys_connect+22     do_syscall_64+48     entry_SYSCALL_64_after_hwframe+98 ]: 4 @[     fib_table_lookup+1     ip_route_input_slow+492     ip_route_input_rcu+609     ip_route_input_noref+37     ip_rcv_finish_core.isra.22+101     ip_rcv_finish+100     ip_rcv+216     __netif_receive_skb_one_core+137     process_backlog+158     net_rx_action+309     __do_softirq+188     asm_call_sysvec_on_stack+15     do_softirq_own_stack+55     do_softirq.part.18+47     flush_smp_call_function_from_idle+68     do_idle+328     cpu_startup_entry+25     start_secondary+276     secondary_startup_64_no_verify+176 ]: 11 @[     fib_table_lookup+1     __fib_validate_source+326     fib_validate_source+70     ip_route_input_slow+2498     ip_route_input_rcu+609     ip_route_input_noref+37     ip_rcv_finish_core.isra.22+101     ip_rcv_finish+100     ip_rcv+216     __netif_receive_skb_one_core+137     process_backlog+158     net_rx_action+309     __do_softirq+188     asm_call_sysvec_on_stack+15     do_softirq_own_stack+55     do_softirq.part.18+47     flush_smp_call_function_from_idle+68     do_idle+328     cpu_startup_entry+25     start_secondary+276     secondary_startup_64_no_verify+176 ]: 11

相关内容

热门资讯

第九分钟辅助!天天爱柳州辅助器... 天天爱柳州辅助器是一款可以让一直输的玩家,快速成为一个“必胜”的ai辅助神器,有需要的用户可以加我微...
热门推荐!微信小程序蜀山辅助器... 热门推荐!微信小程序蜀山辅助器免费下载(辅助)外挂辅助开挂插件(有挂秘诀)-哔哩哔哩;最新版2026...
第4分钟普及!奇迹陕西辅助器(... 第4分钟普及!奇迹陕西辅助器(透视)原来真的是有挂脚本(推荐开挂软件);奇迹陕西辅助器免费下载原版,...
第八分钟讲解!越乡游金花辅助,... 第八分钟讲解!越乡游金花辅助,九酷众游辅助,细节方法(有挂实锤)-哔哩哔哩1、下载安装好越乡游金花辅...
透视软件!浙江宝宝游戏辅助工具... 透视软件!浙江宝宝游戏辅助工具(辅助)外挂开挂辅助插件(了解有挂)-哔哩哔哩;是一款可以让一直输的玩...
第5分钟发现!桃乐甘肃麻将下载... 《第5分钟发现!桃乐甘肃麻将下载辅助器(辅助)原来有挂软件(必看开挂工具)》 桃乐甘肃麻将下载辅助器...
第8分钟了解!河洛刚次辅助,温... 第8分钟了解!河洛刚次辅助,温州茶苑辅助软件,详细教程(有挂攻略)-哔哩哔哩;无需打开直接搜索加薇1...
热点讨论!新二号辅助软件下载(... 热点讨论!新二号辅助软件下载(辅助)外挂辅助开挂软件(有挂教程)-哔哩哔哩;是一款可以让一直输的玩家...
8分钟解说!网易亲友圈辅助(开... 8分钟解说!网易亲友圈辅助(开挂)原来有挂平台(必看开挂安装);小薇(透视辅助)致您一封信;亲爱网易...
第5分钟开挂!如何在哈灵上辅助... 第5分钟开挂!如何在哈灵上辅助,决战卡五星辅助看牌器,解说技巧(有挂方略)-哔哩哔哩 了解更多开挂安...