From: Marcin Siodelski Date: Thu, 26 Feb 2015 16:29:05 +0000 (+0100) Subject: [3730] Method to open sockets closes sockets before configuring IfaceMgr. X-Git-Tag: trac3733_base~5^2~1^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d1968dcc2a1e9081ceb44286f1b6231cb13ac95b;p=thirdparty%2Fkea.git [3730] Method to open sockets closes sockets before configuring IfaceMgr. Previously, the sockets were closed just before opening a new set of sockets, rather than before reconfiguring the IfaceMgr. Some steps of the IfaceMgr reconfiguration failed when sockets were still open, which effectively led to inability to reconfigure the running server. --- diff --git a/src/lib/dhcpsrv/cfg_iface.cc b/src/lib/dhcpsrv/cfg_iface.cc index 0a6926f40a..77f23629f9 100644 --- a/src/lib/dhcpsrv/cfg_iface.cc +++ b/src/lib/dhcpsrv/cfg_iface.cc @@ -65,6 +65,9 @@ CfgIface::openSockets(const uint16_t family, const uint16_t port, // inactive. setState(family, !wildcard_used_, true); IfaceMgr& iface_mgr = IfaceMgr::instance(); + // Close any open sockets because we're going to modify some properties + // of the IfaceMgr. Those modifications require that sockets are closed. + closeSockets(); // Remove selection of unicast addresses from all interfaces. iface_mgr.clearUnicasts(); // For the DHCPv4 server, if the user has selected that raw sockets @@ -127,9 +130,6 @@ CfgIface::openSockets(const uint16_t family, const uint16_t port, } } - // Before opening any sockets, close existing ones. - closeSockets(); - // Set the callback which is called when the socket fails to open // for some specific interface. This callback will simply log a // warning message.