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

相关内容

热门资讯

黑科技教学!(Wepoke稳定... 【福星临门,好运相随】;黑科技教学!(Wepoke稳定)软件透明挂辅助透视!(aapoker有挂)w...
黑科技好友!wpk发牌逻辑,a... 黑科技好友!wpk发牌逻辑,ai机器人代打德州,切实教程(新版有挂)-哔哩哔哩;相信小伙伴都知道这个...
5分钟领会!拱趴大菠萝挂怎么安... 5分钟领会!拱趴大菠萝挂怎么安装,hhpoker有没有透视挂(透视)AA德州教程(有挂秘籍)1、下载...
5分钟掌握!wepoke调控参... 5分钟掌握!wepoke调控参数(透明挂黑科技)外挂透明挂辅助黑科技(2022已更新)(哔哩哔哩);...
我来分享!(红龙扑克)外挂辅助... 我来分享!(红龙扑克)外挂辅助透视下载!(红龙扑克辅助工具)安装教程(2020已更新)(哔哩哔哩);...
一分钟带你了解!wepoke有... 一分钟带你了解!wepoke有安卓版,德州AI智能辅助机器人,详细教程(有挂功能)-哔哩哔哩;致您一...
5分钟体悟!德扑之心免费透视,... 5分钟体悟!德扑之心免费透视,拱趴大菠萝开挂方法(透视)揭秘攻略(有挂方式)1、拱趴大菠萝开挂方法透...
八分钟熟悉!wopoker辅助... 八分钟熟悉!wopoker辅助(透明挂黑科技)外挂透明挂辅助挂(2023已更新)(哔哩哔哩);wop...
透视app!(pokerx)外... 透视app!(pokerx)外挂透明挂ai辅助器!(wpk辅助透视)新2025教程(2024已更新)...
实测交流!德州ai人工智能软件... 实测交流!德州ai人工智能软件免费,微扑克可以用ai辅助,详细教程(真的有挂)-哔哩哔哩;德州ai人...