aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-02-19 13:53:43 +0100
committerOle Trøan <otroan@employees.org>2019-02-19 15:26:55 +0000
commitcae98b72c97e1ea95e06068ae9923a5f3a21938d (patch)
tree5f98ba3671625c5e32e51fc452f31ca30274217d
parent4e633e1043e867fd24badeb0405f794793beb9a9 (diff)
reassembly: fix buffer usage counter
Change-Id: I713904f8eb2f724cb08dba494c160c14cc8b24a1 Signed-off-by: Klement Sekera <ksekera@cisco.com>
-rw-r--r--src/vnet/ip/ip6_reassembly.c12
-rw-r--r--test/test_reassembly.py5
2 files changed, 12 insertions, 5 deletions
diff --git a/src/vnet/ip/ip6_reassembly.c b/src/vnet/ip/ip6_reassembly.c
index d78c3ff91bf..631556efec0 100644
--- a/src/vnet/ip/ip6_reassembly.c
+++ b/src/vnet/ip/ip6_reassembly.c
@@ -315,8 +315,8 @@ ip6_reass_drop_all (vlib_main_t * vm, ip6_reass_main_t * rm,
always_inline void
ip6_reass_on_timeout (vlib_main_t * vm, vlib_node_runtime_t * node,
- ip6_reass_main_t * rm, ip6_reass_t * reass,
- u32 * icmp_bi, u32 ** vec_timeout)
+ ip6_reass_main_t * rm, ip6_reass_per_thread_t * rt,
+ ip6_reass_t * reass, u32 * icmp_bi, u32 ** vec_timeout)
{
if (~0 == reass->first_bi)
{
@@ -342,6 +342,7 @@ ip6_reass_on_timeout (vlib_main_t * vm, vlib_node_runtime_t * node,
{
reass->first_bi = vnet_buffer (b)->ip.reass.next_range_bi;
}
+ --rt->buffers_n;
icmp6_error_set_vnet_buffer (b, ICMP6_time_exceeded,
ICMP6_time_exceeded_fragment_reassembly_time_exceeded,
0);
@@ -370,7 +371,8 @@ ip6_reass_find_or_create (vlib_main_t * vm, vlib_node_runtime_t * node,
reass = pool_elt_at_index (rt->pool, value.value);
if (now > reass->last_heard + rm->timeout)
{
- ip6_reass_on_timeout (vm, node, rm, reass, icmp_bi, vec_timeout);
+ ip6_reass_on_timeout (vm, node, rm, rt, reass, icmp_bi,
+ vec_timeout);
ip6_reass_free (rm, rt, reass);
reass = NULL;
}
@@ -580,6 +582,7 @@ ip6_reass_finalize (vlib_main_t * vm, vlib_node_runtime_t * node,
clib_host_to_net_u16 (total_length + first_b->current_length -
sizeof (*ip));
vlib_buffer_chain_compress (vm, first_b, vec_drop_compress);
+ rt->buffers_n -= buf_cnt - vec_len (*vec_drop_compress);
if (PREDICT_FALSE (first_b->flags & VLIB_BUFFER_IS_TRACED))
{
ip6_reass_add_trace (vm, node, rm, reass, reass->first_bi, FINALIZE, 0);
@@ -1345,13 +1348,12 @@ ip6_reass_walk_expired (vlib_main_t * vm,
b->flags &= ~VLIB_BUFFER_IS_TRACED;
}
}
- ip6_reass_on_timeout (vm, node, rm, reass, &icmp_bi, &vec_timeout);
+ ip6_reass_on_timeout (vm, node, rm, rt, reass, &icmp_bi, &vec_timeout);
u32 after = vec_len (vec_timeout);
rt->buffers_n -= (after - before);
if (~0 != icmp_bi)
{
vec_add1 (vec_icmp_bi, icmp_bi);
- --rt->buffers_n;
}
ip6_reass_free (rm, rt, reass);
}
diff --git a/test/test_reassembly.py b/test/test_reassembly.py
index 6c0513ee76d..7bca794c5c0 100644
--- a/test/test_reassembly.py
+++ b/test/test_reassembly.py
@@ -57,6 +57,7 @@ class TestIPv4Reassembly(VppTestCase):
def tearDown(self):
super(TestIPv4Reassembly, self).tearDown()
self.logger.debug(self.vapi.ppcli("show ip4-reassembly details"))
+ self.logger.debug(self.vapi.ppcli("show buffers"))
@classmethod
def create_stream(cls, packet_sizes, packet_count=test_packet_count):
@@ -486,10 +487,12 @@ class TestIPv6Reassembly(VppTestCase):
self.vapi.ip_reassembly_set(timeout_ms=1000000, max_reassemblies=1000,
expire_walk_interval_ms=10000, is_ip6=1)
self.logger.debug(self.vapi.ppcli("show ip6-reassembly details"))
+ self.logger.debug(self.vapi.ppcli("show buffers"))
def tearDown(self):
super(TestIPv6Reassembly, self).tearDown()
self.logger.debug(self.vapi.ppcli("show ip6-reassembly details"))
+ self.logger.debug(self.vapi.ppcli("show buffers"))
@classmethod
def create_stream(cls, packet_sizes, packet_count=test_packet_count):
@@ -881,6 +884,7 @@ class TestIPv4ReassemblyLocalNode(VppTestCase):
def tearDown(self):
super(TestIPv4ReassemblyLocalNode, self).tearDown()
self.logger.debug(self.vapi.ppcli("show ip4-reassembly details"))
+ self.logger.debug(self.vapi.ppcli("show buffers"))
@classmethod
def create_stream(cls, packet_count=test_packet_count):
@@ -1008,6 +1012,7 @@ class TestFIFReassembly(VppTestCase):
def tearDown(self):
self.logger.debug(self.vapi.ppcli("show ip4-reassembly details"))
self.logger.debug(self.vapi.ppcli("show ip6-reassembly details"))
+ self.logger.debug(self.vapi.ppcli("show buffers"))
super(TestFIFReassembly, self).tearDown()
def verify_capture(self, capture, ip_class, dropped_packet_indexes=[]):