C/C++ Linux MAC Address of all interfaces
You should stop using net-tools and the archaic ioctl interface, and start on using the modern Netlink/sysfs interfaces. You have no less than 5 possibilities:
- write your own Netlink-interfacing code
- your own NL code, in combination utilizing libmnl (-> see rtnl-link-dump in Examples
- or utilize autonomous libs like libnl3
- parse text output of
ip -o link
(-o is to get output meant for text parsing, unlike ifconfig) - or use sysfs and just look at
/sys/class/net/eth0/address