From 613b2c3c78fbec12cc87a0095ee5488252449698 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Thu, 10 Sep 2020 17:44:41 +0200 Subject: cnat: Add support for SNat ICMP Type: feature snat supports : * echo request/reply by allocating an identifier when translating echo requests * icmp errors in the same manner as dnat Change-Id: I684e983b0181f95c5eace5a984d40084e5625fa4 Signed-off-by: Nathan Skrzypczak --- src/plugins/cnat/cnat_types.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/plugins/cnat/cnat_types.c') diff --git a/src/plugins/cnat/cnat_types.c b/src/plugins/cnat/cnat_types.c index ae485a48d79..9db953f0174 100644 --- a/src/plugins/cnat/cnat_types.c +++ b/src/plugins/cnat/cnat_types.c @@ -80,9 +80,14 @@ cnat_types_init (vlib_main_t * vm) CNAT_FIB_SOURCE_PRIORITY, FIB_SOURCE_BH_SIMPLE); + clib_rwlock_init (&cnat_main.ts_lock); - clib_spinlock_init (&cnat_main.src_ports_lock); - clib_bitmap_validate (cnat_main.src_ports, UINT16_MAX); + vec_validate (cnat_main.src_ports, CNAT_N_SPORT_PROTO); + for (int i = 0; i < CNAT_N_SPORT_PROTO; i++) + { + clib_spinlock_init (&cnat_main.src_ports[i].lock); + clib_bitmap_validate (cnat_main.src_ports[i].bmap, UINT16_MAX); + } throttle_init (&cnat_throttle, n_vlib_mains, 1e-3); return (NULL); -- cgit 1.2.3-korg