From 08ced6b4edf2d129b5e550b0c1b6aab09531302a Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 26 Oct 2014 10:54:57 +0100 Subject: [PATCH] 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). --- NEWS | 3 ++- src/daemon/interfaces-linux.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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); -- 2.39.5