aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2022-03-22 08:10:16 -0400
committerJohn Thacker <johnthacker@gmail.com>2022-04-06 08:41:58 -0400
commitc2e1ee2e5706455b5ebd680102649810b1c4a714 (patch)
tree9244c60029f2087c7b5f318f4a256b959701f182 /test
parent444e3f230c78e9366abe874a0ca5e4e92d6fe94b (diff)
tcp: Rework out of order dissection to dissect sooner
Rework the out of order dissection to store the out of order segments and add them to reassemblies only after the gaps are filled. This allows reassembly of contiguous segments to be dissected when they can, instead of having to wait for all segment gaps to be filled. In cases where a segment has an erroneous later sequence number, this prevents reassembly from being completely halted. It is now guaranteed that when the subdissector is called that the segment from the current frame is either the first segment of the MSP or has bytes that were requested from the last call of the subdissector. This makes it easier to split MSPs in a later commit. MSPs now always have the first segment with the sequence number, so MSP_FLAGS_MISSING_FIRST_SEGMENT and first_frame_with_seq are obsolete and can be removed later. This fixes a long standing TODO in the out of order test in suite_dissection.py Dissection is more consistent between the first pass and later passes, though there is more to be done.
Diffstat (limited to 'test')
-rw-r--r--test/suite_dissection.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/test/suite_dissection.py b/test/suite_dissection.py
index 44c3d69c5a..a87642620d 100644
--- a/test/suite_dissection.py
+++ b/test/suite_dissection.py
@@ -570,11 +570,7 @@ class case_dissect_tcp(subprocesstest.SubprocessTestCase):
'-Y', 'http',
] + extraArgs)
self.assertEqual(self.countOutput('HTTP'), 5)
- # TODO PDU /1 (segments in frames 1, 2, 4) should be reassembled in
- # frame 4, but it is currently done in frame 6 because the current
- # implementation reassembles only contiguous segments and PDU /2 has
- # segments in frames 6, 3, 7.
- self.assertTrue(self.grepOutput(r'^\s*6\s.*PUT /1 HTTP/1.1'))
+ self.assertTrue(self.grepOutput(r'^\s*4\s.*PUT /1 HTTP/1.1'))
self.assertTrue(self.grepOutput(r'^\s*7\s.*GET /2 HTTP/1.1'))
self.assertTrue(self.grepOutput(r'^\s*10\s.*PUT /3 HTTP/1.1'))
self.assertTrue(self.grepOutput(r'^\s*11\s.*PUT /4 HTTP/1.1'))
@@ -596,8 +592,8 @@ class case_dissect_tcp(subprocesstest.SubprocessTestCase):
'-Y', 'http',
'-2',
))
- self.assertEqual(self.countOutput('HTTP'), 3)
- self.assertTrue(self.grepOutput(r'^\s*7\s.*PUT /1 HTTP/1.1'))
+ self.assertEqual(self.countOutput('HTTP'), 4)
+ self.assertTrue(self.grepOutput(r'^\s*4\s.*PUT /1 HTTP/1.1'))
self.assertTrue(self.grepOutput(r'^\s*7\s.*GET /2 HTTP/1.1'))
# TODO ideally this should not be concatenated.
# Normally a multi-segment PDU (MSP) covers only a single PDU, but OoO