Skip to content

Commit 92ecf2f

Browse files
authored
fix(internet)!: refuse or rebuild exactly an MH mobility option changed in one octet (#2684) (#2700)
- Option fields were read at their own widths whatever the length said, so a length they overran or fell short of read octets that were not the option's and rebuilt another. A mobility option, FID, ANI or LCMP sub-option, QoS attribute or CGA extension whose fields do not take its declared length is refused, and so is a target care-of address neither IPv4 nor IPv6, as BID's is. - A CGA public key takes the long form of a DER length, and a CGA parameter whose fixed fields or key run past its option is refused in the schema. - The IPv4 Address Acknowledgement, IPv4 Home Address Request and Reply, and Delegated MNP makers check a prefix length against its field width alone, so one past the address that the reader keeps no longer refuses to rebuild. - The Service Selection and MN-ID NAI makers count the octets the identifier packs as, rather than its text re-encoded or its characters. - The QoS option keeps the two reserved traffic-class bits as tc_reserved, a new required field of its data model, which a direct construction now has to pass: the breaking change. - Adds a one-octet mutation sweep over every registered mobility option. New tests fail on be83061 without the pcapkit/ change; MH and guard modules pass.
1 parent 6253a87 commit 92ecf2f

7 files changed

Lines changed: 603 additions & 69 deletions

File tree

‎docs/source/pcapkit/protocols/internet/mh.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ Auxiliary Functions
987987
.. autofunction:: pcapkit.protocols.schema.internet.mh.pad_opt_data_len
988988
.. autofunction:: pcapkit.protocols.schema.internet.mh.bid_address_selector
989989
.. autofunction:: pcapkit.protocols.schema.internet.mh.br_code_selector
990+
.. autofunction:: pcapkit.protocols.schema.internet.mh.cga_public_key_length
990991
.. autofunction:: pcapkit.protocols.schema.internet.mh.dmnp_prefix_selector
991992
.. autofunction:: pcapkit.protocols.schema.internet.mh.fb_code_selector
992993
.. autofunction:: pcapkit.protocols.schema.internet.mh.lma_address_selector

‎pcapkit/protocols/data/internet/mh.py‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,13 +2168,22 @@ def __init__(self, type: 'Enum_QoSAttribute', length: 'int', reserved: 'bytes',
21682168

21692169
@info_final
21702170
class QualityOfServiceOption(Option):
2171-
"""Data model for MH Quality-of-Service option."""
2171+
"""Data model for MH Quality-of-Service option.
2172+
2173+
.. versionchanged:: 1.6.0
2174+
2175+
New required field ``tc_reserved`` (:issue:`2684`).
2176+
2177+
"""
21722178

21732179
#: Service request identifier.
21742180
sr_id: 'int'
21752181
#: Differentiated services code point, the significant 6 bits of the traffic
21762182
#: class octet.
21772183
dscp: 'int'
2184+
#: The 2 reserved bits of the traffic class octet, after the code point, as
2185+
#: captured [:rfc:`7222#section-4.1`].
2186+
tc_reserved: 'int'
21782187
#: Operational code -- ``0`` response, ``1`` allocate, ``2`` de-allocate,
21792188
#: ``3`` modify, ``4`` query, ``5`` negotiate.
21802189
oc: 'int'
@@ -2185,7 +2194,7 @@ class QualityOfServiceOption(Option):
21852194

21862195
if TYPE_CHECKING:
21872196
def __init__(self, type: 'Enum_Option', length: 'int', sr_id: 'int', dscp: 'int',
2188-
oc: 'int',
2197+
tc_reserved: 'int', oc: 'int',
21892198
reserved: 'bytes', attributes: 'OrderedMultiDict[Enum_QoSAttribute, QoSAttribute]') -> 'None': ...
21902199

21912200

0 commit comments

Comments
 (0)