[Goodies-dev] [Bug 10822] Use of ifconfig
bugzilla-daemon at xfce.org
bugzilla-daemon at xfce.org
Thu Apr 17 23:01:17 CEST 2014
https://bugzilla.xfce.org/show_bug.cgi?id=10822
--- Comment #7 from Landry Breuil <landry at xfce.org> ---
t.c:16: error: 'AF_PACKET' undeclared (first use in this function)
Seems AF_PACKET is linux only, and on bsd AF_LINK should be used instead. At
least on OpenBSD here it works.
http://stackoverflow.com/questions/9148425/freebsd-network-interface-information
renton:/tmp/ $cat t.c
#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#include <stdio.h>
int main() {
struct ifaddrs *ifaddr, *ifa;
if (getifaddrs(&ifaddr) == -1) {
return 1;
}
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
if (ifa->ifa_addr == NULL)
continue;
if (ifa->ifa_addr->sa_family == AF_LINK)
printf ("iface:%s\n",ifa->ifa_name);
}
return 0;
}
renton:/tmp/ $make t
cc -O2 -pipe -o t t.c
renton:/tmp/ $./t
iface:lo0
iface:em0
iface:fxp0
iface:enc0
iface:pflog0
--
You are receiving this mail because:
You are the QA Contact for the bug.
More information about the Goodies-dev
mailing list