From d2e6f750fa13bb1f9b7701aced7457f0d609e2fc Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 13 Mar 2016 12:26:44 +0100 Subject: [PATCH] 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. --- src/daemon/netlink.c | 7 +++++++ 1 file changed, 7 insertions(+) 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; } /** -- 2.39.5