From 8d8edaea5d33659892a3deb0cc5d063e48e8b7f3 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 17 Nov 2020 13:00:27 +0100 Subject: [PATCH] nic_router: fix link state on dhcp server reconfig When reconfiguring the NIC router modifies the information that DHCP clients received through a DHCP server of the NIC router, the link state of the correspodning interface has to do a "down-up" sequence. This provides a signal to the DHCP clients to redo DHCP, receive the new information and update accordingly. Fixes #3931 --- repos/os/src/server/nic_router/interface.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/repos/os/src/server/nic_router/interface.cc b/repos/os/src/server/nic_router/interface.cc index 80730843f9..6466eff82c 100644 --- a/repos/os/src/server/nic_router/interface.cc +++ b/repos/os/src/server/nic_router/interface.cc @@ -1861,6 +1861,7 @@ void Interface::_update_icmp_links(Domain &cln_dom) void Interface::_update_dhcp_allocations(Domain &old_domain, Domain &new_domain) { + bool dhcp_clients_outdated { false }; try { Dhcp_server &old_dhcp_srv = old_domain.dhcp_server(); Dhcp_server &new_dhcp_srv = new_domain.dhcp_server(); @@ -1890,6 +1891,7 @@ void Interface::_update_dhcp_allocations(Domain &old_domain, } } /* dismiss DHCP allocation */ + dhcp_clients_outdated = true; _dhcp_allocations.remove(allocation); _destroy_dhcp_allocation(allocation, old_domain); }); @@ -1897,6 +1899,7 @@ void Interface::_update_dhcp_allocations(Domain &old_domain, catch (Pointer::Invalid) { /* dismiss all DHCP allocations */ + dhcp_clients_outdated = true; while (Dhcp_allocation *allocation = _dhcp_allocations.first()) { if (_config().verbose()) { log("[", new_domain, "] dismiss DHCP allocation: ", @@ -1906,6 +1909,10 @@ void Interface::_update_dhcp_allocations(Domain &old_domain, _destroy_dhcp_allocation(*allocation, old_domain); } } + if (dhcp_clients_outdated) { + _policy.interface_unready(); + _policy.interface_ready(); + } }