linux - 什么是 (PF_INET,SOCK_PACKET) 的正确替代品

标签 linux sockets kernel obsolete

我有一个任务要消除

<app> uses obsolete (PF_INET,SOCK_PACKET)

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

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

最佳答案

检查 man 7 packetman 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/

相关文章:

c - 在子进程和父进程之间发送数据时如何使用两个管道?

r - 如何使用 conda 卸载 r-essentials?

c++ - 尽管使用了 fpic,但出现错误 "can not be used when making a shared object; recompile with -fPIC"

c++ - Qt 中的 WM_SOCKET

linux - 我如何让 python3 在文本文件中搜索特定的字符串

sockets - 横向扩展套接字服务器

ruby - 从 ruby​​ Socket.ip_address_list 中识别所有相关的 IP 地址

c - 如何使用C从PID中获取进程名称

c++ - 如何在不调用 "system()"的情况下使用 C++ 或 Qt 关闭 Linux?

c# - 是否可以使用 .net core c# 执行 ps -aux ?