diff options
Diffstat (limited to 'src/plugins/ikev2/ikev2_test.c')
-rw-r--r-- | src/plugins/ikev2/ikev2_test.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/plugins/ikev2/ikev2_test.c b/src/plugins/ikev2/ikev2_test.c index 98b3fa054ae..b63778ed103 100644 --- a/src/plugins/ikev2/ikev2_test.c +++ b/src/plugins/ikev2/ikev2_test.c @@ -1061,6 +1061,53 @@ api_ikev2_set_tunnel_interface (vat_main_t * vam) } static int +api_ikev2_set_responder_hostname (vat_main_t *vam) +{ + unformat_input_t *i = vam->input; + vl_api_ikev2_set_responder_hostname_t *mp; + int ret; + u8 *name = 0, *hn = 0; + + while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) + { + if (unformat (i, "%U hostname %v", unformat_token, valid_chars, &name, + &hn)) + { + vec_add1 (name, 0); + vec_add1 (hn, 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_SET_RESPONDER_HOSTNAME, mp); + + clib_memcpy (mp->name, name, vec_len (name)); + clib_memcpy (mp->hostname, hn, vec_len (hn)); + vec_free (name); + vec_free (hn); + + S (mp); + W (ret); + return ret; +} + +static int api_ikev2_set_responder (vat_main_t * vam) { unformat_input_t *i = vam->input; |