Looking for C example of ARP lookup on FreeBSD

Ruben de Groot mail25 at bzerk.org
Thu Jan 22 02:59:23 PST 2004


On Thu, Jan 22, 2004 at 05:24:31PM +0800, Laslett, Greg typed:
> 
> 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.
 
Maybe a look at /usr/src/usr.sbin/arp/arp.c will help you.

Ruben

> Thanks,
> Greg.
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> 


More information about the freebsd-questions mailing list