From: Vincent Bernat Date: Sun, 26 Oct 2014 09:54:57 +0000 (+0100) Subject: interfaces: fix initialization of hardware h_data for bonds X-Git-Tag: 0.7.12~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08ced6b4edf2d129b5e550b0c1b6aab09531302a;p=thirdparty%2Flldpd.git interfaces: fix initialization of hardware h_data for bonds 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). --- diff --git a/NEWS b/NEWS index 094e729f..6879aa7a 100644 --- 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: diff --git a/src/daemon/interfaces-linux.c b/src/daemon/interfaces-linux.c index 956470a3..85d8f986 100644 --- a/src/daemon/interfaces-linux.c +++ b/src/daemon/interfaces-linux.c @@ -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);