【发布时间】:2015-12-15 06:55:49
【问题描述】:
我正在将代码从 linux 移植到 OS X,但出现这些错误:
src/proxy_linux.c:784: error: 'SIOCGIFHWADDR' undeclared (first use in this function)
src/proxy_linux.c:784: error: (Each undeclared identifier is reported only once
src/proxy_linux.c:784: error: for each function it appears in.)
src/proxy_linux.c:788: error: 'struct ifreq' has no member named 'ifr_hwaddr'
我使用 Mac OS X 10.7.5 (11G63) ) 作为开发系统。
SIOCGIFHWADDR 在 OS X 上不受支持,我找不到任何可以列出所有接口的 IP 地址和 MAC 地址的可靠来源。我在苹果开发者网站上找到的唯一一个使用“IOKit”,它也不向后兼容。在这方面的任何帮助将不胜感激
【问题讨论】:
-
为什么不使用
arp进行mac-ip 检索? -
@hacks 我猜你在谈论 linux 命令,但我想要一些关于语句/函数调用序列的提示,通过这些我可以检索与 ip addr 相关的信息以及所有 C 中的所有信息
-
你需要在你的mac上安装
arp包。我在我的mac上使用它。安装macport,然后通过它进行arp。