> > Physical devices are read using /proc/net/dev
> > That is the old fashioned way.
> > The new fashioned one is to query them using rtnetlink. You use a
> > RTM_GETADDR
> > NLM_F_REQUEST query with wildcard (NLM_F_ROOT) to get a full list.
> > See the netlink,rtnetlink, libnetlink manpages and iproute2 as an example.
> > It is easier when you use libnetlink.
> Do you have a snippet of code?
Check iproute2 or zebra source. iproute2 has a libnetlink which is quite useful.
I also wrote some manpages (netlink(3),netlink(7),rtnetlink(7) etc, but
admittedly they are not very good)
> What kernel version does this start working?
Somewhere in Linux 2.1.<late number>
> Of course for code that needs to work with already deployed systems, you
> need to have code for the old method around anyway...
Only when you still want to support 2.0. Ok some people do not enable
netlink in their kernel configuration, but many modern distributions
require it for booting now (because the network init scripts use iproute2),
so this shouldn't be a big issue anymore.