diff options
author | Ole Troan <otroan@employees.org> | 2024-04-26 14:11:20 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2024-05-07 09:59:31 +0000 |
commit | 1a319aadc68c218f741a7cb23acbe70c4addae92 (patch) | |
tree | 766211fc3f5b37de2626f2f7895094fc5c44f896 /src/plugins/nat/nat44-ed/nat44_ed_api.c | |
parent | 4013851e42b94ebfa0a2ae398c58ecc9ea9b5c95 (diff) |
api: add to_net parameter to endian messages
The VPP API auto-generated endian conversion functions are intended to
be symmetrical. They are used both by the API client and the API server.
Called on send to convert from host endian to network endian and on
receive to convert back.
For variable length arrays, we have to iterate over the array and call
a more specific handler for the array type. Unfortunately the length of
the array is part of the api definition, and if it's endian swapped
prior to the for loop, unexpected behaviour will ensue.
There was an earlier fix, for some specific messages, but unfortunately
that only fixed the problem from the VPP (server) side.
This adds a new parameters to the endian handler, so the boundary
argument to the loop can be treated differently depending on if this
message is to the network or from the network.
Type: fix
Change-Id: I43011aed384e3b847579a1dd2c390867ae17a9ad
Signed-off-by: Ole Troan <otroan@employees.org>
Diffstat (limited to 'src/plugins/nat/nat44-ed/nat44_ed_api.c')
-rw-r--r-- | src/plugins/nat/nat44-ed/nat44_ed_api.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/nat/nat44-ed/nat44_ed_api.c b/src/plugins/nat/nat44-ed/nat44_ed_api.c index 1f01410afce..b6c9d51d777 100644 --- a/src/plugins/nat/nat44-ed/nat44_ed_api.c +++ b/src/plugins/nat/nat44-ed/nat44_ed_api.c @@ -442,7 +442,8 @@ send_nat44_ed_output_interface_details (u32 index, vl_api_registration_t *rp, /* Endian hack until apigen registers _details * endian functions */ - vl_api_nat44_ed_output_interface_details_t_endian (rmp); + vl_api_nat44_ed_output_interface_details_t_endian (rmp, + 1 /* to network */); rmp->_vl_msg_id = htons (rmp->_vl_msg_id); rmp->context = htonl (rmp->context); })); |