NIC router: update IP config on DHCP RENEW/REBIND

The NIC router did update the IP config of a domain on a completed DHCP
REQUEST but not on completed DHCP RENEW or DHCP REBIND. Thus, it didn't adapt
to "real" DHCP servers (not NIC router servers) that got restarted with a
changed configuration by the means of RENEW/REBIND. The commit fixes this.
Note, that testing this is complicated as we don't have the necessary
infrastructure (we cannot simply use the DHCP server of the NIC router as this
would apply a link down/up sequence in order to let the client restart DHCP)

Ref #4460
This commit is contained in:
Martin Stein 2022-03-28 16:04:52 +02:00 committed by Christian Helmuth
parent f085fc9dd2
commit 7fc20e9ae8

View File

@ -136,6 +136,8 @@ void Dhcp_client::handle_dhcp_reply(Dhcp_packet &dhcp)
break;
case State::REQUEST:
case State::RENEW:
case State::REBIND:
{
if (msg_type != Message_type::ACK) {
throw Drop_packet("DHCP client expects an acknowledgement");
@ -145,16 +147,6 @@ void Dhcp_client::handle_dhcp_reply(Dhcp_packet &dhcp)
_domain().ip_config_from_dhcp_ack(dhcp);
break;
}
case State::RENEW:
case State::REBIND:
if (msg_type != Message_type::ACK) {
throw Drop_packet("DHCP client expects an acknowledgement");
}
_set_state(State::BOUND, _rerequest_timeout(1));
_lease_time_sec = dhcp.option<Dhcp_packet::Ip_lease_time>().value();
break;
default: throw Drop_packet("DHCP client doesn't expect a packet");
}
}