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

相关内容

热门资讯

第8个猫腻!Wepoke辅助器... 第8个猫腻!Wepoke辅助器外挂透明挂辅助软件,竞技联盟打法软件透明挂(有挂教学)(哔哩哔哩)是一...
1篇热讯!wpk稳定外挂透明挂... 1篇热讯!wpk稳定外挂透明挂软件(透视)wpK透视辅助器神器(有挂攻略)-哔哩哔哩是一款可以让一直...
第九个猫腻!WPK技巧透明挂软... 第九个猫腻!WPK技巧透明挂软件(透视)WPk透视辅助外挂(有挂方针)-哔哩哔哩;人气非常高,ai更...
九分钟讲解!(wePOke)透... 九分钟讲解!(wePOke)透明挂透视神器!(软件透明挂)外挂辅助神器软件(哔哩哔哩);九分钟讲解!...
五分钟讲解!(Wepoke透视... 五分钟讲解!(Wepoke透视)外挂透明挂插件!(软件透明挂)外挂辅助神器开挂(哔哩哔哩)是一款可以...
九分钟讲解!(Wepoke新版... 九分钟讲解!(Wepoke新版)软件透明挂软件!(软件透明挂)外挂辅助透明挂工具(哔哩哔哩);1、点...
两分钟讲解!(Wepoke外挂... 两分钟讲解!(Wepoke外挂)透明挂神器!(软件透明挂)外挂辅助插件神器(哔哩哔哩)是一款可以让一...
六分钟讲解!(Wepoke稳定... 六分钟讲解!(Wepoke稳定)辅助透明挂透视挂!(软件透明挂)外挂辅助插件挂软件(哔哩哔哩)是一款...
第五个猫腻!Wepoke新更新... 第五个猫腻!Wepoke新更新外挂透明挂辅助器神器,wpk微扑克小程序软件透明挂(有挂总结)(哔哩哔...
第5个猫腻!WPK软件辅助透明... 自定义新版WPK透视系统规律,只需要输入自己想要的开挂功能,一键便可以生成出WPK透视专用辅助器,不...