summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-10-11 11:31:43 -0400
committerDave Barach <openvpp@barachs.net>2019-10-11 15:45:39 +0000
commit47a2a705d0f33c0da0be1e4c0cb59b2286c3306f (patch)
tree4344e7750ca6659a4166a373abad9742e503fe29 /src/vnet
parent23afd57095dd279255de4679b0533d3d588f0e74 (diff)
lisp: fix dangling references to bihash tables
gid_ip4_table_t's and gid_ip6_table_t's are allocated from pools. They MUST NOT be listed on the clib_all_bihash list to avoid dangling references. Switch to the clib_bihash_init2 API, which has the required knob. Type: fix Ticket: VPP-1788 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I49a17e937922c3af2e1c46b24e20883af51584a8
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/lisp-cp/gid_dictionary.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/vnet/lisp-cp/gid_dictionary.c b/src/vnet/lisp-cp/gid_dictionary.c
index 2d8fbc80404..b2060a62c8e 100644
--- a/src/vnet/lisp-cp/gid_dictionary.c
+++ b/src/vnet/lisp-cp/gid_dictionary.c
@@ -555,6 +555,7 @@ add_del_ip4_key (gid_ip4_table_t * db, u32 vni, ip_prefix_t * pref, u32 val,
static void
ip4_lookup_init (gid_ip4_table_t * db)
{
+ BVT (clib_bihash_init2_args) _a, *a = &_a;
uword i;
clib_memset (db->ip4_prefix_len_refcount, 0,
@@ -579,9 +580,18 @@ ip4_lookup_init (gid_ip4_table_t * db)
if (db->ip4_lookup_table_size == 0)
db->ip4_lookup_table_size = IP4_LOOKUP_DEFAULT_HASH_MEMORY_SIZE;
- BV (clib_bihash_init) (&db->ip4_lookup_table, "ip4 lookup table",
- db->ip4_lookup_table_nbuckets,
- db->ip4_lookup_table_size);
+ /*
+ * Danger Will Robinson, Danger! gid_ip4_table_t's are allocated from
+ * a pool. They MUST NOT be listed on the clib_all_bihashes list...
+ */
+ memset (a, 0, sizeof (*a));
+ a->h = &db->ip4_lookup_table;
+ a->name = "LISP ip4 lookup table";
+ a->nbuckets = db->ip4_lookup_table_nbuckets;
+ a->memory_size = db->ip4_lookup_table_size;
+ a->dont_add_to_all_bihash_list = 1; /* See comment above */
+
+ BV (clib_bihash_init2) (a);
}
static u32
@@ -754,6 +764,7 @@ static void
ip6_lookup_init (gid_ip6_table_t * db)
{
uword i;
+ BVT (clib_bihash_init2_args) _a, *a = &_a;
clib_memset (db->ip6_prefix_len_refcount, 0,
sizeof (db->ip6_prefix_len_refcount));
@@ -782,9 +793,18 @@ ip6_lookup_init (gid_ip6_table_t * db)
if (db->ip6_lookup_table_size == 0)
db->ip6_lookup_table_size = IP6_LOOKUP_DEFAULT_HASH_MEMORY_SIZE;
- BV (clib_bihash_init) (&db->ip6_lookup_table, "ip6 lookup table",
- db->ip6_lookup_table_nbuckets,
- db->ip6_lookup_table_size);
+ /*
+ * Danger Will Robinson, Danger! gid_ip6_table_t's are allocated from
+ * a pool. They MUST NOT be listed on the clib_all_bihashes list...
+ */
+ memset (a, 0, sizeof (*a));
+ a->h = &db->ip6_lookup_table;
+ a->name = "LISP ip6 lookup table";
+ a->nbuckets = db->ip6_lookup_table_nbuckets;
+ a->memory_size = db->ip6_lookup_table_size;
+ a->dont_add_to_all_bihash_list = 1; /* See comment above */
+
+ BV (clib_bihash_init2) (a);
}
static u32