@@ -14,8 +14,8 @@ unavailable on a header parsed as part of an IPv6 chain. Each subclass guards
1414its own ``protocol `` the same way; this class's
1515:attr: `~pcapkit.protocols.internet.ipv6_ext.IPv6_Ext.protocol ` deliberately
1616does not. It also implements a
17- **generic ** extractor for IPv6 extension headers [*]_, standing in whenever a
18- header's own dedicated parser is unavailable or has failed . :rfc: `6564#section-4 `
17+ **generic ** extractor for IPv6 extension headers [*]_, for a header with no
18+ dedicated parser. :rfc: `6564#section-4 `
1919requires, with an RFC 2119 **MUST **, that any IPv6 extension header defined since
2020April 2012 carry the same first two octets:
2121
@@ -123,32 +123,25 @@ carry a ``next`` at all?) rather than on a list of codes.
123123Entry Paths
124124-----------
125125
126- This class is reached in these ways:
127-
128- 1. **An unrecognised protocol number. **
129- :attr: `~pcapkit.const.ipv6.extension_header.ExtensionHeader.Shim6 ` is a real
130- IANA extension header (:rfc: `5533 `) with no dedicated parser, so
131- :meth: `Internet._lookup_next_layer <pcapkit.protocols.protocol.Protocol._lookup_next_layer> `
132- would default it to plain :class: `~pcapkit.protocols.misc.raw.Raw `. That
133- has no ``next `` field, so the walk in
134- :meth: `IPv6._decode_next_layer <pcapkit.protocols.internet.ipv6.IPv6._decode_next_layer> ` would
135- crash on it (:issue: `891 `). This module registers this class for that code
136- instead, at the bottom of the module, so dispatch reaches a working generic
137- parser directly. The registration is global, shared by every
138- :class: `~pcapkit.protocols.internet.internet.Internet ` subclass, so
139- :meth: `~pcapkit.protocols.internet.ipv6_ext.IPv6_Ext.__post_init__ ` gates on ``version == 6 `` to
140- keep it from also activating for an IPv4 payload that carries protocol
141- number 140; see its docstring.
142- 2. **A recognised header whose own parser raises. ** ``HOPOPT ``,
143- ``IPv6-Route ``, ``IPv6-Opts ``, ``MH ``, ``HIP ``, ``IPv6-Frag `` and ``AH `` all
144- have dedicated classes. When one of *those * raises,
145- :func: `~pcapkit.corekit.decorators.beholder `
146- (:meth: `Protocol._import_next_layer <pcapkit.protocols.protocol.Protocol._import_next_layer> `)
147- would substitute plain :class: `~pcapkit.protocols.misc.raw.Raw `, which loses
148- ``next `` and crashes the walk as in path 1.
149- :meth: `IPv6._import_next_layer <pcapkit.protocols.internet.ipv6.IPv6._import_next_layer> ` catches
150- the failure itself, one layer in from ``beholder ``, and substitutes this
151- class: the bad header costs only itself, not the rest of the chain.
126+ This class is reached by direct dispatch only.
127+ :attr: `~pcapkit.const.ipv6.extension_header.ExtensionHeader.Shim6 ` is a real
128+ IANA extension header (:rfc: `5533 `) with no dedicated parser, so
129+ :meth: `Internet._lookup_next_layer <pcapkit.protocols.protocol.Protocol._lookup_next_layer> `
130+ would default it to plain :class: `~pcapkit.protocols.misc.raw.Raw `, whose
131+ missing ``next `` field would end the walk in
132+ :meth: `IPv6._decode_next_layer <pcapkit.protocols.internet.ipv6.IPv6._decode_next_layer> `
133+ there (:issue: `891 `). This module registers this class for that code instead,
134+ at the bottom of the module, so dispatch reaches a working generic parser
135+ directly. The registration is global, shared by every
136+ :class: `~pcapkit.protocols.internet.internet.Internet ` subclass, so
137+ :meth: `~pcapkit.protocols.internet.ipv6_ext.IPv6_Ext.__post_init__ ` gates on
138+ ``version == 6 `` to keep it from also activating for an IPv4 payload that
139+ carries protocol number 140; see its docstring.
140+
141+ A header with a dedicated class whose parser raises does not reach this class.
142+ :func: `~pcapkit.corekit.decorators.beholder ` makes it plain
143+ :class: `~pcapkit.protocols.misc.raw.Raw `, and the walk stops there, as
144+ :rfc: `8200#section-4 ` has a node discard such a packet (:issue: `2477 `).
152145
153146.. _ipv6-ext-overrun-guard :
154147
0 commit comments