]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
interfaces: fix initialization of hardware h_data for bonds
authorVincent Bernat <vincent@bernat.im>
Sun, 26 Oct 2014 09:54:57 +0000 (10:54 +0100)
committerVincent Bernat <vincent@bernat.im>
Sun, 26 Oct 2014 10:12:50 +0000 (11:12 +0100)
On discovery, the master index was not correctly initialized and
therefore, the information was not retrieved correctly and therefore
listening on bond devices was broken since 0.7.0 (netlink rewrite).

NEWS
src/daemon/interfaces-linux.c

diff --git a/NEWS b/NEWS
index 094e729f2bd8194d6a5a9c8bd264cce280368da8..6879aa7a62397da78ebea164601c78c93cecda89 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 lldpd (0.7.12)
   * Fix:
-    + Don't complain when parsing a commented line
+    + Don't complain when parsing a commented line.
+    + Fix listening on bond devices.
 
 lldpd (0.7.11)
   * Features:
index 956470a313ba1cf40437636958473f63a5b5375f..85d8f986cecf3cbb298f4b7f34599e8b937c3469 100644 (file)
@@ -551,12 +551,14 @@ iflinux_handle_bond(struct lldpd *cfg, struct interfaces_device_list *interfaces
                                    iface->name);
                                continue;
                        }
-                       hardware->h_data = calloc(1, sizeof(struct bond_master));
-                       if (!hardware->h_data) {
+                       bmaster = hardware->h_data = calloc(1, sizeof(struct bond_master));
+                       if (!bmaster) {
                                log_warn("interfaces", "not enough memory");
                                lldpd_hardware_cleanup(cfg, hardware);
                                continue;
                        }
+                       bmaster->index = master->index;
+                       strlcpy(bmaster->name, master->name, IFNAMSIZ);
                        if (iface_bond_init(cfg, hardware) != 0) {
                                log_warn("interfaces", "unable to initialize %s",
                                    hardware->h_ifname);