Commit c7589660 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[3282] Use DDNS configuration values in b10-dhcp4

Replaced hard-coded constants in dhcp4_srv.cc with methods and
logic in D2ClientMgr to implement behavior changes based on
dhcp-ddns configuration values.
parent 4289cec8
...@@ -79,36 +79,6 @@ Dhcp4Hooks Hooks; ...@@ -79,36 +79,6 @@ Dhcp4Hooks Hooks;
namespace isc { namespace isc {
namespace dhcp { namespace dhcp {
namespace {
// @todo The following constants describe server's behavior with respect to the
// DHCPv4 Client FQDN Option sent by a client. They will be removed
// when DDNS parameters for DHCPv4 are implemented with the ticket #3033.
// @todo Additional configuration parameter which we may consider is the one
// that controls whether the DHCP server sends the removal NameChangeRequest
// if it discovers that the entry for the particular client exists or that
// it always updates the DNS.
// Should server always include the FQDN option in its response, regardless
// if it has been requested in Parameter Request List Option (Disabled).
const bool FQDN_ALWAYS_INCLUDE = false;
// Enable A RR update delegation to the client (Disabled).
const bool FQDN_ALLOW_CLIENT_UPDATE = false;
// Globally enable updates (Enabled).
const bool FQDN_ENABLE_UPDATE = true;
// Do update, even if client requested no updates with N flag (Disabled).
const bool FQDN_OVERRIDE_NO_UPDATE = false;
// Server performs an update when client requested delegation (Enabled).
const bool FQDN_OVERRIDE_CLIENT_UPDATE = true;
// The fully qualified domain-name suffix if partial name provided by
// a client.
const char* FQDN_PARTIAL_SUFFIX = "example.com";
// Should server replace the domain-name supplied by the client (Disabled).
const bool FQDN_REPLACE_CLIENT_NAME = false;
}
Dhcpv4Srv::Dhcpv4Srv(uint16_t port, const char* dbconfig, const bool use_bcast, Dhcpv4Srv::Dhcpv4Srv(uint16_t port, const char* dbconfig, const bool use_bcast,
const bool direct_response_desired) const bool direct_response_desired)
: shutdown_(true), alloc_engine_(), port_(port), : shutdown_(true), alloc_engine_(), port_(port),
...@@ -580,8 +550,8 @@ Dhcpv4Srv::appendServerID(const Pkt4Ptr& response) { ...@@ -580,8 +550,8 @@ Dhcpv4Srv::appendServerID(const Pkt4Ptr& response) {
// The source address for the outbound message should have been set already. // The source address for the outbound message should have been set already.
// This is the address that to the best of the server's knowledge will be // This is the address that to the best of the server's knowledge will be
// available from the client. // available from the client.
// @todo: perhaps we should consider some more sophisticated server id /// @todo: perhaps we should consider some more sophisticated server id
// generation, but for the current use cases, it should be ok. /// generation, but for the current use cases, it should be ok.
response->addOption(OptionPtr(new Option4AddrLst(DHO_DHCP_SERVER_IDENTIFIER, response->addOption(OptionPtr(new Option4AddrLst(DHO_DHCP_SERVER_IDENTIFIER,
response->getLocalAddr())) response->getLocalAddr()))
); );
...@@ -650,8 +620,8 @@ Dhcpv4Srv::appendRequestedVendorOptions(const Pkt4Ptr& question, Pkt4Ptr& answer ...@@ -650,8 +620,8 @@ Dhcpv4Srv::appendRequestedVendorOptions(const Pkt4Ptr& question, Pkt4Ptr& answer
uint32_t vendor_id = vendor_req->getVendorId(); uint32_t vendor_id = vendor_req->getVendorId();
// Let's try to get ORO within that vendor-option // Let's try to get ORO within that vendor-option
/// @todo This is very specific to vendor-id=4491 (Cable Labs). Other vendors /// @todo This is very specific to vendor-id=4491 (Cable Labs). Other
/// may have different policies. /// vendors may have different policies.
OptionUint8ArrayPtr oro = OptionUint8ArrayPtr oro =
boost::dynamic_pointer_cast<OptionUint8Array>(vendor_req->getOption(DOCSIS3_V4_ORO)); boost::dynamic_pointer_cast<OptionUint8Array>(vendor_req->getOption(DOCSIS3_V4_ORO));
...@@ -757,68 +727,19 @@ Dhcpv4Srv::processClientFqdnOption(const Option4ClientFqdnPtr& fqdn, ...@@ -757,68 +727,19 @@ Dhcpv4Srv::processClientFqdnOption(const Option4ClientFqdnPtr& fqdn,
// response to a client. // response to a client.
Option4ClientFqdnPtr fqdn_resp(new Option4ClientFqdn(*fqdn)); Option4ClientFqdnPtr fqdn_resp(new Option4ClientFqdn(*fqdn));
// RFC4702, section 4 - set 'NOS' flags to 0. // Set the server S, N, and O flags based on client's flags and
fqdn_resp->setFlag(Option4ClientFqdn::FLAG_S, 0); // current configuration.
fqdn_resp->setFlag(Option4ClientFqdn::FLAG_O, 0); D2ClientMgr& d2_mgr = CfgMgr::instance().getD2ClientMgr();
fqdn_resp->setFlag(Option4ClientFqdn::FLAG_N, 0); d2_mgr.adjustFqdnFlags<Option4ClientFqdn>(*fqdn, *fqdn_resp);
// Conditions when N flag has to be set to indicate that server will not
// perform DNS updates:
// 1. Updates are globally disabled,
// 2. Client requested no update and server respects it,
// 3. Client requested that the forward DNS update is delegated to the
// client but server neither respects requests for forward update
// delegation nor it is configured to send update on its own when
// client requested delegation.
if (!FQDN_ENABLE_UPDATE ||
(fqdn->getFlag(Option4ClientFqdn::FLAG_N) &&
!FQDN_OVERRIDE_NO_UPDATE) ||
(!fqdn->getFlag(Option4ClientFqdn::FLAG_S) &&
!FQDN_ALLOW_CLIENT_UPDATE && !FQDN_OVERRIDE_CLIENT_UPDATE)) {
fqdn_resp->setFlag(Option4ClientFqdn::FLAG_N, true);
// Conditions when S flag is set to indicate that server will perform DNS
// update on its own:
// 1. Client requested that server performs DNS update and DNS updates are
// globally enabled.
// 2. Client requested that server delegates forward update to the client
// but server doesn't respect requests for delegation and it is
// configured to perform an update on its own when client requested the
// delegation.
} else if (fqdn->getFlag(Option4ClientFqdn::FLAG_S) ||
(!fqdn->getFlag(Option4ClientFqdn::FLAG_S) &&
!FQDN_ALLOW_CLIENT_UPDATE && FQDN_OVERRIDE_CLIENT_UPDATE)) {
fqdn_resp->setFlag(Option4ClientFqdn::FLAG_S, true);
}
// Server MUST set the O flag if it has overriden the client's setting
// of S flag.
if (fqdn->getFlag(Option4ClientFqdn::FLAG_S) !=
fqdn_resp->getFlag(Option4ClientFqdn::FLAG_S)) {
fqdn_resp->setFlag(Option4ClientFqdn::FLAG_O, true);
}
// If client suppled partial or empty domain-name, server should generate // Carry over the client's E flag.
// one. fqdn_resp->setFlag(Option4ClientFqdn::FLAG_E,
if (fqdn->getDomainNameType() == Option4ClientFqdn::PARTIAL) { fqdn->getFlag(Option4ClientFqdn::FLAG_E));
std::ostringstream name;
if (fqdn->getDomainName().empty() || FQDN_REPLACE_CLIENT_NAME) {
fqdn_resp->setDomainName("", Option4ClientFqdn::PARTIAL);
} else {
name << fqdn->getDomainName();
name << "." << FQDN_PARTIAL_SUFFIX;
fqdn_resp->setDomainName(name.str(), Option4ClientFqdn::FULL);
} // Adjust the domain name based on domain name value and type sent by the
// client and current configuration.
// Server may be configured to replace a name supplied by a client, even if d2_mgr.adjustDomainName<Option4ClientFqdn>(*fqdn, *fqdn_resp);
// client supplied fully qualified domain-name. The empty domain-name is
// is set to indicate that the name must be generated when the new lease
// is acquired.
} else if(FQDN_REPLACE_CLIENT_NAME) {
fqdn_resp->setDomainName("", Option4ClientFqdn::PARTIAL);
}
// Add FQDN option to the response message. Note that, there may be some // Add FQDN option to the response message. Note that, there may be some
// cases when server may choose not to include the FQDN option in a // cases when server may choose not to include the FQDN option in a
...@@ -838,15 +759,20 @@ Dhcpv4Srv::processClientFqdnOption(const Option4ClientFqdnPtr& fqdn, ...@@ -838,15 +759,20 @@ Dhcpv4Srv::processClientFqdnOption(const Option4ClientFqdnPtr& fqdn,
void void
Dhcpv4Srv::processHostnameOption(const OptionCustomPtr& opt_hostname, Dhcpv4Srv::processHostnameOption(const OptionCustomPtr& opt_hostname,
Pkt4Ptr& answer) { Pkt4Ptr& answer) {
// Fetch D2 configuration.
D2ClientMgr& d2_mgr = CfgMgr::instance().getD2ClientMgr();
// Do nothing if the DNS updates are disabled. // Do nothing if the DNS updates are disabled.
if (!FQDN_ENABLE_UPDATE) { if (!d2_mgr.ddnsEnabled()) {
return; return;
} }
std::string hostname = isc::util::str::trim(opt_hostname->readString()); std::string hostname = isc::util::str::trim(opt_hostname->readString());
unsigned int label_count = OptionDataTypeUtil::getLabelCount(hostname); unsigned int label_count = OptionDataTypeUtil::getLabelCount(hostname);
// The hostname option sent by the client should be at least 1 octet long. // The hostname option sent by the client should be at least 1 octet long.
// If it isn't we ignore this option. // If it isn't we ignore this option. (Per RFC 2131, section 3.14)
/// @todo It would be more liberal to accept this and let it fall into
/// the case of replace or less than two below.
if (label_count == 0) { if (label_count == 0) {
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA, DHCP4_EMPTY_HOSTNAME); LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA, DHCP4_EMPTY_HOSTNAME);
return; return;
...@@ -864,21 +790,20 @@ Dhcpv4Srv::processHostnameOption(const OptionCustomPtr& opt_hostname, ...@@ -864,21 +790,20 @@ Dhcpv4Srv::processHostnameOption(const OptionCustomPtr& opt_hostname,
// By checking the number of labels present in the hostname we may infer // By checking the number of labels present in the hostname we may infer
// whether client has sent the fully qualified or unqualified hostname. // whether client has sent the fully qualified or unqualified hostname.
// @todo We may want to reconsider whether it is appropriate for the /// @todo We may want to reconsider whether it is appropriate for the
// client to send a root domain name as a Hostname. There are /// client to send a root domain name as a Hostname. There are
// also extensions to the auto generation of the client's name, /// also extensions to the auto generation of the client's name,
// e.g. conversion to the puny code which may be considered at some point. /// e.g. conversion to the puny code which may be considered at some point.
// For now, we just remain liberal and expect that the DNS will handle /// For now, we just remain liberal and expect that the DNS will handle
// conversion if needed and possible. /// conversion if needed and possible.
if (FQDN_REPLACE_CLIENT_NAME || (label_count < 2)) { if ((d2_mgr.getD2ClientConfig()->getReplaceClientName()) ||
(label_count < 2)) {
opt_hostname_resp->writeString(""); opt_hostname_resp->writeString("");
// If there are two labels, it means that the client has specified
// the unqualified name. We have to concatenate the unqalified name
// with the domain name.
} else if (label_count == 2) { } else if (label_count == 2) {
std::ostringstream resp_hostname; // If there are two labels, it means that the client has specified
resp_hostname << hostname << "." << FQDN_PARTIAL_SUFFIX << "."; // the unqualified name. We have to concatenate the unqalified name
opt_hostname_resp->writeString(resp_hostname.str()); // with the domain name.
opt_hostname_resp->writeString(d2_mgr.qualifyName(hostname));
} }
answer->addOption(opt_hostname_resp); answer->addOption(opt_hostname_resp);
...@@ -969,9 +894,9 @@ queueNameChangeRequest(const isc::dhcp_ddns::NameChangeType chg_type, ...@@ -969,9 +894,9 @@ queueNameChangeRequest(const isc::dhcp_ddns::NameChangeType chg_type,
void void
Dhcpv4Srv::sendNameChangeRequests() { Dhcpv4Srv::sendNameChangeRequests() {
while (!name_change_reqs_.empty()) { while (!name_change_reqs_.empty()) {
// @todo Once next NameChangeRequest is picked from the queue /// @todo Once next NameChangeRequest is picked from the queue
// we should send it to the b10-dhcp_ddns module. Currently we /// we should send it to the b10-dhcp_ddns module. Currently we
// just drop it. /// just drop it.
name_change_reqs_.pop(); name_change_reqs_.pop();
} }
} }
...@@ -990,8 +915,8 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) { ...@@ -990,8 +915,8 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
// thing this client can get is some global information (like DNS // thing this client can get is some global information (like DNS
// servers). // servers).
// perhaps this should be logged on some higher level? This is most likely // perhaps this should be logged on some higher level? This is most
// configuration bug. // likely configuration bug.
LOG_ERROR(dhcp4_logger, DHCP4_SUBNET_SELECTION_FAILED) LOG_ERROR(dhcp4_logger, DHCP4_SUBNET_SELECTION_FAILED)
.arg(question->getRemoteAddr().toText()) .arg(question->getRemoteAddr().toText())
.arg(serverReceivedPacketName(question->getType())); .arg(serverReceivedPacketName(question->getType()));
...@@ -1004,7 +929,7 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) { ...@@ -1004,7 +929,7 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
// as siaddr has nothing to do with a lease, but otherwise we would have // as siaddr has nothing to do with a lease, but otherwise we would have
// to select subnet twice (performance hit) or update too many functions // to select subnet twice (performance hit) or update too many functions
// at once. // at once.
// @todo: move subnet selection to a common code /// @todo: move subnet selection to a common code
answer->setSiaddr(subnet->getSiaddr()); answer->setSiaddr(subnet->getSiaddr());
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA, DHCP4_SUBNET_SELECTED) LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA, DHCP4_SUBNET_SELECTED)
...@@ -1047,8 +972,8 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) { ...@@ -1047,8 +972,8 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
(answer->getOption(DHO_HOST_NAME)); (answer->getOption(DHO_HOST_NAME));
if (opt_hostname) { if (opt_hostname) {
hostname = opt_hostname->readString(); hostname = opt_hostname->readString();
// @todo It could be configurable what sort of updates the server /// @todo It could be configurable what sort of updates the
// is doing when Hostname option was sent. /// server is doing when Hostname option was sent.
fqdn_fwd = true; fqdn_fwd = true;
fqdn_rev = true; fqdn_rev = true;
} }
...@@ -1058,7 +983,7 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) { ...@@ -1058,7 +983,7 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
// will try to honour the hint, but it is just a hint - some other address // will try to honour the hint, but it is just a hint - some other address
// may be used instead. If fake_allocation is set to false, the lease will // may be used instead. If fake_allocation is set to false, the lease will
// be inserted into the LeaseMgr as well. // be inserted into the LeaseMgr as well.
// @todo pass the actual FQDN data. /// @todo pass the actual FQDN data.
Lease4Ptr old_lease; Lease4Ptr old_lease;
Lease4Ptr lease = alloc_engine_->allocateLease4(subnet, client_id, hwaddr, Lease4Ptr lease = alloc_engine_->allocateLease4(subnet, client_id, hwaddr,
hint, fqdn_fwd, fqdn_rev, hint, fqdn_fwd, fqdn_rev,
...@@ -1083,14 +1008,9 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) { ...@@ -1083,14 +1008,9 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
// generating the entire hostname for the client. The example of the // generating the entire hostname for the client. The example of the
// client's name, generated from the IP address is: host-192-0-2-3. // client's name, generated from the IP address is: host-192-0-2-3.
if ((fqdn || opt_hostname) && lease->hostname_.empty()) { if ((fqdn || opt_hostname) && lease->hostname_.empty()) {
hostname = lease->addr_.toText(); lease->hostname_ = CfgMgr::instance()
// Replace dots with hyphens. .getD2ClientMgr().generateFqdn(lease->addr_);
std::replace(hostname.begin(), hostname.end(), '.', '-');
ostringstream stream;
// The partial suffix will need to be replaced with the actual
// domain-name for the client when configuration is implemented.
stream << "host-" << hostname << "." << FQDN_PARTIAL_SUFFIX << ".";
lease->hostname_ = stream.str();
// The operations below are rather safe, but we want to catch // The operations below are rather safe, but we want to catch
// any potential exceptions (e.g. invalid lease database backend // any potential exceptions (e.g. invalid lease database backend
// implementation) and log an error. // implementation) and log an error.
...@@ -1122,22 +1042,18 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) { ...@@ -1122,22 +1042,18 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
// Subnet mask (type 1) // Subnet mask (type 1)
answer->addOption(getNetmaskOption(subnet)); answer->addOption(getNetmaskOption(subnet));
// @todo: send renew timer option (T1, option 58) /// @todo: send renew timer option (T1, option 58)
// @todo: send rebind timer option (T2, option 59) /// @todo: send rebind timer option (T2, option 59)
// @todo Currently the NameChangeRequests are always generated if // Create NameChangeRequests if DDNS is enabled and this is a
// real (not fake) allocation is being performed. Should we have // real allocation.
// control switch to enable/disable NameChangeRequest creation? if (!fake_allocation && CfgMgr::instance().ddnsEnabled()) {
// Perhaps we need a way to detect whether the b10-dhcp-ddns module
// is up an running?
if (!fake_allocation) {
try { try {
createNameChangeRequests(lease, old_lease); createNameChangeRequests(lease, old_lease);
} catch (const Exception& ex) { } catch (const Exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_NCR_CREATION_FAILED) LOG_ERROR(dhcp4_logger, DHCP4_NCR_CREATION_FAILED)
.arg(ex.what()); .arg(ex.what());
} }
} }
} else { } else {
...@@ -1178,8 +1094,8 @@ Dhcpv4Srv::adjustIfaceData(const Pkt4Ptr& query, const Pkt4Ptr& response) { ...@@ -1178,8 +1094,8 @@ Dhcpv4Srv::adjustIfaceData(const Pkt4Ptr& query, const Pkt4Ptr& response) {
// address for the response. Instead, we have to check what address our // address for the response. Instead, we have to check what address our
// socket is bound to and use it as a source address. This operation // socket is bound to and use it as a source address. This operation
// may throw if for some reason the socket is closed. // may throw if for some reason the socket is closed.
// @todo Consider an optimization that we use local address from /// @todo Consider an optimization that we use local address from
// the query if this address is not broadcast. /// the query if this address is not broadcast.
SocketInfo sock_info = IfaceMgr::instance().getSocket(*query); SocketInfo sock_info = IfaceMgr::instance().getSocket(*query);
// Set local adddress, port and interface. // Set local adddress, port and interface.
response->setLocalAddr(sock_info.addr_); response->setLocalAddr(sock_info.addr_);
...@@ -1294,7 +1210,7 @@ Pkt4Ptr ...@@ -1294,7 +1210,7 @@ Pkt4Ptr
Dhcpv4Srv::processRequest(Pkt4Ptr& request) { Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
/// @todo Uncomment this (see ticket #3116) /// @todo Uncomment this (see ticket #3116)
// sanityCheck(request, MANDATORY); /// sanityCheck(request, MANDATORY);
Pkt4Ptr ack = Pkt4Ptr Pkt4Ptr ack = Pkt4Ptr
(new Pkt4(DHCPACK, request->getTransid())); (new Pkt4(DHCPACK, request->getTransid()));
...@@ -1336,7 +1252,7 @@ void ...@@ -1336,7 +1252,7 @@ void
Dhcpv4Srv::processRelease(Pkt4Ptr& release) { Dhcpv4Srv::processRelease(Pkt4Ptr& release) {
/// @todo Uncomment this (see ticket #3116) /// @todo Uncomment this (see ticket #3116)
// sanityCheck(release, MANDATORY); /// sanityCheck(release, MANDATORY);
// Try to find client-id // Try to find client-id
ClientIdPtr client_id; ClientIdPtr client_id;
...@@ -1361,7 +1277,7 @@ Dhcpv4Srv::processRelease(Pkt4Ptr& release) { ...@@ -1361,7 +1277,7 @@ Dhcpv4Srv::processRelease(Pkt4Ptr& release) {
// Does the hardware address match? We don't want one client releasing // Does the hardware address match? We don't want one client releasing
// second client's leases. // second client's leases.
if (lease->hwaddr_ != release->getHWAddr()->hwaddr_) { if (lease->hwaddr_ != release->getHWAddr()->hwaddr_) {
// @todo: Print hwaddr from lease as part of ticket #2589 /// @todo: Print hwaddr from lease as part of ticket #2589
LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_RELEASE_FAIL_WRONG_HWADDR) LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL, DHCP4_RELEASE_FAIL_WRONG_HWADDR)
.arg(release->getCiaddr().toText()) .arg(release->getCiaddr().toText())
.arg(client_id ? client_id->toText() : "(no client-id)") .arg(client_id ? client_id->toText() : "(no client-id)")
...@@ -1419,9 +1335,11 @@ Dhcpv4Srv::processRelease(Pkt4Ptr& release) { ...@@ -1419,9 +1335,11 @@ Dhcpv4Srv::processRelease(Pkt4Ptr& release) {
.arg(client_id ? client_id->toText() : "(no client-id)") .arg(client_id ? client_id->toText() : "(no client-id)")
.arg(release->getHWAddr()->toText()); .arg(release->getHWAddr()->toText());
// Remove existing DNS entries for the lease, if any. if (CfgMgr::instance().ddnsEnabled() &&
queueNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, lease); CfgMgr::instance().getD2ClientConfig()->getRemoveOnRenew()) {
// Remove existing DNS entries for the lease, if any.
queueNameChangeRequest(isc::dhcp_ddns::CHG_REMOVE, lease);
}
} else { } else {
// Release failed - // Release failed -
LOG_ERROR(dhcp4_logger, DHCP4_RELEASE_FAIL) LOG_ERROR(dhcp4_logger, DHCP4_RELEASE_FAIL)
...@@ -1662,8 +1580,8 @@ Dhcpv4Srv::openActiveSockets(const uint16_t port, ...@@ -1662,8 +1580,8 @@ Dhcpv4Srv::openActiveSockets(const uint16_t port,
} }
// Let's reopen active sockets. openSockets4 will check internally whether // Let's reopen active sockets. openSockets4 will check internally whether
// sockets are marked active or inactive. // sockets are marked active or inactive.
// @todo Optimization: we should not reopen all sockets but rather select /// @todo Optimization: we should not reopen all sockets but rather select
// those that have been affected by the new configuration. /// those that have been affected by the new configuration.
isc::dhcp::IfaceMgrErrorMsgCallback error_handler = isc::dhcp::IfaceMgrErrorMsgCallback error_handler =
boost::bind(&Dhcpv4Srv::ifaceMgrSocket4ErrorHandler, _1); boost::bind(&Dhcpv4Srv::ifaceMgrSocket4ErrorHandler, _1);
if (!IfaceMgr::instance().openSockets4(port, use_bcast, error_handler)) { if (!IfaceMgr::instance().openSockets4(port, use_bcast, error_handler)) {
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment