diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2020-02-25 09:27:10 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-03-02 09:10:57 +0000 |
commit | b29d523af039ac007238300a7316ba9e3e44ce25 (patch) | |
tree | a33fd5e17a9df9d881ced2d03b99a6b92f15492a /src/plugins/ikev2/ikev2_test.c | |
parent | 05aceacc38d1988c0651829d4733feb4745b427e (diff) |
ikev2: make UDP encap flag configurable
Type: improvement
Change-Id: I081dec2dc0c2bd0845dd4638b7b2f12806594112
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/ikev2/ikev2_test.c')
-rw-r--r-- | src/plugins/ikev2/ikev2_test.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/plugins/ikev2/ikev2_test.c b/src/plugins/ikev2/ikev2_test.c index cd9445d2f38..9ff4bbcc58c 100644 --- a/src/plugins/ikev2/ikev2_test.c +++ b/src/plugins/ikev2/ikev2_test.c @@ -407,6 +407,49 @@ api_ikev2_set_local_key (vat_main_t * vam) } static int +api_ikev2_profile_set_udp_encap (vat_main_t * vam) +{ + unformat_input_t *i = vam->input; + vl_api_ikev2_set_responder_t *mp; + int ret; + u8 *name = 0; + + const char *valid_chars = "a-zA-Z0-9_"; + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "%U udp-encap", unformat_token, valid_chars, &name)) + vec_add1 (name, 0); + else + { + errmsg ("parse error '%U'", format_unformat_error, i); + return -99; + } + } + + if (!vec_len (name)) + { + errmsg ("profile name must be specified"); + return -99; + } + + if (vec_len (name) > 64) + { + errmsg ("profile name too long"); + return -99; + } + + M (IKEV2_PROFILE_SET_UDP_ENCAP, mp); + + clib_memcpy (mp->name, name, vec_len (name)); + vec_free (name); + + S (mp); + W (ret); + return ret; +} + +static int api_ikev2_set_tunnel_interface (vat_main_t * vam) { return (0); |