From: Neale Ranns Date: Mon, 8 Feb 2021 09:53:10 +0000 (+0000) Subject: ipsec: Checking wrong DB for initialistation X-Git-Tag: v21.10-rc0~580 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=0ebbbfc3c50361dbe8556f14f152613689448812;p=vpp.git ipsec: Checking wrong DB for initialistation Type: fix Signed-off-by: Neale Ranns Change-Id: I2325d311a6fd7343c7041dc516777f4db0029823 --- diff --git a/src/vnet/ipsec/ipsec_tun.c b/src/vnet/ipsec/ipsec_tun.c index ea60ab44a8c..63e063fcee3 100644 --- a/src/vnet/ipsec/ipsec_tun.c +++ b/src/vnet/ipsec/ipsec_tun.c @@ -263,15 +263,15 @@ ipsec_tun_protect_rx_db_add (ipsec_main_t * im, ipsec4_tunnel_mk_key(&key, &itp->itp_crypto.dst.ip4, clib_host_to_net_u32 (sa->spi)); - if (!im->tun4_protect_by_key.nbuckets) - clib_bihash_init_8_16 (&im->tun4_protect_by_key, - "IPSec IPv4 tunnels", - IPSEC_TUN_DEFAULT_HASH_NUM_BUCKETS, - IPSEC_TUN_DEFAULT_HASH_MEMORY_SIZE); - - clib_bihash_add_del_8_16 (&im->tun4_protect_by_key, bkey, 1); - ipsec_tun_register_nodes(AF_IP4); - } + if (!clib_bihash_is_initialised_8_16 (&im->tun4_protect_by_key)) + clib_bihash_init_8_16 (&im->tun4_protect_by_key, + "IPSec IPv4 tunnels", + IPSEC_TUN_DEFAULT_HASH_NUM_BUCKETS, + IPSEC_TUN_DEFAULT_HASH_MEMORY_SIZE); + + clib_bihash_add_del_8_16 (&im->tun4_protect_by_key, bkey, 1); + ipsec_tun_register_nodes (AF_IP4); + } else { ipsec6_tunnel_kv_t key = { @@ -283,14 +283,14 @@ ipsec_tun_protect_rx_db_add (ipsec_main_t * im, }; clib_bihash_kv_24_16_t *bkey = (clib_bihash_kv_24_16_t*)&key; - if (!im->tun4_protect_by_key.nbuckets) - clib_bihash_init_24_16 (&im->tun6_protect_by_key, - "IPSec IPv6 tunnels", - IPSEC_TUN_DEFAULT_HASH_NUM_BUCKETS, - IPSEC_TUN_DEFAULT_HASH_MEMORY_SIZE); - clib_bihash_add_del_24_16 (&im->tun6_protect_by_key, bkey, 1); - ipsec_tun_register_nodes(AF_IP6); - } + if (!clib_bihash_is_initialised_24_16 (&im->tun6_protect_by_key)) + clib_bihash_init_24_16 (&im->tun6_protect_by_key, + "IPSec IPv6 tunnels", + IPSEC_TUN_DEFAULT_HASH_NUM_BUCKETS, + IPSEC_TUN_DEFAULT_HASH_MEMORY_SIZE); + clib_bihash_add_del_24_16 (&im->tun6_protect_by_key, bkey, 1); + ipsec_tun_register_nodes (AF_IP6); + } })) /* *INDENT-ON* */ }