diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2016-08-26 12:44:38 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2016-08-27 10:40:26 +0000 |
commit | 94195c85fe91a6773b1b4ab4ac9fa5c7935b4622 (patch) | |
tree | 42e362cb1bc1ff4cc11ac7a4f93597332f234c9f | |
parent | ab4e86cb95f061f9ebb2d01e5ccbc2916eeccab7 (diff) |
VPP-356: Fix wrong byte order in LISP API
Change-Id: Ib2284025b8394a87f1d5765713adb7070b450cba
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
(cherry picked from commit e3552c45f38d1f101cf512c9046647201d6c121b)
-rw-r--r-- | vpp-api-test/vat/api_format.c | 4 | ||||
-rw-r--r-- | vpp/vpp-api/api.c | 7 | ||||
-rw-r--r-- | vpp/vpp-api/custom_dump.c | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 7c4c7613e87..3fc3f7b9d45 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -11653,7 +11653,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam) vec_len (locator_set_name)); vec_free (locator_set_name); - mp->locator_num = vec_len (locators); + 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))); @@ -12397,7 +12397,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam) mp->eid_type = eid->type; lisp_eid_put_vat (mp->eid, eid->addr, eid->type); - mp->rloc_num = vec_len (rlocs); + mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs)); clib_memcpy (mp->rlocs, rlocs, (sizeof (rloc_t) * vec_len (rlocs))); vec_free (rlocs); diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index 7a314e25b9d..b5cec7fc038 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -5121,7 +5121,7 @@ vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t * vnet_lisp_add_del_locator_set_args_t _a, *a = &_a; locator_t locator; ls_locator_t *ls_loc; - u32 ls_index = ~0; + u32 ls_index = ~0, locator_num; u8 *locator_name = NULL; int i; @@ -5132,9 +5132,10 @@ vl_api_lisp_add_del_locator_set_t_handler (vl_api_lisp_add_del_locator_set_t * a->name = locator_name; a->is_add = mp->is_add; a->local = 1; + locator_num = clib_net_to_host_u32 (mp->locator_num); memset (&locator, 0, sizeof (locator)); - for (i = 0; i < mp->locator_num; i++) + for (i = 0; i < locator_num; i++) { ls_loc = &((ls_locator_t *) mp->locators)[i]; VALIDATE_SW_IF_INDEX (ls_loc); @@ -5477,7 +5478,7 @@ static void if (rv) goto send_reply; - rlocs = unformat_lisp_locs (mp->rlocs, mp->rloc_num); + rlocs = unformat_lisp_locs (mp->rlocs, clib_net_to_host_u32 (mp->rloc_num)); if (0 == rlocs) goto send_reply; diff --git a/vpp/vpp-api/custom_dump.c b/vpp/vpp-api/custom_dump.c index db5ea646150..95e5f10fc97 100644 --- a/vpp/vpp-api/custom_dump.c +++ b/vpp/vpp-api/custom_dump.c @@ -2318,7 +2318,7 @@ static void *vl_api_lisp_add_del_remote_mapping_t_print mp->eid_type, mp->eid, mp->eid_len, mp->seid, mp->seid_len, mp->is_src_dst); - rloc_num = mp->rloc_num; + rloc_num = clib_net_to_host_u32 (mp->rloc_num); if (0 == rloc_num) s = format (s, "action %d", mp->action); @@ -2470,7 +2470,7 @@ static void *vl_api_lisp_add_del_locator_set_t_print s = format (s, "locator-set %s ", mp->locator_set_name); - loc_num = mp->locator_num; + loc_num = clib_net_to_host_u32 (mp->locator_num); locs = (ls_locator_t *) mp->locators; for (i = 0; i < loc_num; i++) |