From 12baf7811f638f45ec0be61df08734f40c2f2634 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 15 Sep 2013 11:29:46 +0200 Subject: [PATCH] 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. --- NEWS | 2 ++ src/daemon/interfaces-linux.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) 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); -- 2.39.5