Repository navigation
fix(ipv4)!: TS and SEC options do not rebuild byte for byte (#1391, #1392, #1393) - #1399
Merged
Merged
Conversation
…1392, #1393) - TS: convert a timedelta to milliseconds with `td // timedelta(milliseconds=1)` instead of flooring the inexact `total_seconds() * 1000`, which lost 1 ms on ~1% of stamps (all four make() paths). - TS: the 1-3 octets after the last whole slot are now the `remainder` BytesField, kept as read, and a new `remainder` data field carried by make(); it was a zero-packing PaddingField. - SEC: the per-octet field termination indicators are now the new `termination` data field and are written back on rebuild when they cover every octet; otherwise they are set from position as before. The non-conforming-indicator warning stays. Closes #1391 Closes #1392 Closes #1393
Owner
Author
|
Cross-review verdict on
Follow-ups:
|
Contributor
|
Coverage: 89.43% (unit tier, Python 3.14,
Per-file detail: the |
This was referenced Oct 8, 2026
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.
make pylint,make mypy,make isort) —mypyclean on the 3 source files,isortclean on the new test;pylintnot runmake testpasses, and a test case covers the change — scoped: legprotocols/internet,test_option_roundtrip_unit.py,tests/projectWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1391
Closes #1392
Closes #1393
_make_opt_tsfloored the inexacttotal_seconds() * 1000; all four paths now usetd // timedelta(milliseconds=1).TSOption.remainderchanges from a zero-packingPaddingFieldto aBytesField(defaultb'')._read_opt_secrecords each octet's indicator._make_opt_secwrites them back when they cover every octet, and sets them by position otherwise. The warning stays.Breaking: data
TSOptiongains a requiredremainder: bytes, and dataSECOptiongains a requiredtermination: tuple[bool, ...].Before → after, from
from_data:44080900 000003e9→…3e8/ exact;440b0900 00000005 aabbcc→…000000/ exact;8204ab91→8204ab90/ exact.Tests: new
test_ipv4_ts_sec_roundtrip_unit.pyhas 5 tests and 18 subtests. With the 3 source files fromorigin/main, every test fails. With one fix undone at a time, only that issue's cases fail (11 for #1391, 4 for #1392, 3 for #1393).test_ipv4_unit.pyadds the new fields in 4 direct constructions. Results: legprotocols/internet557 tests, 0 failures; round-trip module 6 passed / 362 subtests;tests/project399 passed, 1 skipped.