diff options
author | Klement Sekera <ksekera@cisco.com> | 2018-12-14 12:00:44 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2018-12-16 01:01:12 +0000 |
commit | 4ee633e84af18e9237554df2015a332749dc358a (patch) | |
tree | 2dc8ca1af04353d6bcb352527ad940312bea3423 /test | |
parent | ae8098350cb7b96f7495fa4d4180238064256e14 (diff) |
VPP-1523: harden reassembly
Change-Id: I00d7b38bd99e81e3921ce08cce50d613f11de36e
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/test_reassembly.py | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/test/test_reassembly.py b/test/test_reassembly.py index 1fa05a4efb6..96e00c6bb60 100644 --- a/test/test_reassembly.py +++ b/test/test_reassembly.py @@ -180,6 +180,7 @@ class TestIPv4Reassembly(VppTestCase): def test_5737(self): """ fragment length + ip header size > 65535 """ + self.vapi.cli("clear errors") raw = ('E\x00\x00\x88,\xf8\x1f\xfe@\x01\x98\x00\xc0\xa8\n-\xc0\xa8\n' '\x01\x08\x00\xf0J\xed\xcb\xf1\xf5Test-group: IPv4.IPv4.ipv4-' 'message.Ethernet-Payload.IPv4-Packet.IPv4-Header.Fragment-Of' @@ -200,8 +201,11 @@ class TestIPv4Reassembly(VppTestCase): self.pg_start() self.dst_if.get_capture(1) - self.assert_packet_counter_equal( - "/err/ip4-reassembly-feature/malformed packets", 1) + self.assert_packet_counter_equal("ip4-reassembly-feature", 1) + # TODO remove above, uncomment below once clearing of counters + # is supported + # self.assert_packet_counter_equal( + # "/err/ip4-reassembly-feature/malformed packets", 1) def test_44924(self): """ compress tiny fragments """ @@ -234,6 +238,42 @@ class TestIPv4Reassembly(VppTestCase): self.dst_if.get_capture(1) + def test_frag_1(self): + """ fragment of size 1 """ + self.vapi.cli("clear errors") + malformed_packets = [(Ether(dst=self.src_if.local_mac, + src=self.src_if.remote_mac) / + IP(id=7, len=21, flags="MF", frag=0, ttl=64, + src=self.src_if.remote_ip4, + dst=self.dst_if.remote_ip4) / + ICMP(type="echo-request")), + (Ether(dst=self.src_if.local_mac, + src=self.src_if.remote_mac) / + IP(id=7, len=21, frag=1, ttl=64, + src=self.src_if.remote_ip4, + dst=self.dst_if.remote_ip4) / + Raw(load='\x08')), + ] + + p = (Ether(dst=self.src_if.local_mac, src=self.src_if.remote_mac) / + IP(id=1000, src=self.src_if.remote_ip4, + dst=self.dst_if.remote_ip4) / + UDP(sport=1234, dport=5678) / + Raw("X" * 1000)) + valid_fragments = fragment_rfc791(p, 400) + + self.pg_enable_capture() + self.src_if.add_stream(malformed_packets + valid_fragments) + self.pg_start() + + self.dst_if.get_capture(1) + + self.assert_packet_counter_equal("ip4-reassembly-feature", 1) + # TODO remove above, uncomment below once clearing of counters + # is supported + # self.assert_packet_counter_equal( + # "/err/ip4-reassembly-feature/malformed packets", 1) + @unittest.skipIf(is_skip_aarch64_set() and is_platform_aarch64(), "test doesn't work on aarch64") def test_random(self): |