You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(internet): a whole IPv6 extension header rebuilt from its info gains next-layer keys and loses Shim6's protocol #2768
Describe the bug
An IPv6 extension header parsed whole with extension=True rebuilds from from_data(info) with next-layer keys (__next_type__, __next_name__, nopayload) that its parse never had. HOPOPT, IPv6-Opts, IPv6-Frag, AH, MH, HIP and IPv6_Ext all do this, standalone and as the __exthdr__ infos of IPv6. IPv6_Ext (Shim6) also loses protocol. The octets are exact, and a whole IPv6 rebuild is unaffected.
Expected behavior from_data(info).info == info (test-coverage.rst, Round-Trip Invariants).
Additional context from_data doesn't replay the parse's extension mode, as it already replays __short_read__. IPv6_Ext.read takes protocol only from the parse-only alias. The capture round-trip test compares .data only, which is why this went unnoticed. It is the uncut counterpart of #2761.
#2774 fixes the extension-mode keys for every header. Shim6's protocol needs a decision.
The gap:IPv6_Ext.read takes protocol from the parse-only alias keyword. The data model already holds the value (Data_IPv6_Ext.protocol), so _make_data can return 'alias': data.protocol. The construction-keyword check would then warn, because no signature declares alias.
(a) Add __keywords__ = frozenset({'alias'}) to IPv6_Ext. Measured in a scratch edit: the Shim6 rebuild is exact, with no warnings. Downside: subclasses inherit it, so HOPOPT(alias=3) is accepted and silently dropped.
(b) Add 'alias' to OUT_OF_BAND_KEYWORDS. This adds no new member, but every protocol would then accept alias at construction, and test_construction_keyword_check_unit pins that set.
(c) Declare alias on IPv6_Ext.__post_init__. This changes the signature and is inherited the same way as (a).
Recommendation: (a). It is scoped to the extension-header family, and the new member goes where protocol-member-order.rst places it. The Shim6 alias and in-IPv6 test cases are added once this is ruled.
Option (a), reconciled.IPv6_Ext declares __keywords__ = frozenset({'alias'}), and _make_data returns 'alias': data.protocol. A rebuilt Shim6 header then keeps its protocol, both standalone and inside IPv6, without a keyword warning. Subclasses inherit the keyword, so HOPOPT(alias=3) is accepted and has no effect. That was the accepted downside of (a).
The change goes into #2774 as a follow-up commit. The new member goes where protocol-member-order.rst places it. The Shim6 alias=140 and in-IPv6 cases join the #2768 test. #2774 will then close this issue.
Activity
JarryShaw commentedon Nov 4, 2026
#2774 fixes the extension-mode keys for every header. Shim6's
protocolneeds a decision.The gap:
IPv6_Ext.readtakesprotocolfrom the parse-onlyaliaskeyword. The data model already holds the value (Data_IPv6_Ext.protocol), so_make_datacan return'alias': data.protocol. The construction-keyword check would then warn, because no signature declaresalias.__keywords__ = frozenset({'alias'})toIPv6_Ext. Measured in a scratch edit: the Shim6 rebuild is exact, with no warnings. Downside: subclasses inherit it, soHOPOPT(alias=3)is accepted and silently dropped.'alias'toOUT_OF_BAND_KEYWORDS. This adds no new member, but every protocol would then acceptaliasat construction, andtest_construction_keyword_check_unitpins that set.aliasonIPv6_Ext.__post_init__. This changes the signature and is inherited the same way as (a).Recommendation: (a). It is scoped to the extension-header family, and the new member goes where
protocol-member-order.rstplaces it. The Shim6aliasand in-IPv6 test cases are added once this is ruled.JarryShaw commentedon Nov 4, 2026
take (a)
JarryShaw commentedon Nov 4, 2026
Option (a), reconciled.
IPv6_Extdeclares__keywords__ = frozenset({'alias'}), and_make_datareturns'alias': data.protocol. A rebuilt Shim6 header then keeps itsprotocol, both standalone and inside IPv6, without a keyword warning. Subclasses inherit the keyword, soHOPOPT(alias=3)is accepted and has no effect. That was the accepted downside of (a).The change goes into #2774 as a follow-up commit. The new member goes where
protocol-member-order.rstplaces it. The Shim6alias=140and in-IPv6 cases join the #2768 test. #2774 will then close this issue.fix(internet): keep a rebuilt Shim6 header's protocol through the ali…
fix(internet): rebuild a whole extension header in the extension mode…