From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, jakub.kicinski@netronome.com,
sthemmin@microsoft.com, dsahern@gmail.com, mlxsw@mellanox.com
Subject: [patch iproute2-next v2 1/2] devlink: introduce cmdline option to switch to a different namespace
Date: Tue, 30 Jul 2019 10:59:50 +0200 [thread overview]
Message-ID: <20190730085951.31738-1-jiri@resnulli.us> (raw)
In-Reply-To: <20190730085734.31504-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
devlink/devlink.c | 12 ++++++++++--
man/man8/devlink.8 | 4 ++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index d8197ea3a478..9242cc05ad0c 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -32,6 +32,7 @@
#include "mnlg.h"
#include "json_writer.h"
#include "utils.h"
+#include "namespace.h"
#define ESWITCH_MODE_LEGACY "legacy"
#define ESWITCH_MODE_SWITCHDEV "switchdev"
@@ -6332,7 +6333,7 @@ static int cmd_health(struct dl *dl)
static void help(void)
{
pr_err("Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help }\n"
- " devlink [ -f[orce] ] -b[atch] filename\n"
+ " devlink [ -f[orce] ] -b[atch] filename -N[etns] netnsname\n"
"where OBJECT := { dev | port | sb | monitor | dpipe | resource | region | health }\n"
" OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] | -v[erbose] }\n");
}
@@ -6478,6 +6479,7 @@ int main(int argc, char **argv)
{ "json", no_argument, NULL, 'j' },
{ "pretty", no_argument, NULL, 'p' },
{ "verbose", no_argument, NULL, 'v' },
+ { "Netns", required_argument, NULL, 'N' },
{ NULL, 0, NULL, 0 }
};
const char *batch_file = NULL;
@@ -6493,7 +6495,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- while ((opt = getopt_long(argc, argv, "Vfb:njpv",
+ while ((opt = getopt_long(argc, argv, "Vfb:njpvN:",
long_options, NULL)) >= 0) {
switch (opt) {
@@ -6519,6 +6521,12 @@ int main(int argc, char **argv)
case 'v':
dl->verbose = true;
break;
+ case 'N':
+ if (netns_switch(optarg)) {
+ ret = EXIT_FAILURE;
+ goto dl_free;
+ }
+ break;
default:
pr_err("Unknown option.\n");
help();
diff --git a/man/man8/devlink.8 b/man/man8/devlink.8
index 13d4dcd908b3..9fc9b034eefe 100644
--- a/man/man8/devlink.8
+++ b/man/man8/devlink.8
@@ -51,6 +51,10 @@ When combined with -j generate a pretty JSON output.
.BR "\-v" , " --verbose"
Turn on verbose output.
+.TP
+.BR "\-N", " \-Netns " <NETNSNAME>
+Switches to the specified network namespace.
+
.SS
.I OBJECT
--
2.21.0
next prev parent reply other threads:[~2019-07-30 8:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 8:57 [patch net-next v2 0/3] net: devlink: Finish network namespace support Jiri Pirko
2019-07-30 8:57 ` [patch net-next v2 1/3] net: devlink: allow to change namespaces Jiri Pirko
2019-07-30 22:39 ` Jakub Kicinski
2019-07-31 19:26 ` Jiri Pirko
2019-07-31 19:41 ` David Ahern
2019-07-31 19:45 ` Jiri Pirko
2019-07-31 19:46 ` David Ahern
2019-07-31 19:58 ` David Ahern
2019-07-31 20:20 ` David Ahern
2019-08-02 7:48 ` Jiri Pirko
2019-08-02 15:45 ` David Ahern
2019-08-05 5:54 ` Jiri Pirko
2019-08-05 14:10 ` David Ahern
2019-08-05 14:49 ` Jiri Pirko
2019-08-05 14:51 ` David Ahern
2019-08-05 15:20 ` Jiri Pirko
2019-08-06 17:34 ` David Ahern
2019-08-06 17:53 ` Jiri Pirko
2019-08-06 17:55 ` David Ahern
2019-08-06 18:07 ` Jiri Pirko
2019-08-02 7:43 ` Jiri Pirko
2019-07-30 8:57 ` [patch net-next v2 2/3] net: devlink: export devlink net set/get helpers Jiri Pirko
2019-07-30 22:40 ` Jakub Kicinski
2019-07-30 8:57 ` [patch net-next v2 3/3] netdevsim: create devlink and netdev instances in namespace Jiri Pirko
2019-07-30 22:40 ` Jakub Kicinski
2019-07-30 8:59 ` Jiri Pirko [this message]
2019-07-30 8:59 ` [patch iproute2-next v2 2/2] devlink: add support for network namespace change Jiri Pirko
2019-07-31 22:59 ` [patch net-next v2 0/3] net: devlink: Finish network namespace support David Miller
2019-10-02 16:12 [patch net-next v2 00/15] devlink: allow devlink instances to change network namespace Jiri Pirko
2019-10-02 16:14 ` [patch iproute2-next v2 1/2] devlink: introduce cmdline option to switch to a different namespace Jiri Pirko
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=20190730085951.31738-1-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).