diff options
author | Klement Sekera <ksekera@cisco.com> | 2018-12-13 14:35:48 +0100 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-12-13 14:42:50 +0000 |
commit | 400f6d8c1ba8b6a22fff434091cb1191f17889c7 (patch) | |
tree | f376f89433b265217cf03b82a272d39e1d95de0a | |
parent | 14d7e90788f87a4b7b174bb5a67171f8c9a7f842 (diff) |
reassembly: fix internal buffer count accounting
Change-Id: I6af2c8552aeafe0abc8b8c3e5af1a05640e95919
Signed-off-by: Klement Sekera <ksekera@cisco.com>
-rw-r--r-- | src/vnet/ip/ip4_reassembly.c | 3 | ||||
-rw-r--r-- | test/test_reassembly.py | 31 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/vnet/ip/ip4_reassembly.c b/src/vnet/ip/ip4_reassembly.c index 9bcc20a2285..346b223416e 100644 --- a/src/vnet/ip/ip4_reassembly.c +++ b/src/vnet/ip/ip4_reassembly.c @@ -504,7 +504,10 @@ ip4_reass_finalize (vlib_main_t * vm, vlib_node_runtime_t * node, ip->flags_and_fragment_offset = 0; ip->length = clib_host_to_net_u16 (first_b->current_length + total_length); ip->checksum = ip4_header_checksum (ip); + u32 before = vec_len (*vec_drop_compress); vlib_buffer_chain_compress (vm, first_b, vec_drop_compress); + rt->buffers_n += vec_len (*vec_drop_compress) - before; + if (PREDICT_FALSE (first_b->flags & VLIB_BUFFER_IS_TRACED)) { ip4_reass_add_trace (vm, node, rm, reass, reass->first_bi, FINALIZE, 0); diff --git a/test/test_reassembly.py b/test/test_reassembly.py index 65a5eb0914d..1fa05a4efb6 100644 --- a/test/test_reassembly.py +++ b/test/test_reassembly.py @@ -203,6 +203,37 @@ class TestIPv4Reassembly(VppTestCase): self.assert_packet_counter_equal( "/err/ip4-reassembly-feature/malformed packets", 1) + def test_44924(self): + """ compress tiny fragments """ + packets = [(Ether(dst=self.src_if.local_mac, + src=self.src_if.remote_mac) / + IP(id=24339, flags="MF", frag=0, ttl=64, + src=self.src_if.remote_ip4, + dst=self.dst_if.remote_ip4) / + ICMP(type="echo-request", code=0, id=0x1fe6, seq=0x2407) / + Raw(load='Test-group: IPv4')), + (Ether(dst=self.src_if.local_mac, + src=self.src_if.remote_mac) / + IP(id=24339, flags="MF", frag=3, ttl=64, + src=self.src_if.remote_ip4, + dst=self.dst_if.remote_ip4) / + ICMP(type="echo-request", code=0, id=0x1fe6, seq=0x2407) / + Raw(load='.IPv4.Fragmentation.vali')), + (Ether(dst=self.src_if.local_mac, + src=self.src_if.remote_mac) / + IP(id=24339, frag=6, ttl=64, + src=self.src_if.remote_ip4, + dst=self.dst_if.remote_ip4) / + ICMP(type="echo-request", code=0, id=0x1fe6, seq=0x2407) / + Raw(load='d; Test-case: 44924')) + ] + + self.pg_enable_capture() + self.src_if.add_stream(packets) + self.pg_start() + + self.dst_if.get_capture(1) + @unittest.skipIf(is_skip_aarch64_set() and is_platform_aarch64(), "test doesn't work on aarch64") def test_random(self): |