From 92c6dcfe24b2d3610723119e0b82cf9fd7d2008d Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 21 Jan 2017 12:40:51 +0100 Subject: [PATCH] netlink: clear IFF_SLAVE when no information on upper interface 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 | 1 + src/daemon/netlink.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/NEWS b/NEWS index f2daa5c1..9ca6342a 100644 --- 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: diff --git a/src/daemon/netlink.c b/src/daemon/netlink.c index 64f170b7..1a64a231 100644 --- a/src/daemon/netlink.c +++ b/src/daemon/netlink.c @@ -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); -- 2.39.5