如何编写内核模块来查找内核中的路由表和arp缓存? [英] How to write a kernel module to lookup route table and arp cache in kernel?

查看:595
本文介绍了如何编写内核模块来查找内核中的路由表和arp缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个模块来查找内核中获取网关ip的路由表,并使用ip查找arp缓存来获取网关的mac地址。

I want to write a module to lookup the route table in kernel for getting the gateway ip, and use the ip to lookup arp cache for getting the gateway's mac address.

推荐答案

fib_lookup :查找路由表。定义在 net / ipv4 / route.c

fib_lookup: looking up route table. Defined at net/ipv4/route.c.

ipv4_neigh_lookup :使用struct邻居(ARP协议由邻居子系统实现)发送SKB。

ipv4_neigh_lookup: using struct neighbour (ARP protocol is implemented by neighbour subsystem) to send the SKB.

通过 ip_route_input_slow 有关路由表和邻居子系统的更多详细信息。

Go through ip_route_input_slow for more detail about the route table and neighbour subsystem.

这篇关于如何编写内核模块来查找内核中的路由表和arp缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆