[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080424151630.970357562@theryb.frec.bull.fr>
Date: Thu, 24 Apr 2008 17:15:38 +0200
From: Benjamin Thery <benjamin.thery@...l.net>
To: Stephen Hemminger <shemminger@...tta.com>
Cc: Daniel Lezcano <dlezcano@...ibm.com>, netdev@...r.kernel.org
Subject: [PATCH][IPROUTE2] Support device movement between network namespaces
Hi Stephen,
I don't know if anyone has already sent you this patch for iproute2 to
enable movement of network devices between network namespaces.
(Daniel Lezcano is the original author).
It applies on iproute2-2.6.25.
Benjamin
This patch adds support for the IFLA_NET_NS_PID type used to move
network devices between network namespaces.
The syntax is:
ip link DEVICE netns PID
PID is the pid of a process in the target network namespace.
---
ip/iplink.c | 9 +++++++++
1 file changed, 9 insertions(+)
Index: iproute2-2.6.25/ip/iplink.c
===================================================================
--- iproute2-2.6.25.orig/ip/iplink.c
+++ iproute2-2.6.25/ip/iplink.c
@@ -49,6 +49,7 @@ void iplink_usage(void)
fprintf(stderr, " name NEWNAME |\n");
fprintf(stderr, " address LLADDR | broadcast LLADDR |\n");
fprintf(stderr, " mtu MTU }\n");
+ fprintf(stderr, " netns PID }\n");
fprintf(stderr, " ip link show [ DEVICE ]\n");
exit(-1);
}
@@ -156,6 +157,7 @@ int iplink_parse(int argc, char **argv,
char abuf[32];
int qlen = -1;
int mtu = -1;
+ int netns = -1;
ret = argc;
@@ -197,6 +199,13 @@ int iplink_parse(int argc, char **argv,
if (get_integer(&mtu, *argv, 0))
invarg("Invalid \"mtu\" value\n", *argv);
addattr_l(&req->n, sizeof(*req), IFLA_MTU, &mtu, 4);
+ } else if (strcmp(*argv, "netns") == 0) {
+ NEXT_ARG();
+ if (netns != -1)
+ duparg("netns", *argv);
+ if (get_integer(&netns, *argv, 0))
+ invarg("Invalid \"netns\" value\n", *argv);
+ addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_PID, &netns, 4);
} else if (strcmp(*argv, "multicast") == 0) {
NEXT_ARG();
req->i.ifi_change |= IFF_MULTICAST;
--
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists