]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
netlink: clear IFF_SLAVE when no information on upper interface
authorVincent Bernat <vincent@bernat.im>
Sat, 21 Jan 2017 11:40:51 +0000 (12:40 +0100)
committerVincent Bernat <vincent@bernat.im>
Sat, 21 Jan 2017 11:40:51 +0000 (12:40 +0100)
This means that we have just been enslaved, but don't know the
master. On Linux, enslaved device are handled differently of regular
device. When we are half-enslaved (no upper interface yet), we are still
a regular interface. When we are fully enslaved, we may do nothing
because there is no local change (since flags are the same). Therefore,
clear the flag to avoid this issue.

NEWS
src/daemon/netlink.c

diff --git a/NEWS b/NEWS
index f2daa5c148612c54de873221f48143bbd6c49010..9ca6342a0fd287ee99e64592a019c445d711e2b7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ lldpd (0.9.6)
     + Correctly parse LLDP-MED civic address when the length of the
       TLV exceeds the length of the address.
     + Fix 100% CPU on some rare error condition.
+    + Fix lost timer when an interface is enslaved on Linux.
 
 lldpd (0.9.5)
   * Change:
index 64f170b7e1677606a12a88af276d019c792feb36..1a64a231938aa97844591bdc5df13eda4560acaa 100644 (file)
@@ -311,6 +311,12 @@ netlink_parse_link(struct nlmsghdr *msg,
                    iff->index);
                return -1;
        }
+       if (iff->upper_idx == -1) {
+               /* No upper interface, we cannot be enslaved. We need to clear
+                * the flag because the appropriate information may come later
+                * and we don't want to miss it. */
+               iff->flags &= ~IFF_SLAVE;
+       }
 
        log_debug("netlink", "parsed link %d (%s, flags: %d)",
            iff->index, iff->name, iff->flags);