From: Vincent Bernat Date: Sun, 15 Sep 2013 09:29:46 +0000 (+0200) Subject: linux: fix a regression in how enslaved devices' MAC addresses are retrieved X-Git-Tag: 0.7.7~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12baf7811f638f45ec0be61df08734f40c2f2634;p=thirdparty%2Flldpd.git linux: fix a regression in how enslaved devices' MAC addresses are retrieved The MAC address of an enslaved device was not retrieved correctly. `iflinux_get_permanent_mac()` was called with the master device instead of the enslaved device. Most of the time, no warning was issued except when the master device was a slave of another device (for example, a bridge). This closes #45. --- diff --git a/NEWS b/NEWS index 76a56ab2..8c48eebb 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ lldpd (0.7.7) * Fixes: + Various bugs related to fixed point number handling (for coordinates in LLDP-MED) + + Fix a regression in how MAC address of an enslaved device is + retrieved. lldpd (0.7.6) * Features: diff --git a/src/daemon/interfaces-linux.c b/src/daemon/interfaces-linux.c index f756d9a5..dcf482dc 100644 --- a/src/daemon/interfaces-linux.c +++ b/src/daemon/interfaces-linux.c @@ -278,7 +278,7 @@ iflinux_get_permanent_mac(struct lldpd *cfg, char path[SYSFS_PATH_MAX]; char line[100]; - if ((master = iface->upper) == NULL) + if ((master = iface->upper) == NULL || master->type != IFACE_BOND_T) return; log_debug("interfaces", "get MAC address for %s", @@ -669,8 +669,6 @@ iflinux_add_bond(struct lldpd *cfg, "interface %s is a bond", iface->name); iface->type |= IFACE_BOND_T; - iflinux_get_permanent_mac(cfg, - interfaces, iface); } } } @@ -751,6 +749,9 @@ iflinux_add_physical(struct lldpd *cfg, continue; } + /* Get the real MAC address (for example, if the interface is enslaved) */ + iflinux_get_permanent_mac(cfg, interfaces, iface); + log_debug("interfaces", "%s is a physical interface", iface->name);