Looking for C example of ARP lookup on FreeBSD

Laslett, Greg greglas at calm.wa.gov.au
Thu Jan 22 01:24:42 PST 2004


Hi,

The code that is being ported uses the 'ioctl' method to request a MAC address.
eg:
    struct arpreq            ReqARP;
    struct sockaddr_in  *pAddr_in;
    SOCKET                 s;
    .
    .
    s = socket(AF_INET, SOCK_DGRAM, 0);
    ioctl(s, SIOCGARP, &ReqARP);
    .
    .

This does not appear to be supported under FreeBSD.  Presumably a sysctl or other mechanism exists.

Can anyone provide a code fragment showing IP4 to MAC address translation.

Thanks,
Greg.



More information about the freebsd-questions mailing list