我有一个任务要消除
<app> uses obsolete (PF_INET,SOCK_PACKET)
来自用户空间客户端的警告。 如果这种类型的使用已经过时;此任务的正确、类似的替代方法是什么?
编辑:这里有误导性信息。
最佳答案
检查 man 7 packet
和 man 7 ip
了解更多信息,但看起来您需要的是
socket(PF_PACKET, SOCK_RAW, <protocol>)
"For compatibility with Linux 2.0, the obsolete socket(PF_INET,
SOCK_RAW, protocol) syntax is still supported to open a
packet(7) socket. This is deprecated and should be replaced by
socket(PF_PACKET, SOCK_RAW, protocol) instead. The main
difference is the new sockaddr_ll address structure for generic
link layer information instead of sockaddr_pkt." - ip(7)
虽然我不知道可能需要进行哪些额外更改。
关于linux - 什么是 (PF_INET,SOCK_PACKET) 的正确替代品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6060550/