On 2008/11/07 05:38, irix wrote:
>   When I try to use arping (using libnet) he sent
>   arp-who requests with wrong source mac

if you set the MAC address manually it does send with the correct
address. the problem is that libnet_get_hwaddr() doesn't handle
RTM_VERSION 4 route messages that we've been using since 4.3.

it's actually picking out part of the time-of-day where it should
be reading the MAC address. (this fails on i386 but just happens
to run on amd64..!)

> Subject: Re: bug in libnet-1.1 fix please

arping doesn't use libnet-1.1, it uses 1.0, though presumably
both have the problem.

it's too late for me to look any more now, but here's a stupid
test program cribbed from arping.c to demonstrate it more easily
than running arping and tcpdump. compile like:

$ cc -I /usr/local/include/libnet-1.0 foo.c `libnet-config-1.0 --libs` 
`libnet-config-1.0 --defines`

#include <libnet.h>
#include <stdio.h>

main()
{
        char ebuf[4096];
        struct libnet_link_int *l;
        struct ether_addr *e;
        unsigned char *ifname="trunk0";

        if (!(l = libnet_open_link_interface(ifname, ebuf))) {
                fprintf(stderr, "libnet_open_link_interface(): %s\n", ebuf);
                exit(1);
        }

        if (!(e = libnet_get_hwaddr(l, ifname, ebuf))) {
                fprintf(stderr, "libnet_get_hwaddr(): %s\n", ebuf);
                exit(1);
        }

        printf("%x:%x:%x:%x:%x:%x\n",
            e->ether_addr_octet[0],
            e->ether_addr_octet[1],
            e->ether_addr_octet[2],
            e->ether_addr_octet[3],
            e->ether_addr_octet[4],
            e->ether_addr_octet[5]);
}

Reply via email to