From: Marcelo Ricardo Leitner <marcelo.leitner@gmail•com>
To: vadim4j@gmail•com, Jiri Benc <jbenc@redhat•com>
Cc: netdev@vger•kernel.org
Subject: Re: [PATCH iproute2] ip: Simplify executing ip cmd within namespace
Date: Thu, 11 Dec 2014 15:33:34 -0200 [thread overview]
Message-ID: <5489D56E.4010505@gmail.com> (raw)
In-Reply-To: <20141211163335.GA27913@angus-think.wlc.globallogic.com>
On 11-12-2014 14:33, vadim4j@gmail•com wrote:
> 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:
>>> From: Vadim Kochan <vadim4j@gmail•com>
>>>
>>> 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,
>>
>>> --- 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.
In that case, it would be interesting to also accelerate the original use
case, no? So all usages we currently have will benefit from this speed up
without a change.
if (command to be executed == myself)
switch namespace, continue without fork/exec..
I'm not sure if this is feasible, though. Just sharing the idea, didn't even
open the code..
Marcelo
next prev parent reply other threads:[~2014-12-11 17:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 22:56 [PATCH iproute2] ip: Simplify executing ip cmd within namespace Vadim Kochan
2014-12-11 10:58 ` Nicolas Dichtel
2014-12-11 10:57 ` vadim4j
2014-12-11 12:50 ` Nicolas Dichtel
2014-12-11 13:02 ` vadim4j
2014-12-11 16:09 ` Jiri Benc
2014-12-11 16:33 ` vadim4j
2014-12-11 17:33 ` Marcelo Ricardo Leitner [this message]
2014-12-11 18:08 ` Jiri Benc
2014-12-11 18:36 ` Marcelo Ricardo Leitner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5489D56E.4010505@gmail.com \
--to=marcelo.leitner@gmail$(echo .)com \
--cc=jbenc@redhat$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=vadim4j@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox