-
Notifications
You must be signed in to change notification settings - Fork 112
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
Dhcpcd generating INIT-REBOOT messages during RENEWING/REBINDING when --noconfigure is on #355
Comments
When RENEWING/REBINDING, the DHCP client should send messages with ciaddr set and requested-ip unset. However when dhcpcd 10 is configured with --noconfigure, the messages sent are the opposite: ciaddr unset and requested-ip set - these messages are for INIT-REBOOT, not RENEWING or REBINDING. The reason for it is that when --noconfigure is enabled, dhcpcd won't setup the state->addr property of the interface when the lease is bound. When dhcpcd renews or rebinds the lease later, it needs state->addr to be set to correctly configure ciaddr and requested-ip. Since state->addr is NULL, dhcpcd sends wrong messages (for the detail see github.com/NetworkConfiguration/issues/355). This patch fixes this by also setting up state->addr with ipv4_applyaddr() when --noconfigure is enabled. Note that this function also configure the IPv4 address and build routes in the system, so we need to disable these in the function. Change-Id: I94bfffd95b62066995bd436d3b8bf185eafda398
When RENEWING/REBINDING, the DHCP client should send messages with ciaddr set and requested-ip unset. However when dhcpcd 10 is configured with --noconfigure, the messages sent are the opposite: ciaddr unset and requested-ip set - these messages are for INIT-REBOOT, not RENEWING or REBINDING. The reason for it is that when --noconfigure is enabled, dhcpcd won't setup the state->addr property of the interface when the lease is bound. When dhcpcd renews or rebinds the lease later, it needs state->addr to be set to correctly configure ciaddr and requested-ip. Since state->addr is NULL, dhcpcd sends wrong messages (for the detail see github.com/NetworkConfiguration/issues/355). This patch fixes this by also setting up state->addr with ipv4_applyaddr() when --noconfigure is enabled. Note that this function also configure the IPv4 address and build routes in the system, so we need to disable these in the function. Change-Id: I94bfffd95b62066995bd436d3b8bf185eafda398
When RENEWING/REBINDING, the DHCP client should send messages with ciaddr set and requested-ip unset. However when dhcpcd 10 is configured with --noconfigure, the messages sent are the opposite: ciaddr unset and requested-ip set - these messages are for INIT-REBOOT, not RENEWING or REBINDING. The reason for it is that when --noconfigure is enabled, dhcpcd won't setup the state->addr property of the interface when the lease is bound. When dhcpcd renews or rebinds the lease later, it needs state->addr to be set to correctly configure ciaddr and requested-ip. Since state->addr is NULL, dhcpcd sends wrong messages (for the detail see github.com/NetworkConfiguration/issues/355). This patch fixes this by also setting up state->addr with ipv4_applyaddr() when --noconfigure is enabled. Note that this function also configure the IPv4 address and build routes in the system, so we need to disable these in the function.
I'm in two minds about this. BTW, just --force your push to your PR rather than creating new ones. |
Thanks for the reminder! I now understand that this detection is in I'll close the PR since |
Hi @rsmarples , is there any idea on this issue? Do you think we can remove the PRIVSEP here? |
This should fix dhcpcd sending the correct DHCP message type when entering the RENEW or REBIND state. Fixes #355. Co-authored-by: Zikai Chen <chenzikai@google.com>
@acst1223 Ah sorry, time got away and I forgot about this. |
Thanks for your patch! I've tried it and it fixes this issue perfectly! |
Need to do some testing myself before I commit, but the feedback is appreciated |
Hi,
I would like to report that when using dhcpcd with
--noconfigure
, it generates INIT-REBOOT messages during RENEWING/REBINDING.According to RFC 2131 4.3.6, when the DHCP client renews or rebinds the lease, the requested-ip must not be set and ciaddr should be the IP address. However I've observed that in the actual dhcpcd packets, the requested-ip is set and ciaddr is zero. This is exactly the behavior of INIT-REBOOT.
After some investigation in the code, I've found that the reason lies in the
state->addr
property. When sending a DHCPREQUEST, ifstate->addr
isNULL
, ciaddr will be zero and the requested-ip will be set. Otherwise ifstate->addr
is notNULL
, ciaddr will be set and the requested-ip will not be set. When dhcpcd with--configure
binds a lease,ipv4_applyaddr()
is called andstate->addr
is set, so the RENEWING/REBINDING later for the lease works fine. However, when--noconfigure
is used,ipv4_applyaddr()
is not called indhcp_bind()
, fordhcp_bind()
has returned earlier. This leads tostate->addr
keepingNULL
and dhcpcd sending wrong messages during RENEWING/REBINDING.I believe that although dhcpcd does not configure the system with
--noconfigure
, since it is still responsible for the DHCP negotiation, it still needs to maintain the correct state for each interface and send correct DHCP messages to the server.Roy, could you take a look at this? Thanks!
Zikai
The text was updated successfully, but these errors were encountered: