DHCPv4 options as list - #587
Open
scufre wants to merge 2 commits into
Open
Conversation
added 2 commits
August 12, 2026 18:56
… padding between options.
Collaborator
|
Initially the DHCPv4 library used to have a list of option but after @hugelgupf refactor it is now a map. This fits what the RFC specifies. I am not a great fan of changing the library behaviour to make non RFC compliant clients work. |
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.
Changing to store DHCPv4 options as a list instead of map and allow inserting padding options.
This is to workaround this issue https://binaryfury.wann.net/2024/12/pxe-two-tftp-filenames-one-dhcp-offer-plus-weird-filenames/ where old hardware treats the boot filename option as a null terminated string instead of relying on the option length.
To do so, the
Optionstype was changed to be a struct with a single field that is an array of a newly created struct (optionCodeValue) having the option code and option data. And then removed a couple of cases where padding options where filtered out.Some disclaimer on the decision to use a struct with a single field being the array of options: I'm new to go and did a try on directly declaring the
Optionstype as an array, but then couldn't find a way of declaring those methods that need to add or remove elements in the array as that in my understanding requires creating a new array.With these changes, now a the bootfile option can be provided and right after it, a padding option can be added, which will null terminate the string for those buggy clients.