summaryrefslogtreecommitdiff
path: root/src/platform/nm-linux-platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/nm-linux-platform.c')
-rw-r--r--src/platform/nm-linux-platform.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 3536fd468b..e2ff1f61af 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -4051,6 +4051,31 @@ link_refresh (NMPlatform *platform, int ifindex)
return !!cache_lookup_link (platform, ifindex);
}
+static gboolean
+link_set_netns (NMPlatform *platform,
+ int ifindex,
+ int netns_fd)
+{
+ nm_auto_nlmsg struct nl_msg *nlmsg = NULL;
+
+ _LOGD ("link: move link %d to network namespace with fd %d", ifindex, netns_fd);
+
+ nlmsg = _nl_msg_new_link (RTM_NEWLINK,
+ 0,
+ ifindex,
+ NULL,
+ 0,
+ 0);
+ if (!nlmsg)
+ return FALSE;
+
+ NLA_PUT (nlmsg, IFLA_NET_NS_FD, 4, &netns_fd);
+ return do_change_link (platform, ifindex, nlmsg) == NM_PLATFORM_ERROR_SUCCESS;
+
+nla_put_failure:
+ g_return_val_if_reached (FALSE);
+}
+
static NMPlatformError
link_change_flags (NMPlatform *platform,
int ifindex,
@@ -6164,6 +6189,8 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
platform_class->link_refresh = link_refresh;
+ platform_class->link_set_netns = link_set_netns;
+
platform_class->link_set_up = link_set_up;
platform_class->link_set_down = link_set_down;
platform_class->link_set_arp = link_set_arp;