Thread (10 messages) flat view 10 messages, 4 authors, 2014-12-11

Re: [PATCH iproute2] ip: Simplify executing ip cmd within namespace

From: <hidden>
Date: 2014-12-11 16:43:28

On Thu, Dec 11, 2014 at 05:09:28PM +0100, Jiri Benc wrote:
On Thu, 11 Dec 2014 00:56:35 +0200, Vadim Kochan wrote:
quoted
From: Vadim Kochan <redacted>

Added new '-ns' option to simplify executing following cmd:

    ip netns exec NETNS ip OPTIONS COMMAND OBJECT

    to

    ip -ns NETNS OPTIONS COMMAND OBJECT

e.g.:

    ip -ns vnet0 link add br0 type bridge
This is great! It's a thing that has been bothering me for long time
but never got high enough on my todo list. Thanks for working on this.

However,
quoted
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -262,6 +262,12 @@ int main(int argc, char **argv)
 			rcvbuf = size;
 		} else if (matches(opt, "-help") == 0) {
 			usage();
+		} else if (matches(opt, "-ns") == 0) {
+			argc--;
+			argv++;
+			argv[0] = argv[1];
+			argv[1] = basename;
+			return netns_exec(argc, argv);
I very much dislike this. There's no reason to exec another ip binary.
The main reason I wanted the -n (or whatever) option was to speed up
execution of test scripts in environments with hundreds of interfaces
in different net namespaces.

Please just change to the specified netns and continue with interpreting
of the rest of the command line, there's absolutely no reason for doing
the exec.
Yes, I will follow that way.

Thanks,
Thanks,

 Jiri

-- 
Jiri Benc
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help