Repository navigation
fix(link): ARP family rebuilds InARP/DRARP, any Ethernet hlen, and a ptype/plen mismatch - #1224
Merged
Merged
Conversation
Owner
Author
|
Cross-review verdict on
|
Contributor
|
Coverage: 88.91% (unit tier, Python 3.14,
Per-file detail: the |
…ptype/plen mismatch - InARP and DRARP pass schema=/data= on their class statements, so they use the ARP schema instead of falling back to Raw (#1204). - PAT_MAC_ADDR accepts any number of colon/dash-separated octets, so a parsed Ethernet header with hlen other than 6 (including 0) rebuilds through its explicit hlen; make() without hlen still requires a 6-octet MAC for htype Ethernet (#1205). - The protocol address is decoded as IPv4/IPv6 only when ptype and its length agree (4/16); otherwise it is kept as hex, and make() packs it as raw octets when plen disagrees with ptype (#1206). New tests/protocols/link/test_arp_roundtrip_unit.py covers ARP, InARP, RARP and DRARP; it fails without the fix. Closes #1204 Closes #1205 Closes #1206
JarryShaw
force-pushed
the
fix/arp-roundtrip-1204-1206
branch
from
October 7, 2026 17:48
b289532 to
cce4838
Compare
Owner
Author
|
Cross-review verdict on
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Searched for similar pull requests
Followed the coding style — ran pylint/mypy/isort on the two source files; isort clean, and pylint/mypy report only findings on unchanged lines (not
maketargets)make testpasses, and a test case covers the change — the modules listed below only, not the full suiteAdded a changelog entry — N/A, added centrally after the wave
fix— corrects a defectCloses #1204
Closes #1205
Closes #1206
InARP/DRARPnow passschema=Schema_ARP, data=Data_ARP.hlenis correct, andfrom_datarebuilds it through the parsedhlen.ptypeand its length agree (IPv4/4, IPv6/16). Otherwise it is kept as hex.make()packs it raw whenplendisagrees withptype.make()still requires exactly 6 octets when the hardware type is Ethernet (htype 1) and no explicithlenwas given.hlen, or the htype is not Ethernet, it accepts any octet count.spa/tpaunder a mismatchedptype/plenis now a hexstr, where before it was anIPv6Addressor a bareValueError.Probe (parse, then
from_data). Before: InARP/DRARPAttributeError: 'Raw' object has no attribute 'htype'; hlen 8/0ProtocolError: Invalid MAC address; v4+plen16FieldValueError ... 6 != 4; v4+plen5 bareValueError. After: all nine cases (ARP/RARP/InARP/DRARP) rebuild byte-exactly.Tests:
test_arp_roundtrip_unit.pygives8 passed, 85 subtests passed.12 failed.test_link_unit,test_arp_proto_addr_length_unit,test_arp_pcapng_hwaddr_octets_unit,test_rarp_unit,test_link_runtimeandtest_option_roundtrip_unitall pass.tests/projectgave389 passed, 1 skippedbefore this amend.run_unittest_leg.py protocols --exclude protocols/internetgives858 test(s), 0 failure(s), 0 error(s).