From 7fc20e9ae84fc2eb5af394ab5430dd4e78e509b1 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Mon, 28 Mar 2022 16:04:52 +0200 Subject: [PATCH] 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 --- repos/os/src/server/nic_router/dhcp_client.cc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/repos/os/src/server/nic_router/dhcp_client.cc b/repos/os/src/server/nic_router/dhcp_client.cc index 1341bcfc56..4440e3c22a 100644 --- a/repos/os/src/server/nic_router/dhcp_client.cc +++ b/repos/os/src/server/nic_router/dhcp_client.cc @@ -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().value(); - break; - default: throw Drop_packet("DHCP client doesn't expect a packet"); } }