[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150105122333.GA6646@angus-think.wlc.globallogic.com>
Date: Mon, 5 Jan 2015 14:23:33 +0200
From: Vadim Kochan <vadim4j@...il.com>
To: netdev@...r.kernel.org
Subject: iproute2: Run over all netns
Hi All,
I have some piece of code which allow 'ip cmd'
on each netns, I found it useful for getting some info
from all the netns in one shot, BUT I faced with one issue
which mostly related to the user interface design. The problem
is that it would be good to print netns name only when
user uses "show" command, but not for updating/adding (IMHO),
but its hard to find the good way to implement this.
To run each netns the 'ip -net all CMD ...' construction can be used.
I see the following options for this:
#1 Add additional option ( -N ? ) for show netns label on each executing of CMD:
# ip -net all -N link
[test_net]
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
[home0]
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
[lan0]
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
[wan0]
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
link/ether 16:f7:cb:b6:7a:8e brd ff:ff:ff:ff:ff:ff
[vnet0]
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
and w/o:
# ip -net all link
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
link/ether 16:f7:cb:b6:7a:8e brd ff:ff:ff:ff:ff:ff
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
the last one is not so useful right ?
#2 Prints netns name by default if "-net all" was specified
(add option to prevent this ?), so it will be printed even on the
add/del/change commands ...
# ip -net all link add ...
[home0]
[lan0]
[wan0]
[vnet0]
but does it really useless to see that it will shows all the netns
on which cmd has been ran ?
#3 Do a lot of refactoring to explicitly show netns name for all
"show" commands ...
#4 The tricky option is to look for the all kinds of "show", "ls",
"list" commands in the args and print the netns name when 'all' netns was
specified.
I 'd like to hear your feedbacks, even if someone will say that ALL this
sucks:).
Regards,
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists