From 184bd19932493ee6c6997ed420a4bd7c6c6722d7 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 22 Dec 2012 23:45:48 +0100 Subject: [PATCH] interfaces: disable the use of ioctl for bridges ioctl for bridges are not needed since 2.6.14. Moreover, they don't play well with some drivers and they have an undefined behaviour in 32/64 bits mixed environment. Instead, we use sysfs. Moreover, we define a new configure option `--enable-oldies` which allows the use of those ioctl. Currently, anything not needed with a 2.6.18 kernel will be declared as oldies and disabled by default. --- NEWS | 3 +++ configure.ac | 4 ++++ src/daemon/interfaces-linux.c | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index f6561c75..dc6ccd38 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ lldpd (0.6.2) + Allow to filter debug logs using tokens. Add more debug logs. + lldpctl can now output JSON. + Use netlink to gather interface information. + + Don't use ioctl for bridges anymore. The configure option + `--enable-oldies` allow to reenable their uses for systems not + supporting sysfs. lldpd (0.6.1) * Features: diff --git a/configure.ac b/configure.ac index 38a2e8c2..e969a4a6 100644 --- a/configure.ac +++ b/configure.ac @@ -149,6 +149,9 @@ lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes]) lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes]) lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes]) +# Oldies +lldp_ARG_ENABLE([oldies], [Compatibility with kernel older than 2.6.18], [no]) + ####################### # Output results AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"]) @@ -182,6 +185,7 @@ cat <name, IFNAMSIZ); return 0; } +#endif static int old_iface_is_bridge(struct lldpd *cfg, struct netlink_interface_list *interfaces, struct netlink_interface *iface) { +#ifdef ENABLE_OLDIES int ifindices[MAX_BRIDGES]; char ifname[IFNAMSIZ]; int num, i; @@ -178,6 +181,7 @@ old_iface_is_bridge(struct lldpd *cfg, else if (strncmp(iface->name, ifname, IFNAMSIZ) == 0) return 1; } +#endif return 0; } @@ -207,6 +211,7 @@ old_iface_is_bridged_to(struct lldpd *cfg, struct netlink_interface *slave, struct netlink_interface *master) { +#ifdef ENABLE_OLDIES int j; int ifptindices[MAX_PORTS]; unsigned long args2[4] = { BRCTL_GET_PORT_LIST, @@ -228,7 +233,7 @@ old_iface_is_bridged_to(struct lldpd *cfg, if (ifptindices[j] == slave->index) return 1; } - +#endif return 0; } -- 2.39.5