Retrieving MAC address from struct ifnet

Beesdeckar <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Organization Soft in Engines
Message-ID <[email protected]>
Hello,

I am trying to read MAC address of network interface in kernel from 
member of struct ifnet:

struct ifaddr	*if_hwdl;

When I try to cycle through interfaces and I read first member of 
if_hwdl (struct	sockaddr *ifa_addr) the result for ethernet is:

sa_family: 18, sa_len: 17,
sa_data: 01 00 06 03 06 00 77 6D 30 F0 DE F1 8F AD EB 00 00

and the result for wireless is:

sa_family: 18, sa_len: 18,
sa_data: 02 00 06 04 06 00 69 77 6E 30 08 11 96 52 DA 90 00 00

where
F0 DE F1 8F AD EB
and
08 11 96 52 DA 90

are MAC addresses of my network cards.

How can I reliably retrieve index of first byte of these MAC addresses ?
Or does exist easier way how to retrieve MAC address from struct ifnet ?

Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.