From: Vincent Bernat Date: Sun, 13 Mar 2016 11:26:44 +0000 (+0100) Subject: netlink: ensure lower link doesn't change for an interface X-Git-Tag: 0.9.2~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2e6f750fa13bb1f9b7701aced7457f0d609e2fc;p=thirdparty%2Flldpd.git netlink: ensure lower link doesn't change for an interface The lower link of an interface is defined at its creation. It's not possible for it to change. This is important to not try to change it because the kernel won't send IFLA_LINK_NETNSID each time it sends IFLA_LINK. --- diff --git a/src/daemon/netlink.c b/src/daemon/netlink.c index e643ccb2..60e0ec5d 100644 --- a/src/daemon/netlink.c +++ b/src/daemon/netlink.c @@ -229,10 +229,14 @@ netlink_parse_link(struct nlmsghdr *msg, case IFLA_LINK: /* Index of "lower" interface */ iff->lower_idx = *(int*)RTA_DATA(attribute); + log_debug("netlink", "attribute IFLA_LINK for %s: %d", + iff->name ? iff->name : "(unknown)", iff->lower_idx); break; case IFLA_LINK_NETNSID: /* Is the lower interface into another namesapce? */ iff->lower_idx = -1; + log_debug("netlink", "attribute IFLA_LINK_NETNSID received for %s", + iff->name ? iff->name : "(unknown)"); break; case IFLA_MASTER: /* Index of master interface */ @@ -349,6 +353,9 @@ netlink_merge(struct interfaces_device *old, struct interfaces_device *new) new->type = old->type; if (new->vlanid == 0) new->vlanid = old->vlanid; + + /* It's not possible for lower link to change */ + new->lower_idx = old->lower_idx; } /**