aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-02-08 09:53:10 +0000
committerMatthew Smith <mgsmith@netgate.com>2021-02-08 16:10:25 +0000
commit0ebbbfc3c50361dbe8556f14f152613689448812 (patch)
treec7cb4925562e0a4325e7553c4a87b5a10aaf2c1d /src/vnet
parentc8eae8d28aa6c9fb946a8be5b1731e0e79d7cdff (diff)
ipsec: Checking wrong DB for initialistation
Type: fix Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I2325d311a6fd7343c7041dc516777f4db0029823
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ipsec/ipsec_tun.c34
1 files changed, 17 insertions, 17 deletions
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* */
}