Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Sebastian Schrader
Kea
Commits
aeac5383
Commit
aeac5383
authored
May 02, 2018
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5605a] Added a sanity_only flag to selectSubnet*
parent
2e182eba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/dhcp4_srv.cc
+12
-7
src/bin/dhcp4/dhcp4_srv.h
src/bin/dhcp4/dhcp4_srv.h
+6
-2
No files found.
src/bin/dhcp4/dhcp4_srv.cc
View file @
aeac5383
...
...
@@ -490,11 +490,12 @@ Dhcpv4Srv::shutdown() {
}
isc
::
dhcp
::
Subnet4Ptr
Dhcpv4Srv
::
selectSubnet
(
const
Pkt4Ptr
&
query
,
bool
&
drop
)
const
{
Dhcpv4Srv
::
selectSubnet
(
const
Pkt4Ptr
&
query
,
bool
&
drop
,
bool
sanity_only
)
const
{
// DHCPv4-over-DHCPv6 is a special (and complex) case
if
(
query
->
isDhcp4o6
())
{
return
(
selectSubnet4o6
(
query
,
drop
));
return
(
selectSubnet4o6
(
query
,
drop
,
sanity_only
));
}
Subnet4Ptr
subnet
;
...
...
@@ -546,7 +547,8 @@ Dhcpv4Srv::selectSubnet(const Pkt4Ptr& query, bool& drop) const {
subnet
=
cfgmgr
.
getCurrentCfg
()
->
getCfgSubnets4
()
->
selectSubnet
(
selector
);
// Let's execute all callouts registered for subnet4_select
if
(
HooksManager
::
calloutsPresent
(
Hooks
.
hook_index_subnet4_select_
))
{
if
(
!
sanity_only
&&
HooksManager
::
calloutsPresent
(
Hooks
.
hook_index_subnet4_select_
))
{
CalloutHandlePtr
callout_handle
=
getCalloutHandle
(
query
);
// We're reusing callout_handle from previous calls
...
...
@@ -611,7 +613,8 @@ Dhcpv4Srv::selectSubnet(const Pkt4Ptr& query, bool& drop) const {
}
isc
::
dhcp
::
Subnet4Ptr
Dhcpv4Srv
::
selectSubnet4o6
(
const
Pkt4Ptr
&
query
,
bool
&
drop
)
const
{
Dhcpv4Srv
::
selectSubnet4o6
(
const
Pkt4Ptr
&
query
,
bool
&
drop
,
bool
sanity_only
)
const
{
Subnet4Ptr
subnet
;
...
...
@@ -661,7 +664,8 @@ Dhcpv4Srv::selectSubnet4o6(const Pkt4Ptr& query, bool& drop) const {
subnet
=
cfgmgr
.
getCurrentCfg
()
->
getCfgSubnets4
()
->
selectSubnet4o6
(
selector
);
// Let's execute all callouts registered for subnet4_select
if
(
HooksManager
::
calloutsPresent
(
Hooks
.
hook_index_subnet4_select_
))
{
if
(
!
sanity_only
&&
HooksManager
::
calloutsPresent
(
Hooks
.
hook_index_subnet4_select_
))
{
CalloutHandlePtr
callout_handle
=
getCalloutHandle
(
query
);
// We're reusing callout_handle from previous calls
...
...
@@ -2996,9 +3000,10 @@ Dhcpv4Srv::acceptDirectRequest(const Pkt4Ptr& pkt) const {
return
(
false
);
}
bool
drop
=
false
;
bool
result
=
(
!
pkt
->
getLocalAddr
().
isV4Bcast
()
||
selectSubnet
(
pkt
,
drop
));
bool
result
=
(
!
pkt
->
getLocalAddr
().
isV4Bcast
()
||
selectSubnet
(
pkt
,
drop
,
true
));
if
(
drop
)
{
// The packet must be dropped.
// The packet must be dropped
but as sanity_only is true it is dead code
.
return
(
false
);
}
return
(
result
);
...
...
src/bin/dhcp4/dhcp4_srv.h
View file @
aeac5383
...
...
@@ -792,17 +792,21 @@ protected:
///
/// @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
/// @return selected subnet (or NULL if no suitable subnet was found)
isc
::
dhcp
::
Subnet4Ptr
selectSubnet
(
const
Pkt4Ptr
&
query
,
bool
&
drop
)
const
;
bool
&
drop
,
bool
sanity_only
=
false
)
const
;
/// @brief Selects a subnet for a given client's DHCP4o6 packet.
///
/// @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
/// @return selected subnet (or NULL if no suitable subnet was found)
isc
::
dhcp
::
Subnet4Ptr
selectSubnet4o6
(
const
Pkt4Ptr
&
query
,
bool
&
drop
)
const
;
bool
&
drop
,
bool
sanity_only
=
false
)
const
;
/// indicates if shutdown is in progress. Setting it to true will
/// initiate server shutdown procedure.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment