(PF_INET,SOCK_PACKET) 的正确替换是什么

发布于 2024-11-08 14:56:20 字数 161 浏览 4 评论 0原文

我的任务是消除

<app> uses obsolete (PF_INET,SOCK_PACKET)

用户空间客户端的警告。 如果这种类型的使用已经过时;该任务的正确且类似的替代是什么?

编辑:这里有误导性信息。

I am given a task to eliminate the

<app> uses obsolete (PF_INET,SOCK_PACKET)

warning from a userspace client.
If this type of use is obsolete; what is the correct, similar replacement for this task?

Edit: There was misleading information here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

兔小萌 2024-11-15 14:56:20

检查 man 7 packetman 7 ip 了解更多信息,但看起来您需要的是

socket(PF_PACKET, SOCK_RAW,)

"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)

虽然我不知道可能需要进行哪些额外的更改。

Check man 7 packet and man 7 ip for more information, but it looks like what you need is

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)

Although I don't know what additional changes might be required.

糖果控 2024-11-15 14:56:20

问题是调用 socket(AF_INET, SOCK_PACKET, htons(0x0806)) 的库函数,而不是应用程序本身。

The problem is a library function calling socket(AF_INET, SOCK_PACKET, htons(0x0806)), and not the application itself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文