Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DHCPv6 options serialization to prevent extra bytes in replies #626

Closed
wants to merge 1 commit into from

Conversation

afritzler
Copy link
Member

Proposed Changes

In the generate_reply_options function, fixed an issue where DHCPv6 reply packets contained extra unintended bytes at the end. The problem was due to the options pointer not being incremented after copying the opt_rapid and boot_file_url options into the packet buffer.

Changes made:

  • After copying opt_rapid, the options pointer is now incremented by reply_options.opt_rapid_len.
  • After copying boot_file_url, the options pointer is now incremented by reply_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 options pointer, 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.

@afritzler afritzler requested a review from a team as a code owner December 4, 2024 13:38
@github-actions github-actions bot added size/L bug Something isn't working labels Dec 4, 2024
@afritzler afritzler requested review from guvenc and removed request for a team December 4, 2024 13:39
@github-actions github-actions bot added size/M and removed size/L labels Dec 4, 2024
@afritzler afritzler force-pushed the fix/dhcp-reply branch 2 times, most recently from da08e07 to 79bd842 Compare December 4, 2024 14:09
@github-actions github-actions bot added size/L and removed size/M labels Dec 4, 2024
@github-actions github-actions bot added size/XS and removed size/L labels Dec 4, 2024
In the `generate_reply_options` function, fixed an issue where DHCPv6 reply packets contained extra unintended bytes at the end. The problem was due to the `options` pointer not being incremented after copying the `opt_rapid` and `boot_file_url` options into the packet buffer.

Changes made:

- After copying `opt_rapid`, the `options` pointer is now incremented by `reply_options.opt_rapid_len`.
- After copying `boot_file_url`, the `options` pointer is now incremented by `reply_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 `options` pointer, 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.
@guvenc
Copy link
Collaborator

guvenc commented Dec 4, 2024

Has the same content as #627

@afritzler
Copy link
Member Author

Fixed with #627

@afritzler afritzler closed this Dec 4, 2024
@afritzler afritzler deleted the fix/dhcp-reply branch December 4, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants