libnet_get_hwaddr() failing with FreeBSD 8

Charles Owens cowens at greatbaysoftware.com
Tue Feb 2 03:20:10 UTC 2010


Hello,

I'm working with some code (snippet below) that fails with
libnet_get_hwaddr() function (it returns false).  The code works fine
under 7.x but not with 8.0 .

Any thoughts as to what might be going on?

Thanks much,

Charles



int
get_hw_addr(char *device, u_char mac[6])
{
        struct libnet_ether_addr        *mac_address;
        libnet_t                *ln;
        char                    err_buf[LIBNET_ERRBUF_SIZE];

        ln = libnet_init(LIBNET_LINK, device, err_buf);
        if (!ln) {
                fprintf(stderr, "libnet_open_link_interface: %s\n", err_buf);
                return -1;
        }

        mac_address = libnet_get_hwaddr(ln);
        if (!mac_address) {
                fprintf(stderr,  "libnet_get_hwaddr: %s\n", err_buf);
                return -1;
        }

        memcpy(mac, mac_address->ether_addr_octet, 6);

        return 0;
}



-- 
 Charles Owens
 Great Bay Software, Inc.




More information about the freebsd-net mailing list