diff options
author | Pim van Pelt <pim@ipng.nl> | 2023-01-11 11:31:41 +0000 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2023-01-11 15:15:57 +0000 |
commit | eea6edcda896ccf8d5befed14eb95432a235644c (patch) | |
tree | f79843ea8021c9c4365ae2c8e9b1933e4391ff7c /src | |
parent | 1ce802d6547444e5b00f3b01fdfdd1f80d921249 (diff) |
linux-cp: Fix endianness in lcp response
Creation of LCP will return garbled host_sw_if_index of the newly
created TAP interface.
Example PAPI code:
```
lcp_add = vpp.api.lcp_itf_pair_add_del_v2(is_add=True, sw_if_index=17,
host_if_type=VppEnum.vl_api_lcp_itf_host_type_t.LCP_API_ITF_HOST_TAP,
host_if_name="loop0", netns="dataplane")
print(lcp_add)
lcp_ret = vpp.api.lcp_itf_pair_get()
print(lcp_ret)
```
Before, the returned host_sw_if_index has the wrong endianness:
VPP version is 23.02-rc0~212-gf06a518f8
lcp_itf_pair_add_del_v2_reply(_0=103, context=2, retval=0, host_sw_if_index=301989888)
(lcp_itf_pair_get_reply(_0=105, context=3, retval=0, cursor=4294967295),[lcp_itf_pair_details(_0=106, context=3, phy_sw_if_index=17, host_sw_if_index=18, vif_index=594, host_if_name='loop0', host_if_type=<vl_api_lcp_itf_host_type_t.LCP_API_ITF_HOST_TAP: 0>, netns='dataplane')])
After, it is correctly showing idx 18:
VPP version is 23.02-rc0~212-gf06a518f8
lcp_itf_pair_add_del_v2_reply(_0=103, context=2, retval=0, host_sw_if_index=18)
(lcp_itf_pair_get_reply(_0=105, context=3, retval=0, cursor=4294967295), [lcp_itf_pair_details(_0=106, context=3, phy_sw_if_index=17, host_sw_if_index=18, vif_index=595, host_if_name='loop0', host_if_type=<vl_api_lcp_itf_host_type_t.LCP_API_ITF_HOST_TAP: 0>, netns='dataplane')])
Type: fix
Signed-off-by: pim@ipng.nl
Change-Id: I9085bac0c4a9ad64356c67f9b85f4910131e349e
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/linux-cp/lcp_api.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/linux-cp/lcp_api.c b/src/plugins/linux-cp/lcp_api.c index b976236d576..e7edf559958 100644 --- a/src/plugins/linux-cp/lcp_api.c +++ b/src/plugins/linux-cp/lcp_api.c @@ -123,7 +123,7 @@ vl_api_lcp_itf_pair_add_del_v2_t_handler (vl_api_lcp_itf_pair_add_del_v2_t *mp) BAD_SW_IF_INDEX_LABEL; REPLY_MACRO2_END (VL_API_LCP_ITF_PAIR_ADD_DEL_V2_REPLY, - { rmp->host_sw_if_index = ntohl (host_sw_if_index); }); + { rmp->host_sw_if_index = host_sw_if_index; }); } static void |