Hi Stephen,
I resend you this patch once more. This time I updated the documentation
too (may be that was the reason why you didn't take it before?).
Please tell me if there are other things missing in this patch
It applies on iproute2 git tree.
Regards,
Benjamin
Description:
------------
This patch adds support for the IFLA_NET_NS_PID type. It is used to
move network devices between network namespaces.
The syntax is:
ip link set DEVICE netns PID
PID is the pid of a process in the target network namespace.
(Daniel Lezcano is the original author).
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
Do not use it, if you do not understand what this operation really does.
\end{NB}
Do not use it, if you do not understand what this operation really does.
\end{NB}
+\item \verb|netns PID|
+
+--- move the device to the network namespace associated with the process PID.
+
fprintf(stderr, " name NEWNAME |\n");
fprintf(stderr, " address LLADDR | broadcast LLADDR |\n");
fprintf(stderr, " mtu MTU }\n");
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);
}
fprintf(stderr, " ip link show [ DEVICE ]\n");
exit(-1);
}
char abuf[32];
int qlen = -1;
int mtu = -1;
char abuf[32];
int qlen = -1;
int mtu = -1;
if (get_integer(&mtu, *argv, 0))
invarg("Invalid \"mtu\" value\n", *argv);
addattr_l(&req->n, sizeof(*req), IFLA_MTU, &mtu, 4);
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;
} else if (strcmp(*argv, "multicast") == 0) {
NEXT_ARG();
req->i.ifi_change |= IFF_MULTICAST;
.IR LLADDR " |"
.br
.B mtu
.IR LLADDR " |"
.br
.B mtu
+.IR MTU " |"
+.br
+.B netns
+.IR PID " }"
the interface is
.IR "POINTOPOINT" .
the interface is
.IR "POINTOPOINT" .
+.TP
+.BI netns " PID"
+move the device to the network namespace associated with the process
+.IR "PID" .
+
.PP
.B Warning:
If multiple parameter changes are requested,
.PP
.B Warning:
If multiple parameter changes are requested,