|
Re: io-pkt: how to retrieve MAC address
|
10/15/2008 8:33 AM
post15000
|
Re: io-pkt: how to retrieve MAC address
On Wed, Oct 15, 2008 at 02:44:25AM -0400, Thomas Zauner wrote:
> With io-net, I successfully used the follwoing code:
> sprintf(full_int_name, "/dev/io-net/%s","en0");
> if ((fd = open(full_int_name, O_RDONLY)) == -1)
> {
> return(-1);
> }
> devctl(fd, DCMD_IO_NET_GET_CONFIG, &nicinfo, sizeof(nicinfo), NULL);
>
> With io-pkt, use the driver name "/root/patches/iopkt/bin/io-pkt-v6-hc/fxp0". That's where io-pkt is installed.
> However, the open() fails.
> - How can I find out the correct location of io-pkt?
> - Is there antother method how to retrieve the MAC address? I saw some linux code like
> fd = socket(AF_INET, SOCK_DGRAM, 0);
> ioctl(fd, SIOCGIFHWADDR, &ifr);
> , but SIOCGIFHWADDR is not known.
>
You can use getifaddrs(), freeifaddrs(). Please see
utils/i/ifconfig/af_link.c in the networking repository.
-seanb
|
|
|