Skip to content

Commit a01fc0d

Browse files
committed
fix(toolkit): pypcapfile TCP reads past VLAN tags, warns of tunnels, skips later fragments and padding (#1537, #1576, #1577)
pcapfile 0.12.0's Ethernet.payload_type decodes EtherType 0x0800 only, and _transport() read the IPv4 payload to the end of the frame whatever its fragment offset, so the engine's TCP disagreed with the default engine's. - _network() reads past 802.1Q and 802.1ad tags, stacked to any depth, and decodes the IPv4 behind them with pcapfile's own IP decoder; one that will not decode warns as an untagged one does, once per frame (#1537). - TCP over IPv6 behind tags gets #1535's warn-once; TCP tunnelled in IP (4in4, 6in4, 6in6, 4in6) gets one of its own rather than being read through, as the default engine keys such a flow by the outer addresses. Either fires only where the default engine's own dissection of the rebuilt frame finds the TCP (#1537). - A later IPv4 fragment is never read as a TCP header (#1576). - The TCP segment ends at the IPv4 Total Length, so Ethernet padding is no longer payload; 0 (TSO) keeps the rest of the frame (#1577). - Docs: the engines table and the toolkit note. Closes #1537 Closes #1576 Closes #1577
1 parent e9f3340 commit a01fc0d

5 files changed

Lines changed: 924 additions & 115 deletions

File tree

‎docs/source/pcapkit/foundation/engines/index.rst‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ offers, and the ones that cannot say so rather than quietly doing less:
9292
| :class:`~pcapkit.foundation.engines.pypcapfile.PyPCAPFile` | no IPv6 decoder, hence no IPv6 reassembly -- disabled with an |
9393
| | :class:`~pcapkit.utilities.warnings.AttributeWarning`, and |
9494
| | :func:`~pcapkit.toolkit.pypcapfile.ipv6_reassembly` raises; |
95-
| | TCP over IPv6 is left out of TCP reassembly and flow tracing, |
96-
| | with an :class:`~pcapkit.utilities.warnings.AttributeWarning` |
97-
| | once per capture; PCAP savefiles only, otherwise |
95+
| | TCP over IPv6, and TCP tunnelled in IP (e.g. 6in4, 4in4), are |
96+
| | left out of TCP reassembly and flow tracing, each with an |
97+
| | :class:`~pcapkit.utilities.warnings.AttributeWarning` once |
98+
| | per capture; IPv4 behind 802.1Q/802.1ad VLAN tags is read as |
99+
| | it is untagged; PCAP savefiles only, otherwise |
98100
| | :exc:`~pcapkit.utilities.exceptions.FormatError` |
99101
+-----------------------------------------------------------------+---------------------------------------------------------------+
100102
| :class:`~pcapkit.foundation.engines.dpkt.DPKT`, | no PCAP output, since each frame reaches the writer as a |

‎docs/source/pcapkit/toolkit/3rdparty.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ cannot be used for it.
184184
:data:`None` -- which would be indistinguishable from "this frame carries no
185185
IPv6 fragment".
186186

187+
Nor does it decode a VLAN tag or a tunnel. The adapters read an IPv4 packet
188+
behind 802.1Q and 802.1ad tags as `PyPCAPFile`_ reads an untagged one, while
189+
TCP over IPv6 and TCP tunnelled in IP (e.g. 6in4, 4in4, 6in6) are left out of
190+
:func:`~pcapkit.toolkit.pypcapfile.tcp_reassembly` and
191+
:func:`~pcapkit.toolkit.pypcapfile.tcp_traceflow`, with an
192+
:class:`~pcapkit.utilities.warnings.AttributeWarning` once per capture for each.
193+
187194
.. autofunction:: pcapkit.toolkit.pypcapfile.ipv4_reassembly
188195

189196
.. autofunction:: pcapkit.toolkit.pypcapfile.ipv6_reassembly

0 commit comments

Comments
 (0)