#include <vnet/pg/pg.h>
#include <vppinfra/error.h>
#include <vnet/udp/udp.h>
+#include <vnet/ipsec/ipsec_sa.h>
#include <plugins/ikev2/ikev2.h>
#include <plugins/ikev2/ikev2_priv.h>
vlib_cli_output(vm, " SK_e i:%U\n r:%U",
format_hex_bytes, child->sk_ei, vec_len(child->sk_ei),
format_hex_bytes, child->sk_er, vec_len(child->sk_er));
- vlib_cli_output(vm, " SK_a i:%U\n r:%U",
- format_hex_bytes, child->sk_ai, vec_len(child->sk_ai),
- format_hex_bytes, child->sk_ar, vec_len(child->sk_ar));
- vlib_cli_output(vm, " traffic selectors (i):");
+ if (child->sk_ai)
+ {
+ vlib_cli_output(vm, " SK_a i:%U\n r:%U",
+ format_hex_bytes, child->sk_ai, vec_len(child->sk_ai),
+ format_hex_bytes, child->sk_ar, vec_len(child->sk_ar));
+ vlib_cli_output(vm, " traffic selectors (i):");
+ }
vec_foreach(ts, child->tsi)
{
vlib_cli_output(vm, " %u type %u protocol_id %u addr "
dh_type, tmp1);
goto done;
}
+ else if (unformat
+ (line_input,
+ "set %U esp-crypto-alg %U %u esp-dh %U",
+ unformat_token, valid_chars, &name,
+ unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1,
+ unformat_ikev2_transform_dh_type, &dh_type))
+ {
+ r =
+ ikev2_set_profile_esp_transforms (vm, name, crypto_alg, 0,
+ dh_type, tmp1);
+ goto done;
+ }
else if (unformat (line_input, "set %U sa-lifetime %lu %u %u %lu",
unformat_token, valid_chars, &name,
&tmp4, &tmp1, &tmp2, &tmp5))
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;
}
"protocol <protocol-number>\n"
"ikev2 profile set <id> responder <interface> <addr>\n"
"ikev2 profile set <id> ike-crypto-alg <crypto alg> <key size> ike-integ-alg <integ alg> ike-dh <dh type>\n"
- "ikev2 profile set <id> esp-crypto-alg <crypto alg> <key size> esp-integ-alg <integ alg> esp-dh <dh type>\n"
+ "ikev2 profile set <id> esp-crypto-alg <crypto alg> <key size> "
+ "[esp-integ-alg <integ alg>] esp-dh <dh type>\n"
"ikev2 profile set <id> sa-lifetime <seconds> <jitter> <handover> <max bytes>",
.function = ikev2_profile_add_del_command_fn,
};
format_vnet_sw_if_index_name, vnet_get_main(), p->tun_itf);
if (p->udp_encap)
vlib_cli_output(vm, " udp-encap");
+
+ if (p->dst_port != IPSEC_UDP_PORT_NONE)
+ vlib_cli_output(vm, " ipsec-over-udp port %d", p->dst_port);
}));
/* *INDENT-ON* */
};
/* *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 <period> <max-retires>",
+ .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,