diff options
-rwxr-xr-x | src/plugins/nat/nat.c | 10 | ||||
-rw-r--r-- | src/vppinfra/bihash_template.c | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/nat/nat.c b/src/plugins/nat/nat.c index 8ba276bc9b4..30238f9d62f 100755 --- a/src/plugins/nat/nat.c +++ b/src/plugins/nat/nat.c @@ -330,8 +330,9 @@ nat_free_session_data (snat_main_t * sm, snat_session_t * s, u32 thread_index, bihash_key.k.src_address = s->out2in.addr.as_u32; bihash_key.k.src_port = s->out2in.port; bihash_key.k.protocol = s->out2in.protocol; - clib_bihash_add_del_16_8 (&sm->ed_ext_ports, &bihash_key.kv, - 0 /* is_add */ ); + if (sm->ed_ext_ports.instantiated) + clib_bihash_add_del_16_8 (&sm->ed_ext_ports, &bihash_key.kv, + 0 /* is_add */ ); snat_free_outside_address_and_port (sm->addresses, thread_index, &s->out2in); @@ -465,8 +466,9 @@ nat44_free_session_data (snat_main_t * sm, snat_session_t * s, bihash_key.k.src_address = s->out2in.addr.as_u32; bihash_key.k.src_port = s->out2in.port; bihash_key.k.protocol = s->out2in.protocol; - clib_bihash_add_del_16_8 (&sm->ed_ext_ports, &bihash_key.kv, - 0 /* is_add */ ); + if (sm->ed_ext_ports.instantiated) + clib_bihash_add_del_16_8 (&sm->ed_ext_ports, &bihash_key.kv, + 0 /* is_add */ ); // should be called for every dynamic session snat_free_outside_address_and_port (sm->addresses, thread_index, diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c index f7d88073418..47e9bd0113d 100644 --- a/src/vppinfra/bihash_template.c +++ b/src/vppinfra/bihash_template.c @@ -568,6 +568,9 @@ static_always_inline int BV (clib_bihash_add_del_inline_with_hash) BV (clib_bihash_instantiate) (h); BV (clib_bihash_alloc_unlock) (h); } +#else + /* Debug image: make sure the table has been instantiated */ + ASSERT (h->instantiated != 0); #endif b = BV (clib_bihash_get_bucket) (h, hash); |