]> git.ipfire.org Git - thirdparty/lldpd.git/commit
interfaces: switch to Netlink to gather interface-related information
authorVincent Bernat <bernat@luffy.cx>
Thu, 20 Dec 2012 07:28:29 +0000 (08:28 +0100)
committerVincent Bernat <bernat@luffy.cx>
Sat, 22 Dec 2012 19:25:59 +0000 (20:25 +0100)
commite12c2365d18e80557409226a3fe9c62c27f039c1
tree541505b3a8cbcc901482294f540df339cdad4856
parentd902e68880f1c0aa9b18e686276fba7d5c07edfd
interfaces: switch to Netlink to gather interface-related information

Instead of using getifaddrs() which gives incomplete information, we
use Netlink which is supported since a long time. Many information are
supported by Netlink: bonding, bridging, VLAN... Unfortunately, the
degree of support depends on the version of the kernel:

 - IFLA_VLAN_* stuff is available since 2.6.23 only.
 - IFLA_MASTER seems to be supported since ages (at least
   2.4.32). However, it does not allow to differentiate a bridge and a
   bonding. It does not apply to a VLAN.
 - IFLA_LINK is not sent for a VLAN before 2.6.23.
 - IFLA_BRPORT_* has just landed in Linux.
 - IFLA_LINKINFO and IFLA_INFO_KIND which could help detect the kind
   of device are only available since 2.6.23.

So, in summary, we can't reliably use Netlink to gather VLAN, bridging
and bonding information if we want to support 2.6.18 kernels. When
2.6.23 will be the minimal version, we could do some interesting
things. Also, it seems that ethtool stuff is not available through
Netlink.

This commit also happens to prepare the support of additional OS. Only
interfaces-linux.c (and netlink.c) are now Linux specific. Adding
support for KFreeBSD should be easy enough. More code factorisation
will happen then.
19 files changed:
NEWS
README.md
configure.ac
m4/os.m4 [new file with mode: 0644]
src/compat/compat.h
src/compat/getifaddrs.c [deleted file]
src/daemon/Makefile.am
src/daemon/dmi.c
src/daemon/interfaces-linux.c [moved from src/daemon/interfaces.c with 75% similarity]
src/daemon/lldp.c
src/daemon/lldpd.8
src/daemon/lldpd.c
src/daemon/lldpd.h
src/daemon/netlink.c [new file with mode: 0644]
src/daemon/priv.c
src/lldpd-structs.c
src/lldpd-structs.h
tests/Makefile.am
tests/check_ifaddrs.c [deleted file]