|
3 | 3 |
|
4 | 4 | Both readers that build a |
5 | 5 | :class:`~pcapkit.protocols.data.misc.pcap.frame.Frame` have to agree about which |
6 | | -of the two wire fields lands in which attribute, and until GitHub issue #618 they |
7 | | -did not: the classic-PCAP reader in |
| 6 | +of the two wire fields lands in which attribute. GitHub issue #618 is the |
| 7 | +defect where they did not: the classic-PCAP reader in |
8 | 8 | :mod:`pcapkit.protocols.misc.pcap.frame` wrote ``len=incl_len, |
9 | 9 | cap_len=orig_len`` while :func:`pcapkit.toolkit.pcapng.block2frame` wrote |
10 | 10 | ``len=original_len, cap_len=captured_len``. Exactly inverted, so ``frame.len`` |
|
31 | 31 | been truncated", which "SHOULD NOT be less than the Captured Packet Length". So |
32 | 32 | neither format is the odd one out -- only the reader was. |
33 | 33 |
|
34 | | -Why it survived so long: **the two lengths are equal unless the snapshot length |
| 34 | +Why fixtures can miss it: **the two lengths are equal unless the snapshot length |
35 | 35 | cut the frame short**, so a fixture without a truncated frame compares a value |
36 | | -against itself and cannot tell the two assignments apart. There was no such |
37 | | -fixture here until #614 added one. This module therefore leans on the two that |
38 | | -exist, and asserts that they really are truncated before asserting anything |
39 | | -about them -- a fixture regenerated into something untruncated fails |
| 36 | +against itself and cannot tell the two assignments apart. This module therefore |
| 37 | +leans on the two truncated fixtures (#614), and asserts that they really are |
| 38 | +truncated before asserting anything about them -- a fixture regenerated into |
| 39 | +something untruncated fails |
40 | 40 | :meth:`PcapFrameLengthRuntimeTests.test_the_fixture_really_holds_a_truncated_frame` |
41 | 41 | loudly rather than making everything below vacuous: |
42 | 42 |
|
@@ -226,7 +226,7 @@ def test_the_fixture_really_holds_a_truncated_frame(self) -> None: |
226 | 226 | def test_len_is_the_on_wire_length_and_cap_len_the_captured_one(self) -> None: |
227 | 227 | """#618: the PCAP reader had these two the other way round. |
228 | 228 |
|
229 | | - On the unfixed tree the truncated frame comes back with ``len=96`` and |
| 229 | + Without the fix the truncated frame comes back with ``len=96`` and |
230 | 230 | ``cap_len=1200`` -- the captured length under the name that means |
231 | 231 | on-wire, and vice versa -- so this fails on that frame in every fixture |
232 | 232 | while passing on the two untruncated ones, which is exactly the shape of |
@@ -283,9 +283,9 @@ def test_cap_len_counts_the_octets_the_frame_actually_carries(self) -> None: |
283 | 283 | class PcapngFrameLengthRuntimeTests(unittest.TestCase): |
284 | 284 | """#618, on the PCAP-NG reader -- the one that was already right. |
285 | 285 |
|
286 | | - This is the control. It passes on the unfixed tree too, and that is what it |
287 | | - is for: it pins the convention the PCAP reader was brought into line with, so |
288 | | - a later change that "fixes" the disagreement from the other end fails here. |
| 286 | + This is the control. It passes without the fix too, and that is what it is |
| 287 | + for: it pins the convention the PCAP reader follows, so a change that |
| 288 | + "fixes" the disagreement from the other end fails here. |
289 | 289 |
|
290 | 290 | """ |
291 | 291 |
|
@@ -383,7 +383,7 @@ def setUp(self) -> None: |
383 | 383 | def test_a_truncated_frame_reads_alike_whichever_container_it_came_from(self) -> None: |
384 | 384 | """One caller, two capture formats, one meaning per attribute. |
385 | 385 |
|
386 | | - On the unfixed tree the PCAP side reports ``len < cap_len`` and the |
| 386 | + Without the fix the PCAP side reports ``len < cap_len`` and the |
387 | 387 | PCAP-NG side ``len > cap_len`` for the same kind of frame, and this fails |
388 | 388 | on the first assertion of the pair. |
389 | 389 |
|
@@ -411,7 +411,7 @@ def test_a_truncated_frame_reads_alike_whichever_container_it_came_from(self) -> |
411 | 411 | for frame in truncated: |
412 | 412 | with self.subTest(cap_len=frame.cap_len): |
413 | 413 | # the on-wire length is the larger of the two, in both formats. |
414 | | - # This is the assertion #618 breaks: before the fix the PCAP |
| 414 | + # This is the assertion #618 breaks: without the fix the PCAP |
415 | 415 | # frame reports 96 against 1200 and fails here, while the |
416 | 416 | # PCAP-NG one reports 314 against 32 and passes |
417 | 417 | self.assertGreater(frame.len, frame.cap_len) |
|
0 commit comments