]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
interfaces: disable the use of ioctl for bridges
authorVincent Bernat <bernat@luffy.cx>
Sat, 22 Dec 2012 22:45:48 +0000 (23:45 +0100)
committerVincent Bernat <bernat@luffy.cx>
Sat, 22 Dec 2012 22:45:48 +0000 (23:45 +0100)
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
configure.ac
src/daemon/interfaces-linux.c

diff --git a/NEWS b/NEWS
index f6561c75f3e4b720df2ea4dbb26e59a1120df077..dc6ccd38f3ecae15256bbba9e05846440e7424ec 100644 (file)
--- 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:
index 38a2e8c26f16bb96fc9dedb1fcbf1f688c7dea9a..e969a4a692b5ed5aac3e8ec32ffaa6ac6289fee7 100644 (file)
@@ -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 <<EOF
   DOT3...........: $enable_dot3
   XML output.....: ${with_xml-no}
   JSON output....: ${with_json-no}
+  Oldies support.: $enable_oldies
 ---------------------------------------------
 
 Check the above options and compile with:
index 8d8858c236c66810e074e23a5cafb822263fe918..9a1c11389fbdb9b81e2145067e099fd795285863 100644 (file)
@@ -145,6 +145,7 @@ iface_indextointerface(struct netlink_interface_list *interfaces,
        return NULL;
 }
 
+#ifdef ENABLE_OLDIES
 static int
 iface_indextoname(struct netlink_interface_list *interfaces,
     int index, char *name)
@@ -155,12 +156,14 @@ iface_indextoname(struct netlink_interface_list *interfaces,
        strncpy(name, iface->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;
 }