2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 #include <vlib/vlib.h>
16 #include <vnet/vnet.h>
17 #include <vnet/pg/pg.h>
18 #include <vppinfra/error.h>
19 #include <vnet/udp/udp.h>
20 #include <vnet/ipsec/ipsec_sa.h>
21 #include <plugins/ikev2/ikev2.h>
22 #include <plugins/ikev2/ikev2_priv.h>
25 format_ikev2_id_type_and_data (u8 * s, va_list * args)
27 ikev2_id_t *id = va_arg (*args, ikev2_id_t *);
29 if (id->type == 0 || vec_len (id->data) == 0)
30 return format (s, "none");
32 s = format (s, "%U", format_ikev2_id_type, id->type);
34 if (id->type == IKEV2_ID_TYPE_ID_FQDN ||
35 id->type == IKEV2_ID_TYPE_ID_RFC822_ADDR)
37 s = format (s, " %v", id->data);
42 format (s, " %U", format_hex_bytes, &id->data,
43 (uword) (vec_len (id->data)));
51 show_ikev2_sa_command_fn (vlib_main_t * vm,
52 unformat_input_t * input, vlib_cli_command_t * cmd)
54 ikev2_main_t *km = &ikev2_main;
55 ikev2_main_per_thread_data_t *tkm;
58 ikev2_child_sa_t *child;
59 ikev2_sa_transform_t *tr;
61 vec_foreach (tkm, km->per_thread_data)
64 pool_foreach (sa, tkm->sas, ({
66 vlib_cli_output(vm, " iip %U ispi %lx rip %U rspi %lx",
67 format_ip4_address, &sa->iaddr, sa->ispi,
68 format_ip4_address, &sa->raddr, sa->rspi);
70 tr = ikev2_sa_get_td_for_type(sa->r_proposals, IKEV2_TRANSFORM_TYPE_ENCR);
71 s = format(s, "%U ", format_ikev2_sa_transform, tr);
73 tr = ikev2_sa_get_td_for_type(sa->r_proposals, IKEV2_TRANSFORM_TYPE_PRF);
74 s = format(s, "%U ", format_ikev2_sa_transform, tr);
76 tr = ikev2_sa_get_td_for_type(sa->r_proposals, IKEV2_TRANSFORM_TYPE_INTEG);
77 s = format(s, "%U ", format_ikev2_sa_transform, tr);
79 tr = ikev2_sa_get_td_for_type(sa->r_proposals, IKEV2_TRANSFORM_TYPE_DH);
80 s = format(s, "%U ", format_ikev2_sa_transform, tr);
82 vlib_cli_output(vm, " %v", s);
85 vlib_cli_output(vm, " nonce i:%U\n r:%U",
86 format_hex_bytes, sa->i_nonce, vec_len(sa->i_nonce),
87 format_hex_bytes, sa->r_nonce, vec_len(sa->r_nonce));
89 vlib_cli_output(vm, " SK_d %U",
90 format_hex_bytes, sa->sk_d, vec_len(sa->sk_d));
93 vlib_cli_output(vm, " SK_a i:%U\n r:%U",
94 format_hex_bytes, sa->sk_ai, vec_len(sa->sk_ai),
95 format_hex_bytes, sa->sk_ar, vec_len(sa->sk_ar));
97 vlib_cli_output(vm, " SK_e i:%U\n r:%U",
98 format_hex_bytes, sa->sk_ei, vec_len(sa->sk_ei),
99 format_hex_bytes, sa->sk_er, vec_len(sa->sk_er));
100 vlib_cli_output(vm, " SK_p i:%U\n r:%U",
101 format_hex_bytes, sa->sk_pi, vec_len(sa->sk_pi),
102 format_hex_bytes, sa->sk_pr, vec_len(sa->sk_pr));
104 vlib_cli_output(vm, " identifier (i) %U",
105 format_ikev2_id_type_and_data, &sa->i_id);
106 vlib_cli_output(vm, " identifier (r) %U",
107 format_ikev2_id_type_and_data, &sa->r_id);
109 vec_foreach(child, sa->childs)
111 vlib_cli_output(vm, " child sa %u:", child - sa->childs);
113 tr = ikev2_sa_get_td_for_type(child->r_proposals, IKEV2_TRANSFORM_TYPE_ENCR);
114 s = format(s, "%U ", format_ikev2_sa_transform, tr);
116 tr = ikev2_sa_get_td_for_type(child->r_proposals, IKEV2_TRANSFORM_TYPE_INTEG);
117 s = format(s, "%U ", format_ikev2_sa_transform, tr);
119 tr = ikev2_sa_get_td_for_type(child->r_proposals, IKEV2_TRANSFORM_TYPE_ESN);
120 s = format(s, "%U ", format_ikev2_sa_transform, tr);
122 vlib_cli_output(vm, " %v", s);
125 vlib_cli_output(vm, " spi(i) %lx spi(r) %lx",
126 child->i_proposals ? child->i_proposals[0].spi : 0,
127 child->r_proposals ? child->r_proposals[0].spi : 0);
129 vlib_cli_output(vm, " SK_e i:%U\n r:%U",
130 format_hex_bytes, child->sk_ei, vec_len(child->sk_ei),
131 format_hex_bytes, child->sk_er, vec_len(child->sk_er));
134 vlib_cli_output(vm, " SK_a i:%U\n r:%U",
135 format_hex_bytes, child->sk_ai, vec_len(child->sk_ai),
136 format_hex_bytes, child->sk_ar, vec_len(child->sk_ar));
137 vlib_cli_output(vm, " traffic selectors (i):");
139 vec_foreach(ts, child->tsi)
141 vlib_cli_output(vm, " %u type %u protocol_id %u addr "
142 "%U - %U port %u - %u",
144 ts->ts_type, ts->protocol_id,
145 format_ip4_address, &ts->start_addr,
146 format_ip4_address, &ts->end_addr,
147 clib_net_to_host_u16( ts->start_port),
148 clib_net_to_host_u16( ts->end_port));
150 vlib_cli_output(vm, " traffic selectors (r):");
151 vec_foreach(ts, child->tsr)
153 vlib_cli_output(vm, " %u type %u protocol_id %u addr "
154 "%U - %U port %u - %u",
156 ts->ts_type, ts->protocol_id,
157 format_ip4_address, &ts->start_addr,
158 format_ip4_address, &ts->end_addr,
159 clib_net_to_host_u16( ts->start_port),
160 clib_net_to_host_u16( ts->end_port));
163 vlib_cli_output(vm, "");
171 VLIB_CLI_COMMAND (show_ikev2_sa_command, static) = {
172 .path = "show ikev2 sa",
173 .short_help = "show ikev2 sa",
174 .function = show_ikev2_sa_command_fn,
178 static clib_error_t *
179 ikev2_profile_add_del_command_fn (vlib_main_t * vm,
180 unformat_input_t * input,
181 vlib_cli_command_t * cmd)
183 vnet_main_t *vnm = vnet_get_main ();
184 unformat_input_t _line_input, *line_input = &_line_input;
189 u32 tmp1, tmp2, tmp3;
192 ip4_address_t end_addr;
193 u32 responder_sw_if_index = (u32) ~ 0;
194 u32 tun_sw_if_index = (u32) ~ 0;
195 ip4_address_t responder_ip4;
196 ikev2_transform_encr_type_t crypto_alg;
197 ikev2_transform_integ_type_t integ_alg;
198 ikev2_transform_dh_type_t dh_type;
200 const char *valid_chars = "a-zA-Z0-9_";
202 if (!unformat_user (input, unformat_line_input, line_input))
205 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
207 if (unformat (line_input, "add %U", unformat_token, valid_chars, &name))
209 r = ikev2_add_del_profile (vm, name, 1);
214 (line_input, "del %U", unformat_token, valid_chars, &name))
216 r = ikev2_add_del_profile (vm, name, 0);
219 else if (unformat (line_input, "set %U auth shared-key-mic string %v",
220 unformat_token, valid_chars, &name, &data))
223 ikev2_set_profile_auth (vm, name,
224 IKEV2_AUTH_METHOD_SHARED_KEY_MIC, data,
228 else if (unformat (line_input, "set %U auth shared-key-mic hex %U",
229 unformat_token, valid_chars, &name,
230 unformat_hex_string, &data))
233 ikev2_set_profile_auth (vm, name,
234 IKEV2_AUTH_METHOD_SHARED_KEY_MIC, data,
238 else if (unformat (line_input, "set %U auth rsa-sig cert-file %v",
239 unformat_token, valid_chars, &name, &data))
242 ikev2_set_profile_auth (vm, name, IKEV2_AUTH_METHOD_RSA_SIG, data,
246 else if (unformat (line_input, "set %U id local %U %U",
247 unformat_token, valid_chars, &name,
248 unformat_ikev2_id_type, &id_type,
249 unformat_ip4_address, &ip4))
251 data = vec_new (u8, 4);
252 clib_memcpy (data, ip4.as_u8, 4);
254 ikev2_set_profile_id (vm, name, (u8) id_type, data, /*local */ 1);
257 else if (unformat (line_input, "set %U id local %U 0x%U",
258 unformat_token, valid_chars, &name,
259 unformat_ikev2_id_type, &id_type,
260 unformat_hex_string, &data))
263 ikev2_set_profile_id (vm, name, (u8) id_type, data, /*local */ 1);
266 else if (unformat (line_input, "set %U id local %U %v",
267 unformat_token, valid_chars, &name,
268 unformat_ikev2_id_type, &id_type, &data))
271 ikev2_set_profile_id (vm, name, (u8) id_type, data, /*local */ 1);
274 else if (unformat (line_input, "set %U id remote %U %U",
275 unformat_token, valid_chars, &name,
276 unformat_ikev2_id_type, &id_type,
277 unformat_ip4_address, &ip4))
279 data = vec_new (u8, 4);
280 clib_memcpy (data, ip4.as_u8, 4);
281 r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
285 else if (unformat (line_input, "set %U id remote %U 0x%U",
286 unformat_token, valid_chars, &name,
287 unformat_ikev2_id_type, &id_type,
288 unformat_hex_string, &data))
290 r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
294 else if (unformat (line_input, "set %U id remote %U %v",
295 unformat_token, valid_chars, &name,
296 unformat_ikev2_id_type, &id_type, &data))
298 r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */
302 else if (unformat (line_input, "set %U traffic-selector local "
303 "ip-range %U - %U port-range %u - %u protocol %u",
304 unformat_token, valid_chars, &name,
305 unformat_ip4_address, &ip4,
306 unformat_ip4_address, &end_addr,
307 &tmp1, &tmp2, &tmp3))
310 ikev2_set_profile_ts (vm, name, (u8) tmp3, (u16) tmp1, (u16) tmp2,
311 ip4, end_addr, /*local */ 1);
314 else if (unformat (line_input, "set %U traffic-selector remote "
315 "ip-range %U - %U port-range %u - %u protocol %u",
316 unformat_token, valid_chars, &name,
317 unformat_ip4_address, &ip4,
318 unformat_ip4_address, &end_addr,
319 &tmp1, &tmp2, &tmp3))
322 ikev2_set_profile_ts (vm, name, (u8) tmp3, (u16) tmp1, (u16) tmp2,
323 ip4, end_addr, /*remote */ 0);
326 else if (unformat (line_input, "set %U responder %U %U",
327 unformat_token, valid_chars, &name,
328 unformat_vnet_sw_interface, vnm,
329 &responder_sw_if_index, unformat_ip4_address,
333 ikev2_set_profile_responder (vm, name, responder_sw_if_index,
337 else if (unformat (line_input, "set %U tunnel %U",
338 unformat_token, valid_chars, &name,
339 unformat_vnet_sw_interface, vnm, &tun_sw_if_index))
341 r = ikev2_set_profile_tunnel_interface (vm, name, tun_sw_if_index);
347 "set %U ike-crypto-alg %U %u ike-integ-alg %U ike-dh %U",
348 unformat_token, valid_chars, &name,
349 unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1,
350 unformat_ikev2_transform_integ_type, &integ_alg,
351 unformat_ikev2_transform_dh_type, &dh_type))
354 ikev2_set_profile_ike_transforms (vm, name, crypto_alg, integ_alg,
361 "set %U ike-crypto-alg %U %u ike-dh %U",
362 unformat_token, valid_chars, &name,
363 unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1,
364 unformat_ikev2_transform_dh_type, &dh_type))
367 ikev2_set_profile_ike_transforms (vm, name, crypto_alg,
368 IKEV2_TRANSFORM_INTEG_TYPE_NONE,
375 "set %U esp-crypto-alg %U %u esp-integ-alg %U",
376 unformat_token, valid_chars, &name,
377 unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1,
378 unformat_ikev2_transform_integ_type, &integ_alg))
381 ikev2_set_profile_esp_transforms (vm, name, crypto_alg, integ_alg,
387 "set %U esp-crypto-alg %U %u",
388 unformat_token, valid_chars, &name,
389 unformat_ikev2_transform_encr_type, &crypto_alg, &tmp1))
392 ikev2_set_profile_esp_transforms (vm, name, crypto_alg, 0, tmp1);
395 else if (unformat (line_input, "set %U sa-lifetime %lu %u %u %lu",
396 unformat_token, valid_chars, &name,
397 &tmp4, &tmp1, &tmp2, &tmp5))
400 ikev2_set_profile_sa_lifetime (vm, name, tmp4, tmp1, tmp2, tmp5);
403 else if (unformat (line_input, "set %U udp-encap",
404 unformat_token, valid_chars, &name))
406 r = ikev2_set_profile_udp_encap (vm, name);
409 else if (unformat (line_input, "set %U ipsec-over-udp port %u",
410 unformat_token, valid_chars, &name, &tmp1))
412 int rv = ikev2_set_profile_ipsec_udp_port (vm, name, tmp1, 1);
414 r = clib_error_return (0, "Error: %U", format_vnet_api_errno, rv);
421 r = clib_error_return (0, "parse error: '%U'",
422 format_unformat_error, line_input);
427 unformat_free (line_input);
432 VLIB_CLI_COMMAND (ikev2_profile_add_del_command, static) = {
433 .path = "ikev2 profile",
435 "ikev2 profile [add|del] <id>\n"
436 "ikev2 profile set <id> auth [rsa-sig|shared-key-mic] [cert-file|string|hex]"
438 "ikev2 profile set <id> id <local|remote> <type> <data>\n"
439 "ikev2 profile set <id> tunnel <interface>\n"
440 "ikev2 profile set <id> udp-encap\n"
441 "ikev2 profile set <id> traffic-selector <local|remote> ip-range "
442 "<start-addr> - <end-addr> port-range <start-port> - <end-port> "
443 "protocol <protocol-number>\n"
444 "ikev2 profile set <id> responder <interface> <addr>\n"
445 "ikev2 profile set <id> ike-crypto-alg <crypto alg> <key size> ike-integ-alg <integ alg> ike-dh <dh type>\n"
446 "ikev2 profile set <id> esp-crypto-alg <crypto alg> <key size> "
447 "[esp-integ-alg <integ alg>]\n"
448 "ikev2 profile set <id> sa-lifetime <seconds> <jitter> <handover> <max bytes>",
449 .function = ikev2_profile_add_del_command_fn,
453 static clib_error_t *
454 show_ikev2_profile_command_fn (vlib_main_t * vm,
455 unformat_input_t * input,
456 vlib_cli_command_t * cmd)
458 ikev2_main_t *km = &ikev2_main;
462 pool_foreach (p, km->profiles, ({
463 vlib_cli_output(vm, "profile %v", p->name);
468 vlib_cli_output(vm, " auth-method %U auth data 0x%U",
469 format_ikev2_auth_method, p->auth.method,
470 format_hex_bytes, p->auth.data, vec_len(p->auth.data));
472 vlib_cli_output(vm, " auth-method %U auth data %v",
473 format_ikev2_auth_method, p->auth.method, p->auth.data);
478 if (p->loc_id.type == IKEV2_ID_TYPE_ID_IPV4_ADDR)
479 vlib_cli_output(vm, " local id-type %U data %U",
480 format_ikev2_id_type, p->loc_id.type,
481 format_ip4_address, p->loc_id.data);
482 else if (p->loc_id.type == IKEV2_ID_TYPE_ID_KEY_ID)
483 vlib_cli_output(vm, " local id-type %U data 0x%U",
484 format_ikev2_id_type, p->loc_id.type,
485 format_hex_bytes, p->loc_id.data,
486 vec_len(p->loc_id.data));
488 vlib_cli_output(vm, " local id-type %U data %v",
489 format_ikev2_id_type, p->loc_id.type, p->loc_id.data);
494 if (p->rem_id.type == IKEV2_ID_TYPE_ID_IPV4_ADDR)
495 vlib_cli_output(vm, " remote id-type %U data %U",
496 format_ikev2_id_type, p->rem_id.type,
497 format_ip4_address, p->rem_id.data);
498 else if (p->rem_id.type == IKEV2_ID_TYPE_ID_KEY_ID)
499 vlib_cli_output(vm, " remote id-type %U data 0x%U",
500 format_ikev2_id_type, p->rem_id.type,
501 format_hex_bytes, p->rem_id.data,
502 vec_len(p->rem_id.data));
504 vlib_cli_output(vm, " remote id-type %U data %v",
505 format_ikev2_id_type, p->rem_id.type, p->rem_id.data);
508 if (p->loc_ts.end_addr.as_u32)
509 vlib_cli_output(vm, " local traffic-selector addr %U - %U port %u - %u"
511 format_ip4_address, &p->loc_ts.start_addr,
512 format_ip4_address, &p->loc_ts.end_addr,
513 p->loc_ts.start_port, p->loc_ts.end_port,
514 p->loc_ts.protocol_id);
516 if (p->rem_ts.end_addr.as_u32)
517 vlib_cli_output(vm, " remote traffic-selector addr %U - %U port %u - %u"
519 format_ip4_address, &p->rem_ts.start_addr,
520 format_ip4_address, &p->rem_ts.end_addr,
521 p->rem_ts.start_port, p->rem_ts.end_port,
522 p->rem_ts.protocol_id);
523 if (~0 != p->tun_itf)
524 vlib_cli_output(vm, " protected tunnel %U",
525 format_vnet_sw_if_index_name, vnet_get_main(), p->tun_itf);
526 if (~0 != p->responder.sw_if_index)
527 vlib_cli_output(vm, " responder %U %U",
528 format_vnet_sw_if_index_name, vnet_get_main(), p->responder.sw_if_index,
529 format_ip4_address, &p->responder.ip4);
531 vlib_cli_output(vm, " udp-encap");
533 if (p->ipsec_over_udp_port != IPSEC_UDP_PORT_NONE)
534 vlib_cli_output(vm, " ipsec-over-udp port %d", p->ipsec_over_udp_port);
536 if (p->ike_ts.crypto_alg || p->ike_ts.integ_alg || p->ike_ts.dh_type || p->ike_ts.crypto_key_size)
537 vlib_cli_output(vm, " ike-crypto-alg %U %u ike-integ-alg %U ike-dh %U",
538 format_ikev2_transform_encr_type, p->ike_ts.crypto_alg, p->ike_ts.crypto_key_size,
539 format_ikev2_transform_integ_type, p->ike_ts.integ_alg,
540 format_ikev2_transform_dh_type, p->ike_ts.dh_type);
542 if (p->esp_ts.crypto_alg || p->esp_ts.integ_alg || p->esp_ts.dh_type)
543 vlib_cli_output(vm, " esp-crypto-alg %U %u esp-integ-alg %U",
544 format_ikev2_transform_encr_type, p->esp_ts.crypto_alg, p->esp_ts.crypto_key_size,
545 format_ikev2_transform_integ_type, p->esp_ts.integ_alg);
547 vlib_cli_output(vm, " lifetime %d jitter %d handover %d maxdata %d",
548 p->lifetime, p->lifetime_jitter, p->handover, p->lifetime_maxdata);
556 VLIB_CLI_COMMAND (show_ikev2_profile_command, static) = {
557 .path = "show ikev2 profile",
558 .short_help = "show ikev2 profile",
559 .function = show_ikev2_profile_command_fn,
563 static clib_error_t *
564 set_ikev2_liveness_period_fn (vlib_main_t * vm,
565 unformat_input_t * input,
566 vlib_cli_command_t * cmd)
568 unformat_input_t _line_input, *line_input = &_line_input;
570 u32 period = 0, max_retries = 0;
572 if (!unformat_user (input, unformat_line_input, line_input))
575 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
577 if (unformat (line_input, "%d %d", &period, &max_retries))
579 r = ikev2_set_liveness_params (period, max_retries);
586 r = clib_error_return (0, "parse error: '%U'",
587 format_unformat_error, line_input);
590 unformat_free (line_input);
595 VLIB_CLI_COMMAND (set_ikev2_liveness_command, static) = {
596 .path = "ikev2 set liveness",
597 .short_help = "ikev2 set liveness <period> <max-retires>",
598 .function = set_ikev2_liveness_period_fn,
602 static clib_error_t *
603 set_ikev2_local_key_command_fn (vlib_main_t * vm,
604 unformat_input_t * input,
605 vlib_cli_command_t * cmd)
607 unformat_input_t _line_input, *line_input = &_line_input;
611 if (!unformat_user (input, unformat_line_input, line_input))
614 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
616 if (unformat (line_input, "%s", &data))
618 r = ikev2_set_local_key (vm, data);
625 r = clib_error_return (0, "parse error: '%U'",
626 format_unformat_error, line_input);
630 unformat_free (line_input);
635 VLIB_CLI_COMMAND (set_ikev2_local_key_command, static) = {
636 .path = "set ikev2 local key",
638 "set ikev2 local key <file>",
639 .function = set_ikev2_local_key_command_fn,
644 static clib_error_t *
645 ikev2_initiate_command_fn (vlib_main_t * vm,
646 unformat_input_t * input, vlib_cli_command_t * cmd)
648 unformat_input_t _line_input, *line_input = &_line_input;
654 const char *valid_chars = "a-zA-Z0-9_";
656 if (!unformat_user (input, unformat_line_input, line_input))
659 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
662 (line_input, "sa-init %U", unformat_token, valid_chars, &name))
664 r = ikev2_initiate_sa_init (vm, name);
667 else if (unformat (line_input, "del-child-sa %x", &tmp1))
669 r = ikev2_initiate_delete_child_sa (vm, tmp1);
672 else if (unformat (line_input, "del-sa %lx", &tmp2))
674 r = ikev2_initiate_delete_ike_sa (vm, tmp2);
677 else if (unformat (line_input, "rekey-child-sa %x", &tmp1))
679 r = ikev2_initiate_rekey_child_sa (vm, tmp1);
686 r = clib_error_return (0, "parse error: '%U'",
687 format_unformat_error, line_input);
691 unformat_free (line_input);
696 VLIB_CLI_COMMAND (ikev2_initiate_command, static) = {
697 .path = "ikev2 initiate",
699 "ikev2 initiate sa-init <profile id>\n"
700 "ikev2 initiate del-child-sa <child sa ispi>\n"
701 "ikev2 initiate del-sa <sa ispi>\n"
702 "ikev2 initiate rekey-child-sa <profile id> <child sa ispi>\n",
703 .function = ikev2_initiate_command_fn,
708 ikev2_cli_reference (void)
712 static clib_error_t *
713 ikev2_set_log_level_command_fn (vlib_main_t * vm,
714 unformat_input_t * input,
715 vlib_cli_command_t * cmd)
717 unformat_input_t _line_input, *line_input = &_line_input;
718 u32 log_level = IKEV2_LOG_NONE;
719 clib_error_t *error = 0;
721 /* Get a line of input. */
722 if (!unformat_user (input, unformat_line_input, line_input))
725 if (!unformat (line_input, "%d", &log_level))
727 error = clib_error_return (0, "unknown input '%U'",
728 format_unformat_error, line_input);
731 int rc = ikev2_set_log_level (log_level);
733 error = clib_error_return (0, "setting log level failed!");
736 unformat_free (line_input);
741 VLIB_CLI_COMMAND (ikev2_set_log_level_command, static) = {
742 .path = "ikev2 set logging level",
743 .function = ikev2_set_log_level_command_fn,
744 .short_help = "ikev2 set logging level <0-5>",
749 * fd.io coding-style-patch-verification: ON
752 * eval: (c-set-style "gnu")