Skip to content

Commit 66317ed

Browse files
committed
fix(internet): correct post-rebase IGMPv3 verification failures
Full-suite verification after the IGMPv3 sibling-class rebase (previous two commits) found four real issues the squashed merge introduced or left unresolved: - `pcapkit/protocols/data/__init__.py` and `.../schema/__init__.py`: the top-level `__all__` lists still carried a duplicate `'IGMP'` entry plus the old single-class design's names (`IGMP_GroupAddressMessage`, `IGMP_GroupBody`, etc.), which no longer exist. Replaced with the sibling names (`IGMPv3`, `IGMPv3_Query`, `IGMPv3_Report`, `IGMPv3_GroupRecord`, and the schema equivalents). - `pcapkit/protocols/internet/igmpv3.py`: import block was isort-dirty under the project's actual `-l100 -ppcapkit` Makefile flags. - `tests/project/test_rfc_constants_one_home_1739_unit.py`: the new `_classify` literal `12` (IGMPv3's minimum extended-Query length) coincidentally matches `AH_HEADER_LEN`/`TCP_DATA_OFFSET_OCTET`/ `GENERIC_BLOCK_MINIMUM`; added an `UNRELATED` entry explaining why. - `tests/protocols/internet/test_igmp_unit.py`: `test_refusals_name_the_version_refused` used an 8-octet *Report* fixture to probe IGMPv3's rejection path, but a Report type isn't Query-shaped at all, so IGMPv3's schema selector refuses it with "unsupported message type" rather than the `read()`-level "is not an IGMPv3 message" message the test expected. Switched to an 8-octet *Query* fixture, which is the shape all three versions actually share. Verified: `tests/protocols/internet/test_igmp_unit.py` (66 tests, 231 subtests), `tests/const/` + `tests/vendor/` + `test_dispatch_registry_unit.py` (588 tests, 26811 subtests), `tests/corekit/test_schema_roundtrip_unit.py` + `tests/project/` (2137 passed, 80 skipped, 0 failed, 11528 subtests) all clean.
1 parent 0e3ed56 commit 66317ed

5 files changed

Lines changed: 17 additions & 8 deletions

File tree

‎pcapkit/protocols/data/__init__.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@
8080
# Encapsulating Security Payload
8181
'ESP',
8282

83-
# Internet Group Management Protocol
84-
'IGMP', 'IGMP_GroupAddressMessage', 'IGMP_GroupRecord', 'IGMP_Version3MembershipReport',
85-
8683
# Host Identity Protocol
8784
'HIP', 'HIP_Control',
8885
'HIP_LocatorData', 'HIP_Locator', 'HIP_HostIdentity', 'HIP_Lifetime', 'HIP_Flags',
@@ -148,7 +145,7 @@
148145
'IPv6_Route_UnknownType', 'IPv6_Route_SourceRoute', 'IPv6_Route_Type2', 'IPv6_Route_RPL',
149146

150147
# Internet Group Management Protocol
151-
'IGMP',
148+
'IGMP', 'IGMPv3', 'IGMPv3_Query', 'IGMPv3_Report', 'IGMPv3_GroupRecord',
152149

153150
# Internet Protocol version 6
154151
'IPv6',

‎pcapkit/protocols/internet/igmpv3.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454

5555
from pcapkit.const.igmp.record_type import RecordType as Enum_RecordType
5656
from pcapkit.const.igmp.type import Type as Enum_Type
57-
from pcapkit.protocols.data.internet.igmpv3 import GroupRecord as Data_GroupRecord
5857
from pcapkit.protocols.data.internet.igmpv3 import IGMP as Data_IGMP
58+
from pcapkit.protocols.data.internet.igmpv3 import GroupRecord as Data_GroupRecord
5959
from pcapkit.protocols.data.internet.igmpv3 import Query as Data_Query
6060
from pcapkit.protocols.data.internet.igmpv3 import Report as Data_Report
6161
from pcapkit.protocols.internet.igmp import IGMP as IGMPBase

‎pcapkit/protocols/schema/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
# Internet Layer Protocols
3636
'AH',
3737
'ESP',
38-
'IGMP', 'IGMP_GroupBody', 'IGMP_QueryExtension', 'IGMP_ReportBody', 'IGMP_GroupRecord',
3938
'HIP',
4039
'HIP_LocatorData', 'HIP_Locator', 'HIP_ECDSACurveHostIdentity', 'HIP_ECDSALowCurveHostIdentity',
4140
'HIP_EdDSACurveHostIdentity', 'HIP_HostIdentity',
@@ -85,7 +84,8 @@
8584
'IPv6_Route',
8685
'IPv6_Route_RoutingType',
8786
'IPv6_Route_UnknownType', 'IPv6_Route_SourceRoute', 'IPv6_Route_Type2', 'IPv6_Route_RPL',
88-
'IGMP',
87+
'IGMP', 'IGMPv3', 'IGMPv3_Query', 'IGMPv3_QueryExtension', 'IGMPv3_Report',
88+
'IGMPv3_GroupRecord',
8989
'IPv6',
9090
'IPX',
9191
'MH',

‎tests/project/test_rfc_constants_one_home_1739_unit.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,12 @@
374374
'pcapkit/protocols/internet/igmpv3.py': ((16,), "the floating-point Max Resp Code/QQIC "
375375
"decode's mantissa mask (RFC 3376 section 4.1.1's "
376376
"own 0x10), not the PCAP record header length"),
377+
'pcapkit/protocols/internet/igmp.py': ((12,), "the minimum overall length (RFC 3376 "
378+
"section 7.1) at which a Membership Query carries "
379+
"IGMPv3's source-list extension rather than being "
380+
"IGMPv1/v2; unrelated to AH_HEADER_LEN, "
381+
"TCP_DATA_OFFSET_OCTET or GENERIC_BLOCK_MINIMUM, "
382+
"which happen to share the value"),
377383
'pcapkit/protocols/internet/hip.py': ((6, 12, 16, 20, 32, 40, 65535),
378384
'HIP parameter fields and sizes; 65535 bounds the '
379385
'two-octet TLV Length a TRANSACTION_ID or OVERLAY_ID '

‎tests/protocols/internet/test_igmp_unit.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,18 @@ def test_refusals_name_the_version_refused(self) -> None:
332332
from pcapkit.utilities.exceptions import ProtocolError
333333

334334
v1_report, v2_report = IGMP_PACKETS['v1-report'][0], IGMP_PACKETS['v2-report'][0]
335+
v2_query = IGMP_PACKETS['v2-query-general'][0]
335336
with self.assertRaisesRegex(ProtocolError, r'^IGMPv1: .+ is not an IGMPv1 message \(8 octets\)'):
336337
IGMPv1(io.BytesIO(v2_report), len(v2_report))
337338
with self.assertRaisesRegex(ProtocolError, r'^IGMPv2: .+ is not an IGMPv2 message \(8 octets\)'):
338339
IGMPv2(io.BytesIO(v1_report), len(v1_report))
340+
# An 8-octet Query (the one shape IGMPv1/v2/v3 all share the type
341+
# value for) reaches the same ``read()``-level refusal; a Report or
342+
# Leave type is not even Query-shaped, so IGMPv3's schema selector
343+
# refuses it before ``read()`` -- see
344+
# ``test_igmpv3_rejects_an_8_octet_v1_or_v2_message``.
339345
with self.assertRaisesRegex(ProtocolError, r'^IGMPv3: .+ is not an IGMPv3 message \(8 octets\)'):
340-
IGMPv3(io.BytesIO(v1_report), len(v1_report))
346+
IGMPv3(io.BytesIO(v2_query), len(v2_query))
341347

342348
def test_membership_query_max_resp_time_zero_is_v1(self) -> None:
343349
from pcapkit.protocols.internet.igmpv1 import IGMP

0 commit comments

Comments
 (0)