Bug 1131928 - backport: introduce option to ip to operate on a different namespace
Summary: backport: introduce option to ip to operate on a different namespace
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: iproute
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Pavel Šimerda (pavlix)
QA Contact: Jaroslav Aster
URL:
Whiteboard:
Depends On:
Blocks: 1110700 1191021
TreeView+ depends on / blocked
 
Reported: 2014-08-20 10:40 UTC by Jiri Benc
Modified: 2015-11-19 14:39 UTC (History)
5 users (show)

Fixed In Version: iproute-3.10.0-43.el7
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 14:39:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2117 normal SHIPPED_LIVE iproute bug fix and enhancement update 2015-11-19 11:35:06 UTC

Description Jiri Benc 2014-08-20 10:40:33 UTC
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

or

ip -n anotherns a a 192.168.1.1/24 dev veth1_in_anotherns

Comment 2 Jiri Benc 2014-08-20 11:19:04 UTC
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.

Comment 3 Pavel Šimerda (pavlix) 2014-10-10 19:48:01 UTC
Syntax we want to support:

ip -namespace <namespace> ...
ip -N <namespace> ...

Comment 4 Jiri Benc 2015-01-08 15:51:00 UTC
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

Comment 8 Jaroslav Aster 2015-05-13 14:29:09 UTC
Hi Pavel,

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

-n
-namespace

or

-N
-Namespace

What do you think?

Comment 9 Jiri Benc 2015-05-13 14:42:12 UTC
Jaroslav, this was already decided upstream, see comment 4. In particular:

https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/commit/?id=52700d40a2b3

Comment 10 Jaroslav Aster 2015-05-13 14:54:26 UTC
Hi Jiri,

thanks. I fixed my test to reflect correct options.

Comment 12 Jaroslav Aster 2015-05-14 14:11:13 UTC
Hi,

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.

Comment 16 errata-xmlrpc 2015-11-19 14:39:10 UTC
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.

https://rhn.redhat.com/errata/RHBA-2015-2117.html


Note You need to log in before you can comment on or make changes to this bug.