Fix DHCPv6 options serialization to prevent extra bytes in replies #626
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.
Proposed Changes
In the
generate_reply_optionsfunction, fixed an issue where DHCPv6 reply packets contained extra unintended bytes at the end. The problem was due to theoptionspointer not being incremented after copying theopt_rapidandboot_file_urloptions into the packet buffer.Changes made:
opt_rapid, theoptionspointer is now incremented byreply_options.opt_rapid_len.boot_file_url, theoptionspointer is now incremented byreply_options.opt_boot_file_len.These changes ensure that all DHCPv6 options are correctly serialized in the packet buffer without overlaps or gaps. By properly advancing the
optionspointer, we prevent unintended data from being included at the end of the packet, eliminating the extra bytes that were being sent.This fix addresses the issue where clients were receiving malformed DHCPv6 packets due to the extra bytes, which could lead to communication errors or unexpected behavior.