diff options
author | Ole Troan <otroan@employees.org> | 2023-10-12 13:38:38 +0200 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2023-10-13 08:27:26 +0000 |
commit | bdeee2194b09c85ec1087550177555a24cc5d875 (patch) | |
tree | 94715e7acfcaad49d143afb2b47e1b3d4a0e77ca /src/plugins/npt66/npt66_cli.c | |
parent | 054aa8c2f2681e3a4a4af02d9119fb6eaa5dbad6 (diff) |
npt66: add show command and rx/tx counters
Add show npt66 bindings.
Add RX/TX and translation error counters.
Type: improvement
Change-Id: I4513b111f815a15d5a7537ce503f0c084b523aa1
Signed-off-by: Ole Troan <otroan@employees.org>
Diffstat (limited to 'src/plugins/npt66/npt66_cli.c')
-rw-r--r-- | src/plugins/npt66/npt66_cli.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/npt66/npt66_cli.c b/src/plugins/npt66/npt66_cli.c index 268bca264b3..b875eb924c6 100644 --- a/src/plugins/npt66/npt66_cli.c +++ b/src/plugins/npt66/npt66_cli.c @@ -86,3 +86,36 @@ VLIB_CLI_COMMAND (set_npt66_binding_command, static) = { "external <pfx> [del]", .function = set_npt66_binding_command_fn, }; + +static u8 * +format_npt66_binding (u8 *s, va_list *args) +{ + u32 index = va_arg (*args, u32); + npt66_binding_t *b = va_arg (*args, npt66_binding_t *); + s = format (s, "[%d] internal: %U/%d external: %U/%d", index, + format_ip6_address, &b->internal, b->internal_plen, + format_ip6_address, &b->external, b->external_plen); + return s; +} + +static clib_error_t * +show_npt66_bindings_command_fn (vlib_main_t *vm, unformat_input_t *input, + vlib_cli_command_t *cmd) +{ + npt66_main_t *nm = &npt66_main; + npt66_binding_t *b; + clib_error_t *error = 0; + + /* Get a line of input. */ + pool_foreach (b, nm->bindings) + { + vlib_cli_output (vm, "%U", format_npt66_binding, b - nm->bindings, b); + } + return error; +} + +VLIB_CLI_COMMAND (show_npt66_bindings_command, static) = { + .path = "show npt66 bindings", + .short_help = "show npt66 bindings", + .function = show_npt66_bindings_command_fn, +}; |