ARP table access

Does anyone know the most efficient way of accessing the arp table. I need
to decode the MAC addresses of some devices on the ethernet network. I know
the IPs but need to know their MACs. Any suggestion is appreciated.

Thanks,
Mike Lee

From program or utils ?

You have /usr/bin/arp to exam your arp table.
Programmally, you want to look at sys/sockio.h (SIOCG/SARP), and
net/if_arp.h. If you can’t figure out from these headers, the best bet is
get the source of “arp” (from *BSD) and look into there.

-xtang


Mike Lee <mikel@berkeleyprocess.com> wrote in message
news:b01bde$e2p$1@inn.qnx.com

Does anyone know the most efficient way of accessing the arp table. I need
to decode the MAC addresses of some devices on the ethernet network. I
know
the IPs but need to know their MACs. Any suggestion is appreciated.

Thanks,
Mike Lee

Mike Lee wrote:

Does anyone know the most efficient way of accessing the arp table. I need
to decode the MAC addresses of some devices on the ethernet network. I know
the IPs but need to know their MACs. Any suggestion is appreciated.

#include <sys/dcmd_chr.h>
#include <sys/dcmd_io-net.h>

// allow access to IO resources
ThreadCtl(_NTO_TCTL_IO, 0);

if ((fd = open("/dev/io-net/en0", O_RDONLY)) == -1)
{
perror(“Can’t open /dev/io-net/en0 \n”);
exit(-1);
}

devctl(fd, DCMD_IO_NET_NICINFO, &nval, sizeof(nval), NULL);

for (i=0; i < 6; i++)
sprintf(&buffer[i*2], “%02X”, nval.permanent_address_);

// permanent_address should be the MAC address of the NIC.


Hope this helps …

Armin

http://www.steinhoff-automation.com_