ipsec: fix CLI for create ipsec itf

This commit adds missing support in CLI for creating ipsec itf
in p2mp mode.

Type: fix
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: I1bd1cc6667625b8e527af8d25bd8e723751dbc41
This commit is contained in:
Gabriel Oginski
2024-04-18 12:14:34 +00:00
committed by Fan Zhang
parent 9abc01f251
commit 6edc6bcc31

View File

@ -381,6 +381,7 @@ ipsec_itf_create_cli (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
tunnel_mode_t mode = TUNNEL_MODE_P2P;
u32 instance, sw_if_index;
clib_error_t *error;
mac_address_t mac;
@ -396,6 +397,8 @@ ipsec_itf_create_cli (vlib_main_t * vm,
{
if (unformat (line_input, "instance %d", &instance))
;
else if (unformat (line_input, "p2mp"))
mode = TUNNEL_MODE_MP;
else
{
error = clib_error_return (0, "unknown input: %U",
@ -410,7 +413,7 @@ ipsec_itf_create_cli (vlib_main_t * vm,
return error;
}
rv = ipsec_itf_create (instance, TUNNEL_MODE_P2P, &sw_if_index);
rv = ipsec_itf_create (instance, mode, &sw_if_index);
if (rv)
return clib_error_return (0, "iPSec interface create failed");
@ -425,13 +428,13 @@ ipsec_itf_create_cli (vlib_main_t * vm,
*
* @cliexpar
* The following two command syntaxes are equivalent:
* @cliexcmd{ipsec itf create [instance <instance>]}
* @cliexcmd{ipsec itf create [instance <instance>] [p2mp]}
* Example of how to create a ipsec interface:
* @cliexcmd{ipsec itf create}
?*/
VLIB_CLI_COMMAND (ipsec_itf_create_command, static) = {
.path = "ipsec itf create",
.short_help = "ipsec itf create [instance <instance>]",
.short_help = "ipsec itf create [instance <instance>] [p2mp]",
.function = ipsec_itf_create_cli,
};