aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api-test
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2016-09-27 13:28:01 +0200
committerFlorin Coras <florin.coras@gmail.com>2016-09-27 17:28:13 +0000
commit3fa0af596056ae6e87692325c7ebe51636635313 (patch)
tree90da789ea3c51d65fdab1213255e1bb43a6ea014 /vpp-api-test
parent719311ba824a90641c08c387cf9e7fa49676edc8 (diff)
VPP-448 Fix LISP APIs using binary data
* use zero length array in LISP API to avoid confusion * add missing LISP data structure definitions in API documentation * fix wrong memory allocation in VAT Change-Id: I9b5e656a071fc24cb698c164db953c09b66deeeb Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'vpp-api-test')
-rw-r--r--vpp-api-test/vat/api_format.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index 27c80d901a1..4b1d41fa177 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -11870,6 +11870,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
u8 locator_set_name_set = 0;
ls_locator_t locator, *locators = 0;
u32 sw_if_index, priority, weight;
+ u32 data_len = 0;
/* Parse args required to build the message */
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -11918,8 +11919,10 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
}
vec_add1 (locator_set_name, 0);
+ data_len = sizeof (ls_locator_t) * vec_len (locators);
+
/* Construct the API message */
- M (LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set);
+ M2 (LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set, data_len);
mp->is_add = is_add;
clib_memcpy (mp->locator_set_name, locator_set_name,
@@ -11928,8 +11931,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
mp->locator_num = clib_host_to_net_u32 (vec_len (locators));
if (locators)
- clib_memcpy (mp->locators, locators,
- (sizeof (ls_locator_t) * vec_len (locators)));
+ clib_memcpy (mp->locators, locators, data_len);
vec_free (locators);
/* send it... */
@@ -12667,7 +12669,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
lisp_eid_vat_t _eid, *eid = &_eid;
lisp_eid_vat_t _seid, *seid = &_seid;
u8 is_add = 1, del_all = 0, eid_set = 0, seid_set = 0;
- u32 action = ~0, p, w;
+ u32 action = ~0, p, w, data_len;
ip4_address_t rloc4;
ip6_address_t rloc6;
rloc_t *rlocs = 0, rloc, *curr_rloc = 0;
@@ -12749,7 +12751,9 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
return -99;
}
- M (LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping);
+ data_len = vec_len (rlocs) * sizeof (rloc_t);
+
+ M2 (LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping, data_len);
mp->is_add = is_add;
mp->vni = htonl (vni);
mp->action = (u8) action;
@@ -12762,7 +12766,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
lisp_eid_put_vat (mp->seid, seid->addr, seid->type);
mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs));
- clib_memcpy (mp->rlocs, rlocs, (sizeof (rloc_t) * vec_len (rlocs)));
+ clib_memcpy (mp->rlocs, rlocs, data_len);
vec_free (rlocs);
/* send it... */