X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fikev2%2Fikev2_cli.c;h=2ca1a5ccfc683a4a4cbf2d8369252029bd527774;hb=8ebcb7a99d7b73a1ee5874780b4efdc69d32c82f;hp=8801793be0b0e5cf537346656c48206687c03b53;hpb=7c44d78ef2e7bf0c8714be4184511ed8f23ff239;p=vpp.git diff --git a/src/plugins/ikev2/ikev2_cli.c b/src/plugins/ikev2/ikev2_cli.c index 8801793be0b..2ca1a5ccfc6 100644 --- a/src/plugins/ikev2/ikev2_cli.c +++ b/src/plugins/ikev2/ikev2_cli.c @@ -584,14 +584,46 @@ VLIB_CLI_COMMAND (ikev2_initiate_command, static) = { }; /* *INDENT-ON* */ +void +ikev2_cli_reference (void) +{ +} -clib_error_t * -ikev2_cli_init (vlib_main_t * vm) +static clib_error_t * +ikev2_set_log_level_command_fn (vlib_main_t * vm, + unformat_input_t * input, + vlib_cli_command_t * cmd) { - return 0; + unformat_input_t _line_input, *line_input = &_line_input; + u8 log_level = IKEV2_LOG_NONE; + clib_error_t *error = 0; + + /* Get a line of input. */ + if (!unformat_user (input, unformat_line_input, line_input)) + return 0; + + if (!unformat (line_input, "%d", &log_level)) + { + error = clib_error_return (0, "unknown input '%U'", + format_unformat_error, line_input); + goto done; + } + int rc = ikev2_set_log_level (log_level); + if (rc < 0) + error = clib_error_return (0, "setting log level failed!"); + +done: + unformat_free (line_input); + return error; } -VLIB_INIT_FUNCTION (ikev2_cli_init); +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (ikev2_set_log_level_command, static) = { + .path = "ikev2 set logging level", + .function = ikev2_set_log_level_command_fn, + .short_help = "ikev2 set logging level <0-5>", +}; +/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON