Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Sebastian Schrader
Kea
Commits
c2c57b49
Commit
c2c57b49
authored
Oct 13, 2015
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[4058] Added copyDefaultOptions()
parent
27241065
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/dhcp4_srv.cc
+17
-0
src/bin/dhcp4/dhcp4_srv.h
src/bin/dhcp4/dhcp4_srv.h
+11
-0
No files found.
src/bin/dhcp4/dhcp4_srv.cc
View file @
c2c57b49
...
...
@@ -164,6 +164,7 @@ Dhcpv4Exchange::initResponse() {
if
(
resp_type
>
0
)
{
resp_
.
reset
(
new
Pkt4
(
resp_type
,
getQuery
()
->
getTransid
()));
copyDefaultFields
();
copyDefaultOptionss
();
}
}
...
...
@@ -208,12 +209,28 @@ Dhcpv4Exchange::copyDefaultFields() {
if
(
dst_hw_addr
)
{
resp_
->
setRemoteHWAddr
(
dst_hw_addr
);
}
}
void
Dhcpv4Exchange
::
copyDefaultOptions
()
{
// If this packet is relayed, we want to copy Relay Agent Info option
OptionPtr
rai
=
query_
->
getOption
(
DHO_DHCP_AGENT_OPTIONS
);
if
(
rai
)
{
resp_
->
addOption
(
rai
);
}
// RFC 3011 states about the Subnet Selection Option
// "Servers configured to support this option MUST return an
// identical copy of the option to any client that sends it,
// regardless of whether or not the client requests the option in
// a parameter request list. Clients using this option MUST
// discard DHCPOFFER or DHCPACK packets that do not contain this
// option."
OptionPtr
subnet_sel
=
query_
->
getOption
(
DHO_SUBNET_SELECTION
);
if
(
subnet_sel
)
{
resp_
->
addOption
(
subnet_sel
);
}
}
const
std
::
string
Dhcpv4Srv
::
VENDOR_CLASS_PREFIX
(
"VENDOR_CLASS_"
);
...
...
src/bin/dhcp4/dhcp4_srv.h
View file @
c2c57b49
...
...
@@ -130,6 +130,17 @@ private:
/// not NULL.
void
copyDefaultFields
();
/// @brief Copies default options from client's to server's message
///
/// Some options are copied from client's message into server's response,
/// e.g. Relay Agent Info option, Subnet Selection option etc.
///
/// @warning This message is called internally by @c initResponse and
/// thus it doesn't check if the resp_ value has been initialized. The
/// calling method is responsible for making sure that @c resp_ is
/// not NULL.
void
copyDefaultOptions
();
/// @brief Pointer to the allocation engine used by the server.
AllocEnginePtr
alloc_engine_
;
/// @brief Pointer to the DHCPv4 message sent by the client.
...
...
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