summaryrefslogtreecommitdiffstats
path: root/src/plugins/cnat/cnat_translation.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2020-10-13 17:26:47 +0200
committerBeno�t Ganne <bganne@cisco.com>2020-10-21 12:44:40 +0000
commit2082835fea3ccd85e7368327d5baa749be01b537 (patch)
tree6809264cf75a64dee50259c1c0d2145c426b85ea /src/plugins/cnat/cnat_translation.c
parenta5203b53d4fa227560333b890d3e79fc220d1bfd (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_translation.c')
-rw-r--r--src/plugins/cnat/cnat_translation.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/plugins/cnat/cnat_translation.c b/src/plugins/cnat/cnat_translation.c
index 4833df9fc37..263ec05e973 100644
--- a/src/plugins/cnat/cnat_translation.c
+++ b/src/plugins/cnat/cnat_translation.c
@@ -180,7 +180,7 @@ cnat_translation_stack (cnat_translation_t * ct)
fib_protocol_t fproto;
cnat_ep_trk_t *trk;
dpo_proto_t dproto;
- u8 ep_idx = 0;
+ u32 ep_idx = 0;
index_t lbi;
fproto = ip_address_family_to_fib_proto (ct->ct_vip.ce_ip.version);
@@ -198,6 +198,7 @@ cnat_translation_stack (cnat_translation_t * ct)
dpo_set (&ct->ct_lb, DPO_LOAD_BALANCE, dproto, lbi);
dpo_stack (cnat_client_dpo, dproto, &ct->ct_lb, &ct->ct_lb);
+ ct->flags |= CNAT_TRANSLATION_STACKED;
}
int
@@ -277,6 +278,7 @@ cnat_translation_update (cnat_endpoint_t * vip,
}
vec_reset_length (ct->ct_paths);
+ ct->flags &= ~CNAT_TRANSLATION_STACKED;
u64 path_idx = 0;
vec_foreach (path, paths)
@@ -457,6 +459,12 @@ cnat_translation_back_walk_notify (fib_node_t * node,
*/
cnat_translation_t *ct = cnat_translation_get_from_node (node);
+ /* If we have more than FIB_PATH_LIST_POPULAR paths
+ * we might get called during path tracking
+ * (cnat_tracker_track) */
+ if (!(ct->flags & CNAT_TRANSLATION_STACKED))
+ return (FIB_NODE_BACK_WALK_CONTINUE);
+
cnat_translation_stack (ct);
return (FIB_NODE_BACK_WALK_CONTINUE);
@@ -601,9 +609,12 @@ cnat_if_addr_add_del_backend_cb (addr_resolution_t * ar,
ip_address_copy (&ep->ce_ip, address);
ep->ce_flags |= CNAT_EP_FLAG_RESOLVED;
}
+
+ ct->flags &= ~CNAT_TRANSLATION_STACKED;
cnat_tracker_track (ar->cti, trk);
cnat_translation_stack (ct);
+ ct->flags |= CNAT_TRANSLATION_STACKED;
}
static void