summaryrefslogtreecommitdiff
path: root/src/platform/nm-platform.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-08-17 17:48:37 +0200
committerThomas Haller <thaller@redhat.com>2015-08-25 19:24:47 +0200
commit5618b8a73de1d28239ae12b9b0b38a33176bf159 (patch)
tree2bd23aadacf41781ffb30ef8093a2519e0f60928 /src/platform/nm-platform.c
parent9f46cb2faa2ec9f13684b96e9fac30a0dfe00e1b (diff)
downloadNetworkManager-th/platform-parent-other-netns-bgo753726.tar.gz
platform: handle parent interfaces in other netnsth/platform-parent-other-netns-bgo753726
The parent of a link (IFLA_LINK) can be in another network namespace and thus invisible to NM. This requires the netlink attribute IFLA_LINK_NETNSID which is supported by recent versions of kernel and libnl. In this case, set the parent field to NM_PLATFORM_LINK_OTHER_NETNS and properly handle this special case.
Diffstat (limited to 'src/platform/nm-platform.c')
-rw-r--r--src/platform/nm-platform.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index fd1f5bd029..b1d4b3b14d 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -446,8 +446,11 @@ nm_platform_link_get_all (NMPlatform *self)
g_warn_if_fail (g_hash_table_contains (unseen, GINT_TO_POINTER (item->master)));
}
if (item->parent != 0) {
- g_warn_if_fail (item->parent > 0);
- g_warn_if_fail (item->parent != item->ifindex);
+ if (item->parent != NM_PLATFORM_LINK_OTHER_NETNS) {
+ g_warn_if_fail (item->parent > 0);
+ g_warn_if_fail (item->parent != item->ifindex);
+ g_warn_if_fail (g_hash_table_contains (unseen, GINT_TO_POINTER (item->parent)));
+ }
}
}
#endif
@@ -2359,8 +2362,10 @@ nm_platform_link_to_string (const NMPlatformLink *link)
else
master[0] = 0;
- if (link->parent)
+ if (link->parent > 0)
g_snprintf (parent, sizeof (parent), "@%d", link->parent);
+ else if (link->parent == NM_PLATFORM_LINK_OTHER_NETNS)
+ g_strlcpy (parent, "@other-netns", sizeof (parent));
else
parent[0] = 0;