X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fikev2%2Fikev2_cli.c;h=3523ce079b6ead9d299dc43d813f2d10cf6ee20a;hb=af2cc6425;hp=1bb2dd91a888fe6eadad7d6f9a4ce09f3fa6b53c;hpb=b2c31b685fd2cf28436ca32bc93e23eb24c74878;p=vpp.git diff --git a/src/plugins/ikev2/ikev2_cli.c b/src/plugins/ikev2/ikev2_cli.c index 1bb2dd91a88..3523ce079b6 100644 --- a/src/plugins/ikev2/ikev2_cli.c +++ b/src/plugins/ikev2/ikev2_cli.c @@ -27,18 +27,24 @@ format_ikev2_id_type_and_data (u8 * s, va_list * args) if (id->type == 0 || vec_len (id->data) == 0) return format (s, "none"); - s = format (s, "%U", format_ikev2_id_type, id->type); + s = format (s, "id-type %U data ", format_ikev2_id_type, id->type); - if (id->type == IKEV2_ID_TYPE_ID_FQDN || - id->type == IKEV2_ID_TYPE_ID_RFC822_ADDR) + switch (id->type) { - s = format (s, " %v", id->data); - } - else - { - s = - format (s, " %U", format_hex_bytes, &id->data, - (uword) (vec_len (id->data))); + case IKEV2_ID_TYPE_ID_IPV4_ADDR: + s = format (s, "%U", format_ip4_address, id->data); + break; + case IKEV2_ID_TYPE_ID_IPV6_ADDR: + s = format (s, "%U", format_ip6_address, id->data); + break; + case IKEV2_ID_TYPE_ID_FQDN: /* fallthrough */ + case IKEV2_ID_TYPE_ID_RFC822_ADDR: + s = format (s, "%v", id->data); + break; + default: + s = format (s, "0x%U", format_hex_bytes, &id->data, + (uword) (vec_len (id->data))); + break; } return s; @@ -185,6 +191,14 @@ format_ikev2_sa (u8 * s, va_list * va) format_ikev2_child_sa, child, child - sa->childs); } + s = format (s, "Stats:\n"); + s = format (s, " keepalives :%u\n", sa->stats.n_keepalives); + s = format (s, " rekey :%u\n", sa->stats.n_rekey_req); + s = format (s, " SA init :%u (retransmit: %u)\n", sa->stats.n_sa_init_req, + sa->stats.n_init_retransmit); + s = format (s, " retransmit: %u\n", sa->stats.n_retransmit); + s = format (s, " SA auth :%u\n", sa->stats.n_sa_auth_req); + return s; } @@ -430,6 +444,15 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, ikev2_set_profile_responder (vm, name, responder_sw_if_index, ip); goto done; } + else if (unformat (line_input, "set %U responder %U %v", + unformat_ikev2_token, &name, + unformat_vnet_sw_interface, vnm, + &responder_sw_if_index, &data)) + { + r = ikev2_set_profile_responder_hostname (vm, name, data, + responder_sw_if_index); + goto done; + } else if (unformat (line_input, "set %U tunnel %U", unformat_ikev2_token, &name, unformat_vnet_sw_interface, vnm, &tun_sw_if_index)) @@ -577,36 +600,10 @@ show_ikev2_profile_command_fn (vlib_main_t * vm, } if (p->loc_id.data) - { - if (p->loc_id.type == IKEV2_ID_TYPE_ID_IPV4_ADDR) - vlib_cli_output(vm, " local id-type %U data %U", - format_ikev2_id_type, p->loc_id.type, - format_ip_address, p->loc_id.data); - else if (p->loc_id.type == IKEV2_ID_TYPE_ID_KEY_ID) - vlib_cli_output(vm, " local id-type %U data 0x%U", - format_ikev2_id_type, p->loc_id.type, - format_hex_bytes, p->loc_id.data, - vec_len(p->loc_id.data)); - else - vlib_cli_output(vm, " local id-type %U data %v", - format_ikev2_id_type, p->loc_id.type, p->loc_id.data); - } + vlib_cli_output(vm, " local %U", format_ikev2_id_type_and_data, &p->loc_id); if (p->rem_id.data) - { - if (p->rem_id.type == IKEV2_ID_TYPE_ID_IPV4_ADDR) - vlib_cli_output(vm, " remote id-type %U data %U", - format_ikev2_id_type, p->rem_id.type, - format_ip_address, p->rem_id.data); - else if (p->rem_id.type == IKEV2_ID_TYPE_ID_KEY_ID) - vlib_cli_output(vm, " remote id-type %U data 0x%U", - format_ikev2_id_type, p->rem_id.type, - format_hex_bytes, p->rem_id.data, - vec_len(p->rem_id.data)); - else - vlib_cli_output(vm, " remote id-type %U data %v", - format_ikev2_id_type, p->rem_id.type, p->rem_id.data); - } + vlib_cli_output(vm, " remote %U", format_ikev2_id_type_and_data, &p->rem_id); if (!ip_address_is_zero (&p->loc_ts.start_addr)) vlib_cli_output(vm, " local traffic-selector addr %U - %U port %u - %u" @@ -627,9 +624,10 @@ show_ikev2_profile_command_fn (vlib_main_t * vm, vlib_cli_output(vm, " protected tunnel %U", format_vnet_sw_if_index_name, vnet_get_main(), p->tun_itf); if (~0 != p->responder.sw_if_index) - vlib_cli_output(vm, " responder %U %U", - format_vnet_sw_if_index_name, vnet_get_main(), p->responder.sw_if_index, - format_ip_address, &p->responder.addr); + vlib_cli_output (vm, " responder %U %U %v", + format_vnet_sw_if_index_name, vnet_get_main (), + p->responder.sw_if_index, format_ip_address, + &p->responder.addr, p->responder.hostname); if (p->udp_encap) vlib_cli_output(vm, " udp-encap");