Repository navigation
fix(ospf): rebuild cryptographic authentication from its dict form (#1464) - #1469
Merged
Merged
Conversation
…1464) to_dict() flattens the AuType 2 auth field, a CryptographicAuthentication info, into a plain dict, and from_dict() cannot restore it because the field is declared bytes | CryptographicAuthentication. _make_encrypt_auth now accepts that dict (reserved defaulting to zero, a missing key refused with ProtocolError), so OSPF.from_data(info.to_dict()) rebuilds byte for byte for every AuType.
Owner
Author
|
Verdict: GOOD TO GO at
Nit, no change needed. A wrong value type in the dict, such as |
Contributor
|
Coverage: 89.56% (unit tier, Python 3.14,
Per-file detail: the |
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 (
make pylint,make mypy,make isort): ran mypy and isort onospf.pyonly; no new findings, pylint not runmake testpasses, and a test case covers the change: ran the modules listed belowChangelog entry: N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657
fix: corrects a defectCloses #1464
to_dict()flattens the AuType 2authfield (aCryptographicAuthenticationinfo) into a plain dict.from_dict()cannot restore it, because the field is declaredbytes | CryptographicAuthentication._make_encrypt_authnow accepts that dict. A missingreserveddefaults to zero, and any other missing key raisesProtocolError.ProtocolError: invalid type for auth_data→ exactSweep: the dict-form rebuild of every edge-harness case and every option-generator case is exact. Only OSPF has a top-level nested info that
from_dictleaves as a dict. HIPHostIDParameter.hiandLocator.locatorare typed the same way, but they sit inside the parameter list, whichto_dictdoes not flatten, sofrom_datanever hands them a dict.Tests: the new module passes 6 tests and 16 subtests; without the fix, 3 tests and 3 subtests fail. Also passing: the
protocols --exclude protocols/internetleg (1158 tests, OK),test_capture_roundtrip_runtime.py(4 passed), the four*_edge_roundtrip_unit.pymodules, andtests/project(419 passed, 1 skipped).