Commit 78c7a4f5 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[5605a] Minor changes after review:

 - comments added
parent cfc7596f
...@@ -547,6 +547,7 @@ Dhcpv4Srv::selectSubnet(const Pkt4Ptr& query, bool& drop, ...@@ -547,6 +547,7 @@ Dhcpv4Srv::selectSubnet(const Pkt4Ptr& query, bool& drop,
subnet = cfgmgr.getCurrentCfg()->getCfgSubnets4()->selectSubnet(selector); subnet = cfgmgr.getCurrentCfg()->getCfgSubnets4()->selectSubnet(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 && if (!sanity_only &&
HooksManager::calloutsPresent(Hooks.hook_index_subnet4_select_)) { HooksManager::calloutsPresent(Hooks.hook_index_subnet4_select_)) {
CalloutHandlePtr callout_handle = getCalloutHandle(query); CalloutHandlePtr callout_handle = getCalloutHandle(query);
...@@ -663,7 +664,8 @@ Dhcpv4Srv::selectSubnet4o6(const Pkt4Ptr& query, bool& drop, ...@@ -663,7 +664,8 @@ Dhcpv4Srv::selectSubnet4o6(const Pkt4Ptr& query, bool& drop,
CfgMgr& cfgmgr = CfgMgr::instance(); CfgMgr& cfgmgr = CfgMgr::instance();
subnet = cfgmgr.getCurrentCfg()->getCfgSubnets4()->selectSubnet4o6(selector); 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 && if (!sanity_only &&
HooksManager::calloutsPresent(Hooks.hook_index_subnet4_select_)) { HooksManager::calloutsPresent(Hooks.hook_index_subnet4_select_)) {
CalloutHandlePtr callout_handle = getCalloutHandle(query); CalloutHandlePtr callout_handle = getCalloutHandle(query);
......
...@@ -790,6 +790,11 @@ protected: ...@@ -790,6 +790,11 @@ protected:
/// @brief Selects a subnet for a given client's packet. /// @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 query client's message
/// @param drop if it is true the packet will be dropped /// @param drop if it is true the packet will be dropped
/// @param sanity_only if it is true the callout won't be called /// @param sanity_only if it is true the callout won't be called
...@@ -800,6 +805,11 @@ protected: ...@@ -800,6 +805,11 @@ protected:
/// @brief Selects a subnet for a given client's DHCP4o6 packet. /// @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 query client's message
/// @param drop if it is true the packet will be dropped /// @param drop if it is true the packet will be dropped
/// @param sanity_only if it is true the callout won't be called /// @param sanity_only if it is true the callout won't be called
......
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