Generator: Don't rewrite non-6-byte fixed-size 1x: types to PhysAddress48#1648
Merged
Merged
Conversation
Fixed-size octet string types other than 6 bytes were rewritten to PhysAddress48, which parses exactly 6 index bytes and misaligns any subsequent indexes. Signed-off-by: lukeod <l.odonnell11@gmail.com>
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.
The generator rewrites any node with DISPLAY-HINT
1x:toPhysAddress48, and the collector'sPhysAddress48branch always consumes exactly 6 bytes. When the underlying textual convention is a fixed-size octet string of another length, the index is parsed at the wrong length and every index after it at the wrong offset. For example,ELTEX-LTP8X::ONTSerial(OCTET STRING (SIZE (8)), hint1x:) is used as a table index: only 6 of its 8 bytes are consumed, and the remaining 2 corrupt whatever index follows. Values are affected too, rendering only their first 6 bytes.This change gates the rewrite on the parsed fixed size: nodes are rewritten only when the size is 6 or unknown. Keeping size-unknown nodes is deliberate - some MAC conventions have no single fixed size for net-snmp to report, e.g.
MacAddressNCfrom RFC 2024 (OCTET STRING (SIZE (0 | 6)), same hint), and dropping those would change existing generated configs for actual MAC addresses.Affected nodes now stay
OctetString: indexes align correctly, and rendering becomes hex (0x...) instead of a mis-sized MAC-style string.Out of scope:
1x:conventions whose size net-snmp doesn't report at the TC level (genuinely variable-size ones likeLldpV2ManAddress, or sizes refined on the OBJECT-TYPE rather than the TC) still get rewritten and mis-parse when longer than 6 bytes. Those can't be told apart here from MAC conventions whose size simply isn't reported.This is part of a series of PRs preparing for generator integration of
display_hinton indexes (#1610, alongside #1646). Once the rewrite no longer captures non-6-byte conventions, those indexes stayOctetString, where the collector can apply the MIB's DISPLAY-HINT and render them as formatted strings rather than raw hex.