aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2017-06-12 02:29:39 -0700
committerNeale Ranns <nranns@cisco.com>2017-06-12 12:12:52 +0000
commit89223f462337b8d9d190ab36f8651e40597463ba (patch)
tree26e97d135d953e4eba4823789f0ebe06d0226d52 /src/plugins
parent0fc6595addd3dde0883896ef15c6b783da64e3a0 (diff)
NAT64: bug fix
ICMP to ICMPv6 error message inner UDP packet translation delete ST entries when deleting static BIB entry Change-Id: I2a28631ac040e20827a692331506cd8254f70916 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/snat/nat64_db.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/plugins/snat/nat64_db.c b/src/plugins/snat/nat64_db.c
index d9989c96036..d15761d2109 100644
--- a/src/plugins/snat/nat64_db.c
+++ b/src/plugins/snat/nat64_db.c
@@ -107,6 +107,8 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
nat64_db_bib_entry_key_t bibe_key;
clib_bihash_kv_24_8_t kv;
nat64_db_bib_entry_t *bib;
+ u32 *ste_to_be_free = 0, *ste_index, bibe_index;
+ nat64_db_st_entry_t *st, *ste;
switch (bibe->proto)
{
@@ -114,6 +116,7 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
#define _(N, i, n, s) \
case SNAT_PROTOCOL_##N: \
bib = db->bib._##n##_bib; \
+ st = db->st._##n##_st; \
break;
foreach_snat_protocol
#undef _
@@ -123,6 +126,21 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
return;
}
+ bibe_index = bibe - bib;
+
+ /* delete ST entries for static BIB entry */
+ if (bibe->is_static)
+ {
+ pool_foreach (ste, st, (
+ {
+ if (ste->bibe_index == bibe_index)
+ vec_add1 (ste_to_be_free, ste - st);}
+ ));
+ vec_foreach (ste_index, ste_to_be_free)
+ nat64_db_st_entry_free (db, pool_elt_at_index (st, ste_index[0]));
+ vec_free (ste_to_be_free);
+ }
+
/* delete hash lookup */
bibe_key.addr.as_u64[0] = bibe->in_addr.as_u64[0];
bibe_key.addr.as_u64[1] = bibe->in_addr.as_u64[1];
@@ -146,6 +164,7 @@ nat64_db_bib_entry_free (nat64_db_t * db, nat64_db_bib_entry_t * bibe)
/* delete from pool */
pool_put (bib, bibe);
+
}
nat64_db_bib_entry_t *
@@ -480,7 +499,7 @@ nad64_db_st_free_expired (nat64_db_t * db, u32 now)
vec_add1 (ste_to_be_free, ste - st); \
})); \
vec_foreach (ste_index, ste_to_be_free) \
- pool_put_index (st, ste_index[0]); \
+ nat64_db_st_entry_free (db, pool_elt_at_index(st, ste_index[0])); \
vec_free (ste_to_be_free); \
ste_to_be_free = 0;
foreach_snat_protocol