]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
interfaces: remove old bridge code
authorVincent Bernat <vincent@bernat.im>
Fri, 25 Sep 2015 09:04:02 +0000 (11:04 +0200)
committerVincent Bernat <vincent@bernat.im>
Fri, 25 Sep 2015 09:04:02 +0000 (11:04 +0200)
It has been ages since sysfs contains the interface for querying a
bridge (2.6.7). And nowadays, sysfs is always enabled.

NEWS
src/daemon/interfaces-linux.c

diff --git a/NEWS b/NEWS
index 890aeaf50772439d737be4353b002ec866eff45b..50680a399d94c1eb109d05d6eefb1159da9a6207 100644 (file)
--- 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
index 30e4b8e21ba62205891d42986f08a038b5b310b8..c92d40d6339bec96766a914cc0d78182bfe3026b 100644 (file)
@@ -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 */