ip: reassembly: LRU algorithm should eliminate the longest unused nodes
Type: fix
Signed-off-by: zhengdelun <xszhengdelun@gmail.com>
Change-Id: I3f6240b4c0798f85960acc55a193a0cbf0c67ea4
diff --git a/src/vnet/ip/reass/ip4_sv_reass.c b/src/vnet/ip/reass/ip4_sv_reass.c
index b41498e..e7effb8 100644
--- a/src/vnet/ip/reass/ip4_sv_reass.c
+++ b/src/vnet/ip/reass/ip4_sv_reass.c
@@ -331,7 +331,7 @@
if (rt->reass_n >= rm->max_reass_n && rm->max_reass_n)
{
- reass = pool_elt_at_index (rt->pool, rt->lru_last);
+ reass = pool_elt_at_index (rt->pool, rt->lru_first);
ip4_sv_reass_free (vm, rm, rt, reass);
}
diff --git a/src/vnet/ip/reass/ip6_sv_reass.c b/src/vnet/ip/reass/ip6_sv_reass.c
index 6d707af..7c13f4b 100644
--- a/src/vnet/ip/reass/ip6_sv_reass.c
+++ b/src/vnet/ip/reass/ip6_sv_reass.c
@@ -329,7 +329,7 @@
if (rt->reass_n >= rm->max_reass_n)
{
- reass = pool_elt_at_index (rt->pool, rt->lru_last);
+ reass = pool_elt_at_index (rt->pool, rt->lru_first);
ip6_sv_reass_free (vm, rm, rt, reass);
}