Forum Topic - io-pkt: how to retrieve MAC address:
   
io-pkt: how to retrieve MAC address  
With io-net, I successfully used the follwoing code:
	sprintf(full_int_name, "/dev/io-net/%s","en0"); 
	if ((fd = open(full_int_name, O_RDONLY)) == -1) 
	{ 
		return(-1); 
	} 
	devctl(fd, DCMD_IO_NET_GET_CONFIG, &nicinfo, sizeof(nicinfo), NULL);

With io-pkt, use the driver name "/root/patches/iopkt/bin/io-pkt-v6-hc/fxp0". That's where io-pkt is installed.
However, the open() fails.
- How can I find out the correct location of io-pkt?
- Is there antother method how to retrieve the MAC address? I saw some linux code like
fd = socket(AF_INET, SOCK_DGRAM, 0);
ioctl(fd, SIOCGIFHWADDR, &ifr);
, but SIOCGIFHWADDR is not known.

Re: io-pkt: how to retrieve MAC address  
On Wed, Oct 15, 2008 at 02:44:25AM -0400, Thomas Zauner wrote:

> With io-net, I successfully used the follwoing code:
> 	sprintf(full_int_name, "/dev/io-net/%s","en0"); 
> 	if ((fd = open(full_int_name, O_RDONLY)) == -1) 
> 	{ 
> 		return(-1); 
> 	} 
> 	devctl(fd, DCMD_IO_NET_GET_CONFIG, &nicinfo, sizeof(nicinfo), NULL);
> 
> With io-pkt, use the driver name "/root/patches/iopkt/bin/io-pkt-v6-hc/fxp0". That's where io-pkt is installed.
> However, the open() fails.
> - How can I find out the correct location of io-pkt?
> - Is there antother method how to retrieve the MAC address? I saw some linux code like
> fd = socket(AF_INET, SOCK_DGRAM, 0);
> ioctl(fd, SIOCGIFHWADDR, &ifr);
> , but SIOCGIFHWADDR is not known.
> 

You can use getifaddrs(), freeifaddrs().  Please see 
utils/i/ifconfig/af_link.c in the networking repository.


-seanb
Re: io-pkt: how to retrieve MAC address  
Thank you! This worked.
Re: io-pkt: how to retrieve MAC address  
> On Wed, Oct 15, 2008 at 02:44:25AM -0400, Thomas Zauner wrote:
> 
[clip]
> 
> You can use getifaddrs(), freeifaddrs().  Please see 
> utils/i/ifconfig/af_link.c in the networking repository.

I can't find the include file if_addrs.h in my QNX 6.4 installation.

 Is it part of one of these special TDKs ??

Best Regards

--Armin




Re: io-pkt: how to retrieve MAC address  
On Thu, Jan 15, 2009 at 12:44:18PM -0500, Armin Steinhoff wrote:
> > On Wed, Oct 15, 2008 at 02:44:25AM -0400, Thomas Zauner wrote:
> > 
> [clip]
> > 
> > You can use getifaddrs(), freeifaddrs().  Please see 
> > utils/i/ifconfig/af_link.c in the networking repository.
> 
> I can't find the include file if_addrs.h in my QNX 6.4 installation.
> 
>  Is it part of one of these special TDKs ??
> 

You mean <ifaddrs.h> ?

-seanb
Re: io-pkt: how to retrieve MAC address  
> On Thu, Jan 15, 2009 at 12:44:18PM -0500, Armin Steinhoff wrote:
> > > On Wed, Oct 15, 2008 at 02:44:25AM -0400, Thomas Zauner wrote:
> > > 
> > [clip]
> You mean <ifaddrs.h> ?


Yes,  I found it now in /usr/include after activating the option "resolve symbolic links" of Photons "find" utility =:-]


--Armin