diff options
author | Vadim Kochan <vadim4j@gmail.com> | 2014-12-24 23:04:11 +0200 |
---|---|---|
committer | Stephen Hemminger <shemming@brocade.com> | 2014-12-27 10:22:34 -0800 |
commit | 67e1d73be1b8e92f2daa403164b841ace820ff54 (patch) | |
tree | b38791a1af0cfc9b75d8da97da3fffa5317bde38 /tc/tc.c | |
parent | 527910c8015dc5f6d4c81cbc1266bcf1220e05ab (diff) |
tc: Allow to easy change network namespace
Added new '-netns' option to simplify executing following cmd:
ip netns exec NETNS tc OPTIONS COMMAND OBJECT
to
tc -n[etns] NETNS OPTIONS COMMAND OBJECT
e.g.:
tc -net vnet0 qdisc
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Diffstat (limited to 'tc/tc.c')
-rw-r--r-- | tc/tc.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -29,6 +29,7 @@ #include "utils.h" #include "tc_util.h" #include "tc_common.h" +#include "namespace.h" int show_stats = 0; int show_details = 0; @@ -186,7 +187,8 @@ static void usage(void) fprintf(stderr, "Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }\n" " tc [-force] -batch filename\n" "where OBJECT := { qdisc | class | filter | action | monitor }\n" - " OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] | -b[atch] [filename] }\n"); + " OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] | -b[atch] [filename] | " + "-n[etns] name }\n"); } static int do_cmd(int argc, char **argv) @@ -296,6 +298,10 @@ int main(int argc, char **argv) if (argc <= 1) usage(); batch_file = argv[1]; + } else if (matches(argv[1], "-netns") == 0) { + NEXT_ARG(); + if (netns_switch(argv[1])) + return -1; } else { fprintf(stderr, "Option \"%s\" is unknown, try \"tc -help\".\n", argv[1]); return -1; |