Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to obtrain MAC address with devctl: (4 Items)
   
How to obtrain MAC address with devctl  
Hello, 
I am trying to obtain the MAC address by using DCMD_IO_NET_NICINFO command.
Here is the snippet code:

Nic_t nic;

fd = open( "/dev/bpf", O_RDWR );
devctl(fd, DCMD_IO_NET_NICINFO , &nic, sizeof( Nic_t ), NULL);

The result is always FF into the permanent_address[] filed.
I tried with "/dev/bpf0", same result.
Could you please advise what is wrong?!?
Thank you in forward,
Kostadin Vardin
RE: How to obtrain MAC address with devctl  
/dev/bpf doesn't support nicinfo.  The recommended
way is getifaddrs() / freeifaddrs().

Regards,

-seanb

-----Original Message-----
From: Kostadin Vardin [mailto:community-noreply@qnx.com]
Sent: Thu 7/15/2010 9:06 PM
To: general-networking
Subject: How to obtrain MAC address with devctl
 
Hello, 
I am trying to obtain the MAC address by using DCMD_IO_NET_NICINFO command.
Here is the snippet code:

Nic_t nic;

fd = open( "/dev/bpf", O_RDWR );
devctl(fd, DCMD_IO_NET_NICINFO , &nic, sizeof( Nic_t ), NULL);

The result is always FF into the permanent_address[] filed.
I tried with "/dev/bpf0", same result.
Could you please advise what is wrong?!?
Thank you in forward,
Kostadin Vardin




_______________________________________________

General
http://community.qnx.com/sf/go/post59605


Attachment: Text winmail.dat 2.8 KB
Re: RE: How to obtrain MAC address with devctl  
Than you Sean,
I have implemented your idea!
Re: How to obtrain MAC address with devctl  
Hi

I see that you are sending devctl to /dev/bpf driver. I am not very familiar
with BPF concepts but in your case it seems that you should send devctl to
driver of the actual network interface e.g. /dev/io-pkt/en0 etc.

Maybe do a listing in /dev/io-pkt/ and see which network interface you are
interested in...

HTH
VG


On Fri, Jul 16, 2010 at 6:36 AM, Kostadin Vardin
<community-noreply@qnx.com>wrote:

> Hello,
> I am trying to obtain the MAC address by using DCMD_IO_NET_NICINFO command.
> Here is the snippet code:
>
> Nic_t nic;
>
> fd = open( "/dev/bpf", O_RDWR );
> devctl(fd, DCMD_IO_NET_NICINFO , &nic, sizeof( Nic_t ), NULL);
>
> The result is always FF into the permanent_address[] filed.
> I tried with "/dev/bpf0", same result.
> Could you please advise what is wrong?!?
> Thank you in forward,
> Kostadin Vardin
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post59605
>
>