X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fikev2%2Fikev2_cli.c;h=03f9efd696f25878182e2a47e82e94b1ab7aeab0;hb=e5d34919b;hp=2ca1a5ccfc683a4a4cbf2d8369252029bd527774;hpb=8ebcb7a99d7b73a1ee5874780b4efdc69d32c82f;p=vpp.git diff --git a/src/plugins/ikev2/ikev2_cli.c b/src/plugins/ikev2/ikev2_cli.c index 2ca1a5ccfc6..03f9efd696f 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 @@ -125,10 +126,13 @@ show_ikev2_sa_command_fn (vlib_main_t * vm, 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 " @@ -184,6 +188,7 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, ip4_address_t ip4; ip4_address_t end_addr; u32 responder_sw_if_index = (u32) ~ 0; + u32 tun_sw_if_index = (u32) ~ 0; ip4_address_t responder_ip4; ikev2_transform_encr_type_t crypto_alg; ikev2_transform_integ_type_t integ_alg; @@ -326,6 +331,13 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, responder_ip4); goto done; } + else if (unformat (line_input, "set %U tunnel %U", + unformat_token, valid_chars, &name, + unformat_vnet_sw_interface, vnm, &tun_sw_if_index)) + { + r = ikev2_set_profile_tunnel_interface (vm, name, tun_sw_if_index); + goto done; + } else if (unformat (line_input, @@ -354,6 +366,18 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, 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)) @@ -362,6 +386,20 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, ikev2_set_profile_sa_lifetime (vm, name, tmp4, tmp1, tmp2, tmp5); goto done; } + else if (unformat (line_input, "set %U udp-encap", + unformat_token, valid_chars, &name)) + { + 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; } @@ -384,12 +422,15 @@ VLIB_CLI_COMMAND (ikev2_profile_add_del_command, static) = { "ikev2 profile set auth [rsa-sig|shared-key-mic] [cert-file|string|hex]" " \n" "ikev2 profile set id \n" + "ikev2 profile set tunnel \n" + "ikev2 profile set udp-encap\n" "ikev2 profile set traffic-selector ip-range " " - port-range - " "protocol \n" "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" + "ikev2 profile set esp-crypto-alg " + "[esp-integ-alg ] esp-dh \n" "ikev2 profile set sa-lifetime ", .function = ikev2_profile_add_del_command_fn, }; @@ -465,6 +506,14 @@ show_ikev2_profile_command_fn (vlib_main_t * vm, format_ip4_address, &p->rem_ts.end_addr, p->rem_ts.start_port, p->rem_ts.end_port, p->rem_ts.protocol_id); + if (~0 != p->tun_itf) + vlib_cli_output(vm, " protected tunnel %U", + 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* */