X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fipsec%2Fipsec.c;fp=src%2Fvnet%2Fipsec%2Fipsec.c;h=d154b519ecb9f158f7d75afe36e24dc45cff9d05;hb=b2d36784ac6689e323017a6adb9fc284aae01e13;hp=74713458b145967438dba5cd3ed31c2a3e338aff;hpb=328b5dadb35916e8147237f2339dd5f4c38912fc;p=vpp.git diff --git a/src/vnet/ipsec/ipsec.c b/src/vnet/ipsec/ipsec.c index 74713458b14..d154b519ecb 100644 --- a/src/vnet/ipsec/ipsec.c +++ b/src/vnet/ipsec/ipsec.c @@ -24,6 +24,7 @@ #include #include #include +#include ipsec_main_t ipsec_main; esp_async_post_next_t esp_encrypt_async_next; @@ -549,6 +550,56 @@ ipsec_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (ipsec_init); +static clib_error_t * +ipsec_config (vlib_main_t *vm, unformat_input_t *input) +{ + unformat_input_t sub_input; + + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (input, "ip4 %U", unformat_vlib_cli_sub_input, &sub_input)) + { + uword table_size = ~0; + u32 n_buckets = ~0; + + while (unformat_check_input (&sub_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (&sub_input, "num-buckets %u", &n_buckets)) + ; + else + return clib_error_return (0, "unknown input `%U'", + format_unformat_error, &sub_input); + } + + ipsec_tun_table_init (AF_IP4, table_size, n_buckets); + } + else if (unformat (input, "ip6 %U", unformat_vlib_cli_sub_input, + &sub_input)) + { + uword table_size = ~0; + u32 n_buckets = ~0; + + while (unformat_check_input (&sub_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (&sub_input, "num-buckets %u", &n_buckets)) + ; + else + return clib_error_return (0, "unknown input `%U'", + format_unformat_error, &sub_input); + } + + ipsec_tun_table_init (AF_IP6, table_size, n_buckets); + } + else + return clib_error_return (0, "unknown input `%U'", + format_unformat_error, input); + } + + return 0; +} + +VLIB_CONFIG_FUNCTION (ipsec_config, "ipsec"); + /* * fd.io coding-style-patch-verification: ON *