QNX 6.1 - Get route, MAC information

I want to get the routing information, similar to netstat -nr, along
with the MAC address for each IP address from a c program on QNX 6.1.
I’ve tried with sysctl() but just couldn’t get/didn’t have enough
information to use it properly. Does anyone know of a relatively
straightforward way of getting this?

The most relevant information I’ve found so far is this previous post:

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

… but I haven’t tried it yet, so I can’t confirm that this is relevant
for qnx 6.1.

BTW, I’m communicating with each of the nodes using tcpip.

Thanks in advance

Ron_

Forgot to mention that the posting I referenced refers only to the ARP,
not route, information.


Ron wrote:

I want to get the routing information, similar to netstat -nr, along
with the MAC address for each IP address from a c program on QNX 6.1.
I’ve tried with sysctl() but just couldn’t get/didn’t have enough
information to use it properly. Does anyone know of a relatively
straightforward way of getting this?

The most relevant information I’ve found so far is this previous post:

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

… but I haven’t tried it yet, so I can’t confirm that this is relevant
for qnx 6.1.

BTW, I’m communicating with each of the nodes using tcpip.

Thanks in advance

Ron