Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Feb 2010 22:24:29 -0500
From:      Charles Owens <cowens@greatbaysoftware.com>
To:        freebsd-net@freebsd.org
Subject:   libnet_get_hwaddr() failing with FreeBSD 8
Message-ID:  <4B679AED.9040308@greatbaysoftware.com>

next in thread | raw e-mail | index | archive | help

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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B679AED.9040308>