diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2020-10-13 17:26:47 +0200 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2020-10-21 12:44:40 +0000 |
commit | 2082835fea3ccd85e7368327d5baa749be01b537 (patch) | |
tree | 6809264cf75a64dee50259c1c0d2145c426b85ea /src/plugins/cnat/cnat_api.c | |
parent | a5203b53d4fa227560333b890d3e79fc220d1bfd (diff) |
cnat: allow max_u16 translation backends
Type: fix
Allow for 65536 backends for a translation.
- use u32 instead of u8
- filter out back_walk with more than
FIB_PATH_LIST_POPULAR backends
- we're still limited by u16 lb_n_buckets
in src/vnet/dpo/load_balance.h
Change-Id: Ib37b958e59b25ef5ef9f92b82008d626860faddd
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/cnat/cnat_api.c')
-rw-r--r-- | src/plugins/cnat/cnat_api.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/cnat/cnat_api.c b/src/plugins/cnat/cnat_api.c index f692451c14b..338cb5926a8 100644 --- a/src/plugins/cnat/cnat_api.c +++ b/src/plugins/cnat/cnat_api.c @@ -88,16 +88,17 @@ vl_api_cnat_translation_update_t_handler (vl_api_cnat_translation_update_t u32 id = ~0; u8 flags; int rv = 0; - u8 pi; + u32 pi, n_paths; rv = ip_proto_decode (mp->translation.ip_proto, &ip_proto); if (rv) goto done; - vec_validate (paths, mp->translation.n_paths - 1); + n_paths = clib_net_to_host_u32 (mp->translation.n_paths); + vec_validate (paths, n_paths - 1); - for (pi = 0; pi < mp->translation.n_paths; pi++) + for (pi = 0; pi < n_paths; pi++) { path = &paths[pi]; cnat_endpoint_tuple_decode (&mp->translation.paths[pi], path); @@ -146,7 +147,7 @@ cnat_translation_send_details (u32 cti, void *args) vl_api_cnat_endpoint_tuple_t *path; size_t msg_size; cnat_translation_t *ct; - u8 n_paths; + u32 n_paths; ctx = args; ct = cnat_translation_get (cti); @@ -158,8 +159,8 @@ cnat_translation_send_details (u32 cti, void *args) /* fill in the message */ mp->context = ctx->context; - mp->translation.n_paths = n_paths; - mp->translation.id = htonl (cti); + mp->translation.n_paths = clib_host_to_net_u32 (n_paths); + mp->translation.id = clib_host_to_net_u32 (cti); cnat_endpoint_encode (&ct->ct_vip, &mp->translation.vip); mp->translation.ip_proto = ip_proto_encode (ct->ct_proto); |