2 * decap.c : IPSec tunnel support
4 * Copyright (c) 2015 Cisco and/or its affiliates.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include <vnet/vnet.h>
19 #include <vnet/api_errno.h>
20 #include <vnet/ip/ip.h>
21 #include <vnet/interface.h>
22 #include <vnet/fib/fib.h>
24 #include <vnet/ipsec/ipsec.h>
25 #include <vnet/ipsec/ipsec_tun.h>
28 set_interface_spd_command_fn (vlib_main_t * vm,
29 unformat_input_t * input,
30 vlib_cli_command_t * cmd)
32 unformat_input_t _line_input, *line_input = &_line_input;
33 ipsec_main_t *im = &ipsec_main;
34 u32 sw_if_index = (u32) ~ 0;
37 clib_error_t *error = NULL;
39 if (!unformat_user (input, unformat_line_input, line_input))
43 (line_input, "%U %u", unformat_vnet_sw_interface, im->vnet_main,
44 &sw_if_index, &spd_id))
46 else if (unformat (line_input, "del"))
50 error = clib_error_return (0, "parse error: '%U'",
51 format_unformat_error, line_input);
55 ipsec_set_interface_spd (vm, sw_if_index, spd_id, is_add);
58 unformat_free (line_input);
64 VLIB_CLI_COMMAND (set_interface_spd_command, static) = {
65 .path = "set interface ipsec spd",
67 "set interface ipsec spd <int> <id>",
68 .function = set_interface_spd_command_fn,
73 ipsec_sa_add_del_command_fn (vlib_main_t * vm,
74 unformat_input_t * input,
75 vlib_cli_command_t * cmd)
77 unformat_input_t _line_input, *line_input = &_line_input;
78 ip46_address_t tun_src = { }, tun_dst =
81 ipsec_crypto_alg_t crypto_alg;
82 ipsec_integ_alg_t integ_alg;
83 ipsec_protocol_t proto;
84 ipsec_sa_flags_t flags;
86 ipsec_key_t ck = { 0 };
87 ipsec_key_t ik = { 0 };
93 flags = IPSEC_SA_FLAG_NONE;
94 proto = IPSEC_PROTOCOL_ESP;
95 integ_alg = IPSEC_INTEG_ALG_NONE;
96 crypto_alg = IPSEC_CRYPTO_ALG_NONE;
98 if (!unformat_user (input, unformat_line_input, line_input))
101 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
103 if (unformat (line_input, "add %u", &id))
105 else if (unformat (line_input, "del %u", &id))
107 else if (unformat (line_input, "spi %u", &spi))
109 else if (unformat (line_input, "salt 0x%x", &salt))
111 else if (unformat (line_input, "esp"))
112 proto = IPSEC_PROTOCOL_ESP;
113 else if (unformat (line_input, "ah"))
114 proto = IPSEC_PROTOCOL_AH;
115 else if (unformat (line_input, "crypto-key %U",
116 unformat_ipsec_key, &ck))
118 else if (unformat (line_input, "crypto-alg %U",
119 unformat_ipsec_crypto_alg, &crypto_alg))
121 else if (unformat (line_input, "integ-key %U", unformat_ipsec_key, &ik))
123 else if (unformat (line_input, "integ-alg %U",
124 unformat_ipsec_integ_alg, &integ_alg))
126 else if (unformat (line_input, "tunnel-src %U",
127 unformat_ip46_address, &tun_src, IP46_TYPE_ANY))
129 flags |= IPSEC_SA_FLAG_IS_TUNNEL;
130 if (!ip46_address_is_ip4 (&tun_src))
131 flags |= IPSEC_SA_FLAG_IS_TUNNEL_V6;
133 else if (unformat (line_input, "tunnel-dst %U",
134 unformat_ip46_address, &tun_dst, IP46_TYPE_ANY))
136 else if (unformat (line_input, "udp-encap"))
137 flags |= IPSEC_SA_FLAG_UDP_ENCAP;
140 error = clib_error_return (0, "parse error: '%U'",
141 format_unformat_error, line_input);
147 rv = ipsec_sa_add (id, spi, proto, crypto_alg,
148 &ck, integ_alg, &ik, flags,
149 0, clib_host_to_net_u32 (salt),
150 &tun_src, &tun_dst, NULL);
152 rv = ipsec_sa_del (id);
155 error = clib_error_return (0, "failed");
158 unformat_free (line_input);
164 VLIB_CLI_COMMAND (ipsec_sa_add_del_command, static) = {
167 "ipsec sa [add|del]",
168 .function = ipsec_sa_add_del_command_fn,
172 static clib_error_t *
173 ipsec_spd_add_del_command_fn (vlib_main_t * vm,
174 unformat_input_t * input,
175 vlib_cli_command_t * cmd)
177 unformat_input_t _line_input, *line_input = &_line_input;
180 clib_error_t *error = NULL;
182 if (!unformat_user (input, unformat_line_input, line_input))
185 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
187 if (unformat (line_input, "add"))
189 else if (unformat (line_input, "del"))
191 else if (unformat (line_input, "%u", &spd_id))
195 error = clib_error_return (0, "parse error: '%U'",
196 format_unformat_error, line_input);
203 error = clib_error_return (0, "please specify SPD ID");
207 ipsec_add_del_spd (vm, spd_id, is_add);
210 unformat_free (line_input);
216 VLIB_CLI_COMMAND (ipsec_spd_add_del_command, static) = {
219 "ipsec spd [add|del] <id>",
220 .function = ipsec_spd_add_del_command_fn,
225 static clib_error_t *
226 ipsec_policy_add_del_command_fn (vlib_main_t * vm,
227 unformat_input_t * input,
228 vlib_cli_command_t * cmd)
230 unformat_input_t _line_input, *line_input = &_line_input;
233 u32 tmp, tmp2, stat_index;
234 clib_error_t *error = NULL;
237 clib_memset (&p, 0, sizeof (p));
238 p.lport.stop = p.rport.stop = ~0;
241 if (!unformat_user (input, unformat_line_input, line_input))
244 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
246 if (unformat (line_input, "add"))
248 else if (unformat (line_input, "del"))
250 else if (unformat (line_input, "spd %u", &p.id))
252 else if (unformat (line_input, "inbound"))
254 else if (unformat (line_input, "outbound"))
256 else if (unformat (line_input, "priority %d", &p.priority))
258 else if (unformat (line_input, "protocol %u", &tmp))
259 p.protocol = (u8) tmp;
262 (line_input, "action %U", unformat_ipsec_policy_action,
265 if (p.policy == IPSEC_POLICY_ACTION_RESOLVE)
267 error = clib_error_return (0, "unsupported action: 'resolve'");
271 else if (unformat (line_input, "sa %u", &p.sa_id))
273 else if (unformat (line_input, "local-ip-range %U - %U",
274 unformat_ip4_address, &p.laddr.start.ip4,
275 unformat_ip4_address, &p.laddr.stop.ip4))
277 else if (unformat (line_input, "remote-ip-range %U - %U",
278 unformat_ip4_address, &p.raddr.start.ip4,
279 unformat_ip4_address, &p.raddr.stop.ip4))
281 else if (unformat (line_input, "local-ip-range %U - %U",
282 unformat_ip6_address, &p.laddr.start.ip6,
283 unformat_ip6_address, &p.laddr.stop.ip6))
287 else if (unformat (line_input, "remote-ip-range %U - %U",
288 unformat_ip6_address, &p.raddr.start.ip6,
289 unformat_ip6_address, &p.raddr.stop.ip6))
293 else if (unformat (line_input, "local-port-range %u - %u", &tmp, &tmp2))
297 p.lport.start = clib_host_to_net_u16 (p.lport.start);
298 p.lport.stop = clib_host_to_net_u16 (p.lport.stop);
301 if (unformat (line_input, "remote-port-range %u - %u", &tmp, &tmp2))
305 p.rport.start = clib_host_to_net_u16 (p.rport.start);
306 p.rport.stop = clib_host_to_net_u16 (p.rport.stop);
310 error = clib_error_return (0, "parse error: '%U'",
311 format_unformat_error, line_input);
316 rv = ipsec_policy_mk_type (is_outbound, p.is_ipv6, p.policy, &p.type);
320 error = clib_error_return (0, "unsupported policy type for:",
321 " outboud:%s %s action:%U",
322 (is_outbound ? "yes" : "no"),
323 (p.is_ipv6 ? "IPv4" : "IPv6"),
324 format_ipsec_policy_action, p.policy);
328 rv = ipsec_add_del_policy (vm, &p, is_add, &stat_index);
331 vlib_cli_output (vm, "policy-index:%d", stat_index);
333 vlib_cli_output (vm, "error:%d", rv);
336 unformat_free (line_input);
342 VLIB_CLI_COMMAND (ipsec_policy_add_del_command, static) = {
343 .path = "ipsec policy",
345 "ipsec policy [add|del] spd <id> priority <n> ",
346 .function = ipsec_policy_add_del_command_fn,
351 ipsec_sa_show_all (vlib_main_t * vm, ipsec_main_t * im)
356 pool_foreach_index (sai, im->sad, ({
357 vlib_cli_output(vm, "%U", format_ipsec_sa, sai, IPSEC_FORMAT_BRIEF);
363 ipsec_spd_show_all (vlib_main_t * vm, ipsec_main_t * im)
368 pool_foreach_index (spdi, im->spds, ({
369 vlib_cli_output(vm, "%U", format_ipsec_spd, spdi);
375 ipsec_spd_bindings_show_all (vlib_main_t * vm, ipsec_main_t * im)
377 u32 spd_id, sw_if_index;
380 vlib_cli_output (vm, "SPD Bindings:");
383 hash_foreach(sw_if_index, spd_id, im->spd_index_by_sw_if_index, ({
384 spd = pool_elt_at_index (im->spds, spd_id);
385 vlib_cli_output (vm, " %d -> %U", spd->id,
386 format_vnet_sw_if_index_name, im->vnet_main,
393 ipsec_tunnel_show_all (vlib_main_t * vm, ipsec_main_t * im)
397 vlib_cli_output (vm, "Tunnel interfaces");
399 pool_foreach_index (ti, im->tunnel_interfaces, ({
400 vlib_cli_output(vm, " %U", format_ipsec_tunnel, ti);
405 static clib_error_t *
406 show_ipsec_command_fn (vlib_main_t * vm,
407 unformat_input_t * input, vlib_cli_command_t * cmd)
409 ipsec_main_t *im = &ipsec_main;
411 ipsec_sa_show_all (vm, im);
412 ipsec_spd_show_all (vm, im);
413 ipsec_spd_bindings_show_all (vm, im);
414 ipsec_tunnel_show_all (vm, im);
420 VLIB_CLI_COMMAND (show_ipsec_command, static) = {
421 .path = "show ipsec all",
422 .short_help = "show ipsec all",
423 .function = show_ipsec_command_fn,
427 static clib_error_t *
428 show_ipsec_sa_command_fn (vlib_main_t * vm,
429 unformat_input_t * input, vlib_cli_command_t * cmd)
431 ipsec_main_t *im = &ipsec_main;
434 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
436 if (unformat (input, "%u", &sai))
443 ipsec_sa_show_all (vm, im);
445 vlib_cli_output (vm, "%U", format_ipsec_sa, sai, IPSEC_FORMAT_DETAIL);
450 static clib_error_t *
451 clear_ipsec_sa_command_fn (vlib_main_t * vm,
452 unformat_input_t * input, vlib_cli_command_t * cmd)
454 ipsec_main_t *im = &ipsec_main;
457 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
459 if (unformat (input, "%u", &sai))
468 pool_foreach_index (sai, im->sad, ({
475 if (pool_is_free_index (im->sad, sai))
476 return clib_error_return (0, "unknown SA index: %d", sai);
478 ipsec_sa_clear (sai);
485 VLIB_CLI_COMMAND (show_ipsec_sa_command, static) = {
486 .path = "show ipsec sa",
487 .short_help = "show ipsec sa [index]",
488 .function = show_ipsec_sa_command_fn,
491 VLIB_CLI_COMMAND (clear_ipsec_sa_command, static) = {
492 .path = "clear ipsec sa",
493 .short_help = "clear ipsec sa [index]",
494 .function = clear_ipsec_sa_command_fn,
498 static clib_error_t *
499 show_ipsec_spd_command_fn (vlib_main_t * vm,
500 unformat_input_t * input, vlib_cli_command_t * cmd)
502 ipsec_main_t *im = &ipsec_main;
503 u8 show_bindings = 0;
506 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
508 if (unformat (input, "%u", &spdi))
510 else if (unformat (input, "bindings"))
517 ipsec_spd_bindings_show_all (vm, im);
519 vlib_cli_output (vm, "%U", format_ipsec_spd, spdi);
521 ipsec_spd_show_all (vm, im);
527 VLIB_CLI_COMMAND (show_ipsec_spd_command, static) = {
528 .path = "show ipsec spd",
529 .short_help = "show ipsec spd [index]",
530 .function = show_ipsec_spd_command_fn,
534 static clib_error_t *
535 show_ipsec_tunnel_command_fn (vlib_main_t * vm,
536 unformat_input_t * input,
537 vlib_cli_command_t * cmd)
539 ipsec_main_t *im = &ipsec_main;
542 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
544 if (unformat (input, "%u", &ti))
551 vlib_cli_output (vm, "%U", format_ipsec_tunnel, ti);
553 ipsec_tunnel_show_all (vm, im);
559 VLIB_CLI_COMMAND (show_ipsec_tunnel_command, static) = {
560 .path = "show ipsec tunnel",
561 .short_help = "show ipsec tunnel [index]",
562 .function = show_ipsec_tunnel_command_fn,
566 static clib_error_t *
567 ipsec_show_backends_command_fn (vlib_main_t * vm,
568 unformat_input_t * input,
569 vlib_cli_command_t * cmd)
571 ipsec_main_t *im = &ipsec_main;
574 (void) unformat (input, "verbose %u", &verbose);
576 vlib_cli_output (vm, "IPsec AH backends available:");
577 u8 *s = format (NULL, "%=25s %=25s %=10s\n", "Name", "Index", "Active");
578 ipsec_ah_backend_t *ab;
580 pool_foreach (ab, im->ah_backends, {
581 s = format (s, "%=25s %=25u %=10s\n", ab->name, ab - im->ah_backends,
582 ab - im->ah_backends == im->ah_current_backend ? "yes" : "no");
585 n = vlib_get_node (vm, ab->ah4_encrypt_node_index);
586 s = format (s, " enc4 %s (next %d)\n", n->name, ab->ah4_encrypt_next_index);
587 n = vlib_get_node (vm, ab->ah4_decrypt_node_index);
588 s = format (s, " dec4 %s (next %d)\n", n->name, ab->ah4_decrypt_next_index);
589 n = vlib_get_node (vm, ab->ah6_encrypt_node_index);
590 s = format (s, " enc6 %s (next %d)\n", n->name, ab->ah6_encrypt_next_index);
591 n = vlib_get_node (vm, ab->ah6_decrypt_node_index);
592 s = format (s, " dec6 %s (next %d)\n", n->name, ab->ah6_decrypt_next_index);
596 vlib_cli_output (vm, "%v", s);
598 vlib_cli_output (vm, "IPsec ESP backends available:");
599 s = format (s, "%=25s %=25s %=10s\n", "Name", "Index", "Active");
600 ipsec_esp_backend_t *eb;
602 pool_foreach (eb, im->esp_backends, {
603 s = format (s, "%=25s %=25u %=10s\n", eb->name, eb - im->esp_backends,
604 eb - im->esp_backends == im->esp_current_backend ? "yes"
608 n = vlib_get_node (vm, eb->esp4_encrypt_node_index);
609 s = format (s, " enc4 %s (next %d)\n", n->name, eb->esp4_encrypt_next_index);
610 n = vlib_get_node (vm, eb->esp4_decrypt_node_index);
611 s = format (s, " dec4 %s (next %d)\n", n->name, eb->esp4_decrypt_next_index);
612 n = vlib_get_node (vm, eb->esp6_encrypt_node_index);
613 s = format (s, " enc6 %s (next %d)\n", n->name, eb->esp6_encrypt_next_index);
614 n = vlib_get_node (vm, eb->esp6_decrypt_node_index);
615 s = format (s, " dec6 %s (next %d)\n", n->name, eb->esp6_decrypt_next_index);
619 vlib_cli_output (vm, "%v", s);
626 VLIB_CLI_COMMAND (ipsec_show_backends_command, static) = {
627 .path = "show ipsec backends",
628 .short_help = "show ipsec backends",
629 .function = ipsec_show_backends_command_fn,
633 static clib_error_t *
634 ipsec_select_backend_command_fn (vlib_main_t * vm,
635 unformat_input_t * input,
636 vlib_cli_command_t * cmd)
638 unformat_input_t _line_input, *line_input = &_line_input;
639 ipsec_main_t *im = &ipsec_main;
643 error = ipsec_rsc_in_use (im);
648 /* Get a line of input. */
649 if (!unformat_user (input, unformat_line_input, line_input))
652 if (unformat (line_input, "ah"))
654 if (unformat (line_input, "%u", &backend_index))
656 if (ipsec_select_ah_backend (im, backend_index) < 0)
658 return clib_error_return (0, "Invalid AH backend index `%u'",
664 return clib_error_return (0, "Invalid backend index `%U'",
665 format_unformat_error, line_input);
668 else if (unformat (line_input, "esp"))
670 if (unformat (line_input, "%u", &backend_index))
672 if (ipsec_select_esp_backend (im, backend_index) < 0)
674 return clib_error_return (0, "Invalid ESP backend index `%u'",
680 return clib_error_return (0, "Invalid backend index `%U'",
681 format_unformat_error, line_input);
686 return clib_error_return (0, "Unknown input `%U'",
687 format_unformat_error, line_input);
694 VLIB_CLI_COMMAND (ipsec_select_backend_command, static) = {
695 .path = "ipsec select backend",
696 .short_help = "ipsec select backend <ah|esp> <backend index>",
697 .function = ipsec_select_backend_command_fn,
702 static clib_error_t *
703 clear_ipsec_counters_command_fn (vlib_main_t * vm,
704 unformat_input_t * input,
705 vlib_cli_command_t * cmd)
707 vlib_clear_combined_counters (&ipsec_spd_policy_counters);
708 vlib_clear_combined_counters (&ipsec_sa_counters);
714 VLIB_CLI_COMMAND (clear_ipsec_counters_command, static) = {
715 .path = "clear ipsec counters",
716 .short_help = "clear ipsec counters",
717 .function = clear_ipsec_counters_command_fn,
721 static clib_error_t *
722 create_ipsec_tunnel_command_fn (vlib_main_t * vm,
723 unformat_input_t * input,
724 vlib_cli_command_t * cmd)
726 unformat_input_t _line_input, *line_input = &_line_input;
727 ipsec_add_del_tunnel_args_t a;
732 clib_error_t *error = NULL;
733 ipsec_key_t rck = { 0 };
734 ipsec_key_t lck = { 0 };
735 ipsec_key_t lik = { 0 };
736 ipsec_key_t rik = { 0 };
738 clib_memset (&a, 0, sizeof (a));
741 /* Get a line of input. */
742 if (!unformat_user (input, unformat_line_input, line_input))
745 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
748 (line_input, "local-ip %U", unformat_ip46_address, &a.local_ip,
751 ip46_address_is_ip4 (&a.local_ip) ? (ipv4_set = 1) : (ipv6_set = 1);
756 (line_input, "remote-ip %U", unformat_ip46_address, &a.remote_ip,
759 ip46_address_is_ip4 (&a.remote_ip) ? (ipv4_set = 1) : (ipv6_set =
763 else if (unformat (line_input, "local-spi %u", &a.local_spi))
765 else if (unformat (line_input, "remote-spi %u", &a.remote_spi))
767 else if (unformat (line_input, "instance %u", &a.show_instance))
769 else if (unformat (line_input, "salt 0x%x", &a.salt))
771 else if (unformat (line_input, "udp-encap"))
773 else if (unformat (line_input, "use-esn"))
775 else if (unformat (line_input, "use-anti-replay"))
777 else if (unformat (line_input, "tx-table %u", &a.tx_table_id))
781 (line_input, "local-crypto-key %U", unformat_ipsec_key, &lck))
785 (line_input, "remote-crypto-key %U", unformat_ipsec_key, &rck))
787 else if (unformat (line_input, "crypto-alg %U",
788 unformat_ipsec_crypto_alg, &a.crypto_alg))
792 (line_input, "local-integ-key %U", unformat_ipsec_key, &lik))
796 (line_input, "remote-integ-key %U", unformat_ipsec_key, &rik))
798 else if (unformat (line_input, "integ-alg %U",
799 unformat_ipsec_integ_alg, &a.integ_alg))
801 else if (unformat (line_input, "del"))
805 error = clib_error_return (0, "unknown input `%U'",
806 format_unformat_error, line_input);
813 error = clib_error_return (0, "mandatory argument(s) missing");
817 if (ipv4_set && ipv6_set)
818 return clib_error_return (0, "both IPv4 and IPv6 addresses specified");
822 clib_memcpy (a.local_crypto_key, lck.data, lck.len);
823 a.local_crypto_key_len = lck.len;
824 clib_memcpy (a.remote_crypto_key, rck.data, rck.len);
825 a.remote_crypto_key_len = rck.len;
827 clib_memcpy (a.local_integ_key, lik.data, lik.len);
828 a.local_integ_key_len = lck.len;
829 clib_memcpy (a.remote_integ_key, rik.data, rik.len);
830 a.remote_integ_key_len = rck.len;
832 rv = ipsec_add_del_tunnel_if (&a);
838 case VNET_API_ERROR_INVALID_VALUE:
840 error = clib_error_return (0,
841 "IPSec tunnel interface already exists...");
843 error = clib_error_return (0, "IPSec tunnel interface not exists...");
846 error = clib_error_return (0, "ipsec_register_interface returned %d",
852 unformat_free (line_input);
858 VLIB_CLI_COMMAND (create_ipsec_tunnel_command, static) = {
859 .path = "create ipsec tunnel",
860 .short_help = "create ipsec tunnel local-ip <addr> local-spi <spi> "
861 "remote-ip <addr> remote-spi <spi> [instance <inst_num>] [udp-encap] [use-esn] [use-anti-replay] "
862 "[tx-table <table-id>]",
863 .function = create_ipsec_tunnel_command_fn,
867 static clib_error_t *
868 ipsec_tun_protect_cmd (vlib_main_t * vm,
869 unformat_input_t * input, vlib_cli_command_t * cmd)
871 unformat_input_t _line_input, *line_input = &_line_input;
872 u32 sw_if_index, is_del, sa_in, sa_out, *sa_ins = NULL;
877 vnm = vnet_get_main ();
879 if (!unformat_user (input, unformat_line_input, line_input))
882 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
884 if (unformat (line_input, "del"))
886 else if (unformat (line_input, "add"))
888 else if (unformat (line_input, "sa-in %d", &sa_in))
889 vec_add1 (sa_ins, sa_in);
890 else if (unformat (line_input, "sa-out %d", &sa_out))
892 else if (unformat (line_input, "%U",
893 unformat_vnet_sw_interface, vnm, &sw_if_index))
896 return (clib_error_return (0, "unknown input '%U'",
897 format_unformat_error, line_input));
901 ipsec_tun_protect_update (sw_if_index, sa_out, sa_ins);
903 unformat_free (line_input);
908 * Protect tunnel with IPSEC
911 VLIB_CLI_COMMAND (ipsec_tun_protect_cmd_node, static) =
913 .path = "ipsec tunnel protect",
914 .function = ipsec_tun_protect_cmd,
915 .short_help = "ipsec tunnel protect <interface> input-sa <SA> output-sa <SA>",
916 // this is not MP safe
921 ipsec_tun_protect_show_one (index_t itpi, void *ctx)
923 vlib_cli_output (ctx, "%U", format_ipsec_tun_protect, itpi);
925 return (WALK_CONTINUE);
928 static clib_error_t *
929 ipsec_tun_protect_show (vlib_main_t * vm,
930 unformat_input_t * input, vlib_cli_command_t * cmd)
932 ipsec_tun_protect_walk (ipsec_tun_protect_show_one, vm);
938 * show IPSEC tunnel protection
941 VLIB_CLI_COMMAND (ipsec_tun_protect_show_node, static) =
943 .path = "show ipsec protect",
944 .function = ipsec_tun_protect_show,
945 .short_help = "show ipsec protect",
950 ipsec_cli_init (vlib_main_t * vm)
955 VLIB_INIT_FUNCTION (ipsec_cli_init);
959 * fd.io coding-style-patch-verification: ON
962 * eval: (c-set-style "gnu")