summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-09-14 15:05:00 +0200
committerThomas Haller <thaller@redhat.com>2015-09-18 11:30:52 +0200
commite79caf9b4ad888e9d78c4256f402b9eb8a524641 (patch)
tree944bda3ba28709c1019123dc9834fd33ceb12b02
parentbdbc3bbb7b919307b0a353b5de6bb1369127df5d (diff)
downloadNetworkManager-e79caf9b4ad888e9d78c4256f402b9eb8a524641.tar.gz
platform: refresh links when parent gets removed
When moving a link to another netns, it gets removed from NMPlatform's view. Currently kernel does not sent a notification to inform about that change (see related bug rh#1262908). Ensure that we reload all linked interfaces which now might have an invisible parent. (cherry picked from commit 2cd6aaa918333813879c97f7a1cb228e706a0586)
-rw-r--r--src/platform/nm-linux-platform.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 0c3dfc9115..21cdd22c5c 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1874,6 +1874,37 @@ cache_pre_hook (NMPCache *cache, const NMPObject *old, const NMPObject *new, NMP
}
}
{
+ int ifindex = -1;
+
+ /* removal of a link could be caused by moving the link to another netns.
+ * In this case, we potentially have to update other links that have this link as parent.
+ * Currently, kernel misses to sent us a notification in this case (rh #1262908). */
+
+ if ( ops_type == NMP_CACHE_OPS_REMOVED
+ && old /* <-- nonsensical, make coverity happy */
+ && old->_link.netlink.is_in_netlink)
+ ifindex = old->link.ifindex;
+ else if ( ops_type == NMP_CACHE_OPS_UPDATED
+ && old && new /* <-- nonsensical, make coverity happy */
+ && old->_link.netlink.is_in_netlink
+ && !new->_link.netlink.is_in_netlink)
+ ifindex = new->link.ifindex;
+
+ if (ifindex > 0) {
+ const NMPlatformLink *const *links;
+
+ links = cache_lookup_all_objects (NMPlatformLink, platform, NMP_OBJECT_TYPE_LINK, FALSE);
+ if (links) {
+ for (; *links; links++) {
+ const NMPlatformLink *l = (*links);
+
+ if (l->parent == ifindex)
+ delayed_action_schedule (platform, DELAYED_ACTION_TYPE_REFRESH_LINK, GINT_TO_POINTER (l->ifindex));
+ }
+ }
+ }
+ }
+ {
/* if a link goes down, we must refresh routes */
if ( ops_type == NMP_CACHE_OPS_UPDATED
&& old && new /* <-- nonsensical, make coverity happy */