dhcptest.options: Fix swapped formats for options 52 and 61 - #51
Open
feiglein74 wants to merge 1 commit into
Open
dhcptest.options: Fix swapped formats for options 52 and 61#51feiglein74 wants to merge 1 commit into
feiglein74 wants to merge 1 commit into
Conversation
The formats for "Option Overload" (52) and "Client-identifier" (61) were
assigned to each other's options.
RFC 2132 section 9.3 defines option 52 as having a length of exactly 1,
with legal values 1, 2 and 3, so it is a plain u8.
RFC 2132 section 9.14 defines option 61 as having a minimum length of 2,
laid out as a type octet followed by the identifier, which is exactly
what OptionFormat.clientIdentifier encodes.
As a result, neither option could be sent at all:
--option "52=3"
Error with parsing option: Expected '=' or ':' at position 4
--option "61=01:AA:BB:CC:DD:EE:FF"
Error with parsing option: Unexpected ':' when converting from type
string to type ubyte
Received packets were affected as well: option 61 threw "u8 must be 1
byte" and fell back to hex, while option 52 silently rendered a legal
value of 3 as "type=3, clientIdentifier=".
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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 formats for
Option Overload(52) andClient-identifier(61) appear to have been assigned to each other's options.RFC 2132
Section 9.3, Option Overload:
That is a plain
u8.Section 9.14, Client-identifier:
That is exactly what
OptionFormat.clientIdentifierencodes.Effect
Neither option could be sent:
Received packets were affected too. Option 61 threw and fell back to hex, and option 52 silently rendered a legal value of
3as meaningless but plausible-looking output:03type=3, clientIdentifier=301 AA BB CC DD EE FFu8 must be 1 byte, hex fallbacktype=1, clientIdentifier=AA BB CC DD EE FFAfter the change all three forms parse, including the RFC's hardware-type-0 case for non-hardware identifiers:
Tests
Two unittests added, following the style of the existing per-option tests.
dub testpasses with both LDC 1.42.0 and DMD 2.100.0 (the version pinned in CI).