From 31c9173ac0c006f9ba3329377bb271fb22b1f895 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 25 Sep 2015 11:04:02 +0200 Subject: [PATCH] interfaces: remove old bridge code It has been ages since sysfs contains the interface for querying a bridge (2.6.7). And nowadays, sysfs is always enabled. --- NEWS | 1 + src/daemon/interfaces-linux.c | 47 +---------------------------------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/NEWS b/NEWS index 890aeaf5..50680a39 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ lldpd (0.8.0) * Change: + Fix minimal kernel version to 2.6.39. Add a runtime warning when this is not the case. + + Remove old bridge code (the one using ioctl). + Don't discard down interfaces. Notably, this enables us to keep their specific configuration if any. + For Linux, switch to libnl3. Be aware of the licensing issues in diff --git a/src/daemon/interfaces-linux.c b/src/daemon/interfaces-linux.c index 30e4b8e2..c92d40d6 100644 --- a/src/daemon/interfaces-linux.c +++ b/src/daemon/interfaces-linux.c @@ -112,51 +112,6 @@ static struct lldpd_ops eth_ops = { }; #ifdef ENABLE_OLDIES -static int -old_iflinux_is_bridge(struct lldpd *cfg, - struct interfaces_device_list *interfaces, - struct interfaces_device *iface) -{ - int j; - int ifptindices[MAX_PORTS] = {}; - unsigned long args2[4] = { - BRCTL_GET_PORT_LIST, - (unsigned long)ifptindices, - MAX_PORTS, - 0 - }; - struct ifreq ifr = { - .ifr_data = (char*)&args2 - }; - - strlcpy(ifr.ifr_name, iface->name, IFNAMSIZ); - - if (ioctl(cfg->g_sock, SIOCDEVPRIVATE, &ifr) < 0) - /* This can happen with a 64bit kernel and 32bit - userland, don't output anything about this to avoid - to fill logs. */ - return 0; - - for (j = 0; j < MAX_PORTS; j++) { - struct interfaces_device *port; - if (!ifptindices[j]) continue; - port = interfaces_indextointerface(interfaces, ifptindices[j]); - if (!port) continue; - if (port->upper) { - log_debug("interfaces", - "strange, port %s for bridge %s already has upper interface %s", - port->name, iface->name, port->upper->name); - } else { - log_debug("interfaces", - "port %s is bridged to %s", - port->name, iface->name); - port->upper = iface; - } - } - return 1; -} -#endif - static int iflinux_is_bridge(struct lldpd *cfg, struct interfaces_device_list *interfaces, @@ -172,7 +127,7 @@ iflinux_is_bridge(struct lldpd *cfg, iface->name)) >= SYSFS_PATH_MAX) log_warnx("interfaces", "path truncated"); if ((f = priv_open(path)) < 0) - return old_iflinux_is_bridge(cfg, interfaces, iface); + return 0; close(f); /* Also grab all ports */ -- 2.39.5