On 15 November 2011 16:21, Thomas Jeunet <[email protected]> wrote:
> Hello,
>
> I'm using nmap on openbsd, following -current, and recently it stopped 
> working.
> I get the following message :
>
> Starting Nmap 5.51 ( http://nmap.org ) at 2011-11-15 19:05 CET
> Warning: Unable to get hardware address for interface em0 -- skipping it.
> WARNING: Unable to find appropriate interface for system route to <IP
> of gateway>
> nexthost: failed to determine route to <target>
> QUITTING!
>
> The message comes from nmap-5.51/nmap-5.51/libnetutil/netutil.cc :
> if (eth_get(ethsd, &ethaddr) != 0) {
>   netutil_error("Warning: Unable to get hardware address for interface %s
>   continue;
> }
> and eth_get is defined in libdnet-1.12/libdnet-1.12/src/eth-bsd.c :
> int
> eth_get(eth_t *e, eth_addr_t *ea)
> {
>    struct if_msghdr *ifm;
>    struct sockaddr_dl *sdl;
>    struct addr ha;
>    u_char *p, *buf;
>    size_t len;
>    int mib[] = { CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0 };
>
>    if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0)
>        return (-1);
>
>    if ((buf = malloc(len)) == NULL)
>        return (-1);
>
>    if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) {
>        free(buf);
>        return (-1);
>    }
>    for (p = buf; p < buf + len; p += ifm->ifm_msglen) {
>        ifm = (struct if_msghdr *)p;
>        sdl = (struct sockaddr_dl *)(ifm + 1);
>
>        if (ifm->ifm_type != RTM_IFINFO ||
>            (ifm->ifm_addrs & RTA_IFP) == 0)
>            continue;
>
>        if (sdl->sdl_family != AF_LINK || sdl->sdl_nlen == 0 ||
>            memcmp(sdl->sdl_data, e->device, sdl->sdl_nlen) != 0)
>            continue;
>
>        if (addr_ston((struct sockaddr *)sdl, &ha) == 0)
>            break;
>    }
>    free(buf);
>
>    if (p >= buf + len) {
>        errno = ESRCH;
>        return (-1);
>    }
>    memcpy(ea, &ha.addr_eth, sizeof(*ea));
>
>    return (0);
> }
>
> Is anyone also facing this issue? Anyone having a clue on why whould
> eth_get fail?
>
>
> Cheers,
> best regards
> --
> Thomas Jeunet
>
>

Rebuild libdnet, there was a change in an ioctl.
libdnet version is being bumped so others should not see this anymore.

Reply via email to