Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
sendmsg()如果为 设置了值,则可以使用它指定从哪个接口发送数据报in_pktinfo.ipi_ifindex。
sendmsg()
in_pktinfo.ipi_ifindex
如果数据包是对收到的数据报的响应,recvmsg()我可以从那里获取接口值。
recvmsg()
如果我只知道 'eth0' 或 'eno1' 的接口,我如何查找相应的 `in_pktinfo.ipi_ifindex' 值?
用于if_nametoindex()将接口名称转换为索引。
if_nametoindex()
if_indextoname()做相反的事情。
if_indextoname()