]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
linux: fix a regression in how enslaved devices' MAC addresses are retrieved
authorVincent Bernat <bernat@luffy.cx>
Sun, 15 Sep 2013 09:29:46 +0000 (11:29 +0200)
committerVincent Bernat <bernat@luffy.cx>
Sun, 15 Sep 2013 09:29:46 +0000 (11:29 +0200)
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
src/daemon/interfaces-linux.c

diff --git a/NEWS b/NEWS
index 76a56ab2333e9ee452d11a1ec21fefb9d7b2dc06..8c48eebbd4cfa739a4b92d04ae34a24239ac6a79 100644 (file)
--- 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:
index f756d9a52443d766e6921ee40140e2329440be1a..dcf482dca1e49ea026eef0a86c24e1b872a655b6 100644 (file)
@@ -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);