From 755042dec0fcc733d456adc2a74042c529eff039 Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Wed, 1 Dec 2021 10:14:38 +0000 Subject: ip: reassembly: drop zero length fragments Zero length fragments are invalid and should be dropped. This patch adds that. Type: improvement Change-Id: Ic6466c39ca8bf376efe06bb3b7f5d7f1ae812866 Signed-off-by: Klement Sekera --- test/test_reassembly.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/test_reassembly.py') diff --git a/test/test_reassembly.py b/test/test_reassembly.py index bd622a94794..faec5f42c30 100644 --- a/test/test_reassembly.py +++ b/test/test_reassembly.py @@ -1392,6 +1392,15 @@ class TestIPv6Reassembly(VppTestCase): self.assertIn(ICMPv6ParamProblem, icmp) self.assert_equal(icmp[ICMPv6ParamProblem].code, 3, "ICMP code") + def test_truncated_fragment(self): + """ truncated fragment """ + pkt = (Ether(src=self.pg0.local_mac, dst=self.pg0.remote_mac) / + IPv6(src=self.pg0.remote_ip6, dst=self.pg0.local_ip6, + nh=44, plen=2) / + IPv6ExtHdrFragment(nh=6)) + + self.send_and_assert_no_replies(self.pg0, [pkt], self.pg0) + def test_invalid_frag_size(self): """ fragment size not a multiple of 8 """ p = (Ether(dst=self.src_if.local_mac, src=self.src_if.remote_mac) / @@ -1917,6 +1926,15 @@ class TestIPv6SVReassembly(VppTestCase): IPv6ExtHdrFragment(id=1)/ICMPv6EchoRequest()) rx = self.send_and_expect(self.src_if, [pkt], self.dst_if) + def test_truncated_fragment(self): + """ truncated fragment """ + pkt = (Ether(src=self.pg0.local_mac, dst=self.pg0.remote_mac) / + IPv6(src=self.pg0.remote_ip6, dst=self.pg0.local_ip6, + nh=44, plen=2) / + IPv6ExtHdrFragment(nh=6)) + + self.send_and_assert_no_replies(self.pg0, [pkt], self.pg0) + class TestIPv4ReassemblyLocalNode(VppTestCase): """ IPv4 Reassembly for packets coming to ip4-local node """ -- cgit 1.2.3-korg