summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat
diff options
context:
space:
mode:
authorahdj007 <dong.juan1@zte.com.cn>2018-03-08 10:02:17 +0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-14 18:44:27 +0000
commit648ae391b6725445b4bf57715b7917950dc29011 (patch)
treea736db88bd405da7e2f81a86f9a762aaf4e4903e /src/plugins/nat
parent651dc0c5eb0cf648b3f885f92ebe221669b51ed7 (diff)
when exceed max reass,
frag packet can't get reass. adding bihash,it can rewrite new hash value. so need to delete hash after compare hash value. Change-Id: I83b5c47890110e9a598b78cfbe8fcd27bbe291bb Signed-off-by: ahdj007 <dong.juan1@zte.com.cn> (cherry picked from commit 5e85c54d229e443d30dabe9bca39625587add8a5)
Diffstat (limited to 'src/plugins/nat')
-rwxr-xr-xsrc/plugins/nat/nat_reass.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/nat/nat_reass.c b/src/plugins/nat/nat_reass.c
index 2e804477b26..1b412de0b18 100755
--- a/src/plugins/nat/nat_reass.c
+++ b/src/plugins/nat/nat_reass.c
@@ -227,7 +227,7 @@ nat_ip4_reass_find_or_create (ip4_address_t src, ip4_address_t dst,
dlist_elt_t *oldest_elt, *elt;
dlist_elt_t *per_reass_list_head_elt;
u32 oldest_index, elt_index;
- clib_bihash_kv_16_8_t kv;
+ clib_bihash_kv_16_8_t kv, value;
k.src.as_u32 = src.as_u32;
k.dst.as_u32 = dst.as_u32;
@@ -272,12 +272,18 @@ nat_ip4_reass_find_or_create (ip4_address_t src, ip4_address_t dst,
clib_dlist_addtail (srm->ip4_reass_lru_list_pool,
srm->ip4_reass_head_index, oldest_index);
- kv.key[0] = k.as_u64[0];
- kv.key[1] = k.as_u64[1];
- if (clib_bihash_add_del_16_8 (&srm->ip4_reass_hash, &kv, 0))
+ kv.key[0] = reass->key.as_u64[0];
+ kv.key[1] = reass->key.as_u64[1];
+ if (!clib_bihash_search_16_8 (&srm->ip4_reass_hash, &kv, &value))
{
- reass = 0;
- goto unlock;
+ if (value.value == (reass - srm->ip4_reass_pool))
+ {
+ if (clib_bihash_add_del_16_8 (&srm->ip4_reass_hash, &kv, 0))
+ {
+ reass = 0;
+ goto unlock;
+ }
+ }
}
nat_ip4_reass_get_frags_inline (reass, bi_to_drop);