Currently, when you need to operate on a different name space (common usage: create a new veth pair, put one end to a different name space, set both end's link up and IP address), the only way to do it is using "ip netns exec" and re-executing 'ip'. For testing scripts that deal with thousands of veth devices, this is unnecessarily slow.
It would be great to have a common option that makes 'ip' to operate on a specified name space. E.g.:
ip -n anotherns link set veth1_in_anotherns up
ip -n anotherns a a 192.168.1.1/24 dev veth1_in_anotherns
After a short chat with Jiri Pirko I found out I was not clear enough about what the new option should do.
Basically, it would call setns() (man 2 setns) before proceeding with the rest of the arguments.
Syntax we want to support:
ip -namespace <namespace> ...
ip -N <namespace> ...
Implemented by Vadim Kochan upstream:
eb67e4498aec lib: Add netns_switch func for change network namespace
52700d40a2b3 ip: Allow to easy change network namespace
527910c8015d bridge: Allow to easy change network namespace
67e1d73be1b8 tc: Allow to easy change network namespace
I checked all ip option and I think, it would be better to not mixing capital and non capital letters. There is no case like that. So I suggest to add these option
What do you think?
Jaroslav, this was already decided upstream, see comment 4. In particular:
thanks. I fixed my test to reflect correct options.
there is a little bit inconsistency in man page.
-n, -net, -netns <NETNS>
There are three options, but elsewhere only two option are mentioned. I know that in the code there is match function, so all combination between -n and -netns should work, but still, it is different from the other options. There are no -V, -Ver and -Version.
Other things are ok and work as they are expected.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.