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

set_chaddr: Fix the hardware setting #19

Merged
merged 1 commit into from Mar 8, 2022

Conversation

cathay4t
Copy link
Contributor

@cathay4t cathay4t commented Feb 20, 2022

Current set_chaddr() function expects a [u8;16] slice due to
requirement of copy_from_slice(). This cause the hlen been always
set to 16.

This patch fix it by allowing variable length of input u8 slice and set
hlen accordingly.

Tested in my person project with dnsmasq:

  • Before:
    DHCPREQUEST(eth1.ep) 192.0.2.32
    12:a9:63:e8:f0:b8:00:00:00:00:00:00:00:00:00:00

  • After:
    DHCPREQUEST(eth1.ep) 192.0.2.32 12:a9:63:e8:f0:b8

Current `set_chaddr()` function expects a `[u8;16]` slice due to
requirement of `copy_from_slice()`. This cause the `hlen` been always
set to 16.

This patch fix it by allowing variable length of input u8 slice and set
`hlen` accordingly.

Tested in my person project with dnsmasq:
 * Before:
   `DHCPREQUEST(eth1.ep) 192.0.2.32`
   `12:a9:63:e8:f0:b8:00:00:00:00:00:00:00:00:00:00`

 * After:
   `DHCPREQUEST(eth1.ep) 192.0.2.32 12:a9:63:e8:f0:b8`

Signed-off-by: Gris Ge <fge@redhat.com>
@leshow
Copy link
Collaborator

leshow commented Mar 8, 2022

Thanks for the PR! Sorry for the late response, I didn't get a notification.

@leshow leshow merged commit 0dda342 into bluecatengineering:master Mar 8, 2022
@cathay4t cathay4t deleted the fix_chaddr branch March 8, 2022 15:36
@cathay4t cathay4t restored the fix_chaddr branch March 8, 2022 15:37
@cathay4t cathay4t deleted the fix_chaddr branch March 21, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants