diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2020-11-16 18:57:52 +0100 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2021-01-28 13:34:15 +0000 |
commit | 208891c093468b753830d1e7ebdb4a69d4c192bf (patch) | |
tree | 1e184fd62916e483d2ccee673130ea5890b97ba1 /src/plugins/cnat/cnat_client.h | |
parent | 5214f3a2c89ed0858e9383dbaefd3202f354610d (diff) |
cnat: Fix throttle hash & cleanup
Type: fix
This fixes two issues :
- We used a hash to throttle RPC for adding fib entries,
but as we rely on a refcount, we cannot accept loosing an
entry, which could happen in case of a collision.
- On client cleanup we weren't freeing the fib entry correctly
which resulted in crashes when recreating an entry.
Added a test that ensures proper cleanup
Change-Id: Ie6660b0b02241f75092737410ae2299f8710d6b9
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/cnat/cnat_client.h')
-rw-r--r-- | src/plugins/cnat/cnat_client.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/plugins/cnat/cnat_client.h b/src/plugins/cnat/cnat_client.h index 9bc622dcc2c..d6e3631d868 100644 --- a/src/plugins/cnat/cnat_client.h +++ b/src/plugins/cnat/cnat_client.h @@ -93,11 +93,6 @@ cnat_client_get (index_t i) return (pool_elt_at_index (cnat_client_pool, i)); } -typedef struct cnat_learn_arg_t_ -{ - ip_address_t addr; -} cnat_learn_arg_t; - /** * A translation that references this VIP was deleted */ @@ -111,7 +106,7 @@ extern void cnat_client_translation_added (index_t cci); * Called in the main thread by RPC from the workers to learn a * new client */ -extern void cnat_client_learn (const cnat_learn_arg_t * l); +extern void cnat_client_learn (const ip_address_t *addr); extern index_t cnat_client_add (const ip_address_t * ip, u8 flags); @@ -127,8 +122,6 @@ typedef enum { /* IP already present in the FIB, need to interpose dpo */ CNAT_FLAG_EXCLUSIVE = (1 << 1), - /* Prune this entry */ - CNAT_FLAG_EXPIRES = (1 << 2), } cnat_entry_flag_t; @@ -144,8 +137,8 @@ typedef struct cnat_client_db_t_ /* Pool of addresses that have been throttled and need to be refcounted before calling cnat_client_free_by_ip */ - ip_address_t **throttle_pool; - clib_spinlock_t *throttle_pool_lock; + clib_spinlock_t throttle_lock; + uword *throttle_mem; } cnat_client_db_t; extern cnat_client_db_t cnat_client_db; |