Closed zer0-droids closed 1 year ago
Hello,
This pull request fixes the server id option (54) sent in the DHCP request message. It is related to Issue #249.
Thanks!
Thanks @newAM for the review and merge. Yes please, a release with the fix would be nice!
Done! v0.6.0 contains the fix.
Currently, the server identifier added in the REQUEST message corresponds to the siaddr retrieved in the OFFER. This is probably correct in some situations, but I noticed this does not work in my case: the REQUEST is NACK'ed by the server.
The DHCP server of my Internet box sends an OFFER containing 0.0.0.0 as next server IP, and its address (192.168.1.254) in the DHCP server identifier option (54).
From RFC2131, the next server IP (siaddr) is indeed not supposed to be used like this:
Additionally, in dhclient sources (see the 2nd link), we can see that next_srv_addr (filled from siaddr) is just passed to the script. On the other hand, the server identifier option is added in the REQUEST if it was present in the OFFER.
This patch tries to imitate this behavior: if the option was present in the OFFER, it will be added in the REQUEST.
Fixes: 3cb6a20f8556 ("DHCP: add ServerId in REQUEST message") Link: https://www.rfc-editor.org/rfc/rfc2131.txt Link: https://github.com/isc-projects/dhcp/blob/master/client/dhclient.c