tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Retrieving MAC address from struct ifnet
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
Home |
Main Index |
Thread Index |
Old Index