From: Tomek Mrugalski Date: Mon, 7 May 2018 15:25:17 +0000 (+0200) Subject: [5605a] Minor changes after review: X-Git-Tag: trac5536_base~4^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78c7a4f55c242801b7078ae7c8500c96d0e7bd98;p=thirdparty%2Fkea.git [5605a] Minor changes after review: - comments added --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index e3430f515c..ddd6043370 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -547,6 +547,7 @@ Dhcpv4Srv::selectSubnet(const Pkt4Ptr& query, bool& drop, subnet = cfgmgr.getCurrentCfg()->getCfgSubnets4()->selectSubnet(selector); // Let's execute all callouts registered for subnet4_select + // (skip callouts if the selectSubnet was called to do sanity checks only) if (!sanity_only && HooksManager::calloutsPresent(Hooks.hook_index_subnet4_select_)) { CalloutHandlePtr callout_handle = getCalloutHandle(query); @@ -663,7 +664,8 @@ Dhcpv4Srv::selectSubnet4o6(const Pkt4Ptr& query, bool& drop, CfgMgr& cfgmgr = CfgMgr::instance(); subnet = cfgmgr.getCurrentCfg()->getCfgSubnets4()->selectSubnet4o6(selector); - // Let's execute all callouts registered for subnet4_select + // Let's execute all callouts registered for subnet4_select. + // (skip callouts if the selectSubnet was called to do sanity checks only) if (!sanity_only && HooksManager::calloutsPresent(Hooks.hook_index_subnet4_select_)) { CalloutHandlePtr callout_handle = getCalloutHandle(query); diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index 8656de8f89..3d8c46440d 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -790,6 +790,11 @@ protected: /// @brief Selects a subnet for a given client's packet. /// + /// If selectSubnet is called to simply do sanity checks (check if a + /// subnet would be selected), then there is no need to call hooks, + /// as this will happen later (when selectSubnet is called again). + /// In such case the sanity_only should be set to true. + /// /// @param query client's message /// @param drop if it is true the packet will be dropped /// @param sanity_only if it is true the callout won't be called @@ -800,6 +805,11 @@ protected: /// @brief Selects a subnet for a given client's DHCP4o6 packet. /// + /// If selectSubnet is called to simply do sanity checks (check if a + /// subnet would be selected), then there is no need to call hooks, + /// as this will happen later (when selectSubnet is called again). + /// In such case the sanity_only should be set to true. + /// /// @param query client's message /// @param drop if it is true the packet will be dropped /// @param sanity_only if it is true the callout won't be called