Browse Source

[master] Merged trac5333 (re-detect vs close)

Francis Dupont 7 years ago
parent
commit
8bff2ec336

+ 2 - 2
src/lib/dhcp/iface_mgr_linux.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -487,7 +487,7 @@ void IfaceMgr::detectIfaces() {
         }
 
         nl.ipaddrs_get(*iface, addr_info);
-        ifaces_.push_back(iface);
+        addInterface(iface);
     }
 
     nl.release_list(link_info);

+ 3 - 0
src/lib/dhcpsrv/parsers/ifaces_config_parser.cc

@@ -45,6 +45,9 @@ IfacesConfigParser::parse(const CfgIfacePtr& cfg,
     bool re_detect = getBoolean(ifaces_config, "re-detect");
     cfg->setReDetect(re_detect);
     if (re_detect) {
+        // Interface clear will drop opened socket information
+        // so close them if the caller did not.
+        IfaceMgr::instance().closeSockets();
         IfaceMgr::instance().clearIfaces();
         IfaceMgr::instance().detectIfaces();
     }