X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fikev2%2Fikev2_cli.c;h=b991de4207e92e7df62047d819db41c720f2a8ef;hb=cf9bb22a9483b97b00b7dcacc35b37ae0fcaefbe;hp=1acae91c777654531ecabde36a3fabbcf2985c68;hpb=b979f5e3a6d99d5e9a37a9a086004feaa8fd15e5;p=vpp.git diff --git a/src/plugins/ikev2/ikev2_cli.c b/src/plugins/ikev2/ikev2_cli.c index 1acae91c777..b991de4207e 100644 --- a/src/plugins/ikev2/ikev2_cli.c +++ b/src/plugins/ikev2/ikev2_cli.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -354,27 +355,27 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, else if (unformat (line_input, - "set %U esp-crypto-alg %U %u esp-integ-alg %U esp-dh %U", + "set %U esp-crypto-alg %U %u esp-integ-alg %U", unformat_token, valid_chars, &name, unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1, - unformat_ikev2_transform_integ_type, &integ_alg, - unformat_ikev2_transform_dh_type, &dh_type)) + unformat_ikev2_transform_integ_type, &integ_alg)) { r = ikev2_set_profile_esp_transforms (vm, name, crypto_alg, integ_alg, - dh_type, tmp1); + IKEV2_TRANSFORM_DH_TYPE_NONE, + tmp1); goto done; } else if (unformat (line_input, - "set %U esp-crypto-alg %U %u esp-dh %U", + "set %U esp-crypto-alg %U %u", unformat_token, valid_chars, &name, - unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1, - unformat_ikev2_transform_dh_type, &dh_type)) + unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1)) { r = ikev2_set_profile_esp_transforms (vm, name, crypto_alg, 0, - dh_type, tmp1); + IKEV2_TRANSFORM_DH_TYPE_NONE, + tmp1); goto done; } else if (unformat (line_input, "set %U sa-lifetime %lu %u %u %lu", @@ -391,6 +392,14 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, r = ikev2_set_profile_udp_encap (vm, name); goto done; } + else if (unformat (line_input, "set %U ipsec-over-udp port %u", + unformat_token, valid_chars, &name, &tmp1)) + { + int rv = ikev2_set_profile_ipsec_udp_port (vm, name, tmp1, 1); + if (rv) + r = clib_error_return (0, "Error: %U", format_vnet_api_errno, rv); + goto done; + } else break; } @@ -421,7 +430,7 @@ VLIB_CLI_COMMAND (ikev2_profile_add_del_command, static) = { "ikev2 profile set responder \n" "ikev2 profile set ike-crypto-alg ike-integ-alg ike-dh \n" "ikev2 profile set esp-crypto-alg " - "[esp-integ-alg ] esp-dh \n" + "[esp-integ-alg ]\n" "ikev2 profile set sa-lifetime ", .function = ikev2_profile_add_del_command_fn, }; @@ -502,6 +511,9 @@ show_ikev2_profile_command_fn (vlib_main_t * vm, format_vnet_sw_if_index_name, vnet_get_main(), p->tun_itf); if (p->udp_encap) vlib_cli_output(vm, " udp-encap"); + + if (p->ipsec_over_udp_port != IPSEC_UDP_PORT_NONE) + vlib_cli_output(vm, " ipsec-over-udp port %d", p->ipsec_over_udp_port); })); /* *INDENT-ON* */ @@ -516,6 +528,45 @@ VLIB_CLI_COMMAND (show_ikev2_profile_command, static) = { }; /* *INDENT-ON* */ +static clib_error_t * +set_ikev2_liveness_period_fn (vlib_main_t * vm, + unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + unformat_input_t _line_input, *line_input = &_line_input; + clib_error_t *r = 0; + u32 period = 0, max_retries = 0; + + if (!unformat_user (input, unformat_line_input, line_input)) + return 0; + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "%d %d", &period, &max_retries)) + { + r = ikev2_set_liveness_params (period, max_retries); + goto done; + } + else + break; + } + + r = clib_error_return (0, "parse error: '%U'", + format_unformat_error, line_input); + +done: + unformat_free (line_input); + return r; +} + +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (set_ikev2_liveness_command, static) = { + .path = "ikev2 set liveness", + .short_help = "ikev2 set liveness ", + .function = set_ikev2_liveness_period_fn, +}; +/* *INDENT-ON* */ + static clib_error_t * set_ikev2_local_key_command_fn (vlib_main_t * vm, unformat_input_t * input, @@ -632,7 +683,7 @@ ikev2_set_log_level_command_fn (vlib_main_t * vm, vlib_cli_command_t * cmd) { unformat_input_t _line_input, *line_input = &_line_input; - u8 log_level = IKEV2_LOG_NONE; + u32 log_level = IKEV2_LOG_NONE; clib_error_t *error = 0; /* Get a line of input. */