BIND 10 pd-ietf-demo, updated. 9c506fb40b27c7478cebbaae932c6b74348c4f42 [pd-ietf-demo] Support for DHCPv4 options that hold only sub options.
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Oct 17 11:55:29 UTC 2013
The branch, pd-ietf-demo has been updated
via 9c506fb40b27c7478cebbaae932c6b74348c4f42 (commit)
from 237e964ef04f1531efcb31cd015648f5d2be85fa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9c506fb40b27c7478cebbaae932c6b74348c4f42
Author: Marcin Siodelski <marcin at isc.org>
Date: Thu Oct 17 13:55:20 2013 +0200
[pd-ietf-demo] Support for DHCPv4 options that hold only sub options.
-----------------------------------------------------------------------
Summary of changes:
src/bin/dhcp4/dhcp4_srv.cc | 45 +++++++++++----------
src/bin/dhcp4/tests/dhcp4_test_utils.cc | 2 +-
src/lib/dhcp/libdhcp++.cc | 24 ++++++++++--
src/lib/dhcp/libdhcp++.h | 6 +++
src/lib/dhcp/option.cc | 4 +-
src/lib/dhcp/option_custom.cc | 16 ++++++++
src/lib/dhcp/option_definition.cc | 6 ++-
src/lib/dhcp/pkt4.cc | 2 +-
src/lib/dhcp/pkt6.cc | 4 +-
src/lib/dhcp/tests/libdhcp++_unittest.cc | 63 +++++++++++++++++++++++++-----
src/lib/dhcp/tests/option_unittest.cc | 6 ++-
src/lib/dhcp/tests/pkt4_unittest.cc | 6 ++-
src/lib/dhcp/tests/pkt6_unittest.cc | 6 ++-
13 files changed, 140 insertions(+), 50 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc
index aeb4729..bcea103 100644
--- a/src/bin/dhcp4/dhcp4_srv.cc
+++ b/src/bin/dhcp4/dhcp4_srv.cc
@@ -671,7 +671,8 @@ Dhcpv4Srv::appendRequestedVendorOptions(const Pkt4Ptr& question, Pkt4Ptr& answer
// Let's try to get ORO within that vendor-option
/// @todo This is very specific to vendor-id=4491 (Cable Labs). Other vendors
/// may have different policies.
- OptionPtr oro = vendor_req->getOption(DOCSIS3_V4_ORO);
+ OptionUint8ArrayPtr oro = boost::dynamic_pointer_cast<
+ OptionUint8Array>(vendor_req->getOption(DOCSIS3_V4_ORO));
/// @todo: see OPT_UINT8_TYPE definition in OptionDefinition::optionFactory().
/// I think it should be OptionUint8Array, not OptionGeneric
@@ -685,7 +686,7 @@ Dhcpv4Srv::appendRequestedVendorOptions(const Pkt4Ptr& question, Pkt4Ptr& answer
// Get the list of options that client requested.
bool added = false;
- const OptionBuffer& requested_opts = oro->getData();
+ const std::vector<uint8_t>& requested_opts = oro->getValues();
for (OptionBuffer::const_iterator code = requested_opts.begin();
code != requested_opts.end(); ++code) {
@@ -813,13 +814,6 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
opt->setUint32(lease->valid_lft_);
answer->addOption(opt);
- // Router (type 3)
- Subnet::OptionDescriptor opt_routers =
- subnet->getOptionDescriptor("dhcp4", DHO_ROUTERS);
- if (opt_routers.option) {
- answer->addOption(opt_routers.option);
- }
-
// Subnet mask (type 1)
answer->addOption(getNetmaskOption(subnet));
@@ -916,15 +910,18 @@ Dhcpv4Srv::processDiscover(Pkt4Ptr& discover) {
copyDefaultFields(discover, offer);
appendDefaultOptions(offer, DHCPOFFER);
- appendRequestedOptions(discover, offer);
- appendRequestedVendorOptions(discover, offer);
assignLease(discover, offer);
- // There are a few basic options that we always want to
- // include in the response. If client did not request
- // them we append them for him.
- appendBasicOptions(discover, offer);
+ // Adding any other options makes sense only when we got the lease.
+ if (offer->getYiaddr() != IOAddress("0.0.0.0")) {
+ appendRequestedOptions(discover, offer);
+ appendRequestedVendorOptions(discover, offer);
+ // There are a few basic options that we always want to
+ // include in the response. If client did not request
+ // them we append them for him.
+ appendBasicOptions(discover, offer);
+ }
return (offer);
}
@@ -940,18 +937,21 @@ Dhcpv4Srv::processRequest(Pkt4Ptr& request) {
copyDefaultFields(request, ack);
appendDefaultOptions(ack, DHCPACK);
- appendRequestedOptions(request, ack);
- appendRequestedVendorOptions(request, ack);
// Note that we treat REQUEST message uniformly, regardless if this is a
// first request (requesting for new address), renewing existing address
// or even rebinding.
assignLease(request, ack);
- // There are a few basic options that we always want to
- // include in the response. If client did not request
- // them we append them for him.
- appendBasicOptions(request, ack);
+ // Adding any other options makes sense only when we got the lease.
+ if (ack->getYiaddr() != IOAddress("0.0.0.0")) {
+ appendRequestedOptions(request, ack);
+ appendRequestedVendorOptions(request, ack);
+ // There are a few basic options that we always want to
+ // include in the response. If client did not request
+ // them we append them for him.
+ appendBasicOptions(request, ack);
+ }
return (ack);
}
@@ -1281,8 +1281,7 @@ Dhcpv4Srv::unpackOptions(const OptionBuffer& buf,
}
uint8_t opt_len = buf[offset++];
- if (offset + opt_len > buf.size()) {
- isc_throw(OutOfRange, "Option parse failed. Tried to parse "
+ if (offset + opt_len > buf.size()) {isc_throw(OutOfRange, "Option parse failed. Tried to parse "
<< offset + opt_len << " bytes from " << buf.size()
<< "-byte long buffer.");
}
diff --git a/src/bin/dhcp4/tests/dhcp4_test_utils.cc b/src/bin/dhcp4/tests/dhcp4_test_utils.cc
index d085316..f21e049 100644
--- a/src/bin/dhcp4/tests/dhcp4_test_utils.cc
+++ b/src/bin/dhcp4/tests/dhcp4_test_utils.cc
@@ -321,7 +321,7 @@ void Dhcpv4SrvTest::testDiscoverRequest(const uint8_t msg_type) {
if (msg_type == DHCPDISCOVER) {
ASSERT_NO_THROW(
rsp = srv->processDiscover(req);
- );
+ );
// Should return OFFER
ASSERT_TRUE(rsp);
diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc
index 524d56a..cd60724 100644
--- a/src/lib/dhcp/libdhcp++.cc
+++ b/src/lib/dhcp/libdhcp++.cc
@@ -200,6 +200,7 @@ LibDHCP::optionFactory(Option::Universe u,
size_t LibDHCP::unpackOptions6(const OptionBuffer& buf,
+ const std::string& option_space,
isc::dhcp::OptionCollection& options,
size_t* relay_msg_offset /* = 0 */,
size_t* relay_msg_len /* = 0 */) {
@@ -207,7 +208,14 @@ size_t LibDHCP::unpackOptions6(const OptionBuffer& buf,
size_t length = buf.size();
// Get the list of stdandard option definitions.
- const OptionDefContainer& option_defs = LibDHCP::getOptionDefs(Option::V6);
+ OptionDefContainer option_defs;
+ if (option_space == "dhcp6") {
+ option_defs = LibDHCP::getOptionDefs(Option::V6);
+ }
+ // @todo Once we implement other option spaces we should add else clause
+ // here and gather option definitions for them. For now leaving option_defs
+ // empty will imply creation of generic Option.
+
// Get the search index #1. It allows to search for option definitions
// using option code.
const OptionDefContainerTypeIndex& idx = option_defs.get<1>();
@@ -295,11 +303,19 @@ size_t LibDHCP::unpackOptions6(const OptionBuffer& buf,
}
size_t LibDHCP::unpackOptions4(const OptionBuffer& buf,
+ const std::string& option_space,
isc::dhcp::OptionCollection& options) {
size_t offset = 0;
// Get the list of stdandard option definitions.
- const OptionDefContainer& option_defs = LibDHCP::getOptionDefs(Option::V4);
+ OptionDefContainer option_defs;
+ if (option_space == "dhcp4") {
+ option_defs = LibDHCP::getOptionDefs(Option::V4);
+ }
+ // @todo Once we implement other option spaces we should add else clause
+ // here and gather option definitions for them. For now leaving option_defs
+ // empty will imply creation of generic Option.
+
// Get the search index #1. It allows to search for option definitions
// using option code.
const OptionDefContainerTypeIndex& idx = option_defs.get<1>();
@@ -454,7 +470,7 @@ size_t LibDHCP::unpackVendorOptions4(uint32_t vendor_id, const OptionBuffer& buf
isc::dhcp::OptionCollection& options) {
size_t offset = 0;
- // Get the list of stdandard option definitions.
+ // Get the list of standard option definitions.
const OptionDefContainer* option_defs = LibDHCP::getVendorOption4Defs(vendor_id);
// Get the search index #1. It allows to search for option definitions
// using option code.
@@ -515,7 +531,7 @@ size_t LibDHCP::unpackVendorOptions4(uint32_t vendor_id, const OptionBuffer& buf
// to get one option definition with the particular code. If more are
// returned we report an error.
const OptionDefContainerTypeRange& range = idx->equal_range(opt_type);
- // Get the number of returned option definitions for the option code.
+ // Get the number of returned option definitions for the option code.
size_t num_defs = distance(range.first, range.second);
if (num_defs > 1) {
diff --git a/src/lib/dhcp/libdhcp++.h b/src/lib/dhcp/libdhcp++.h
index 4931746..105a667 100644
--- a/src/lib/dhcp/libdhcp++.h
+++ b/src/lib/dhcp/libdhcp++.h
@@ -113,9 +113,12 @@ public:
/// in options container.
///
/// @param buf Buffer to be parsed.
+ /// @param option_space A name of the option space which holds definitions
+ /// of to be used to parse options in the packets.
/// @param options Reference to option container. Options will be
/// put here.
static size_t unpackOptions4(const OptionBuffer& buf,
+ const std::string& option_space,
isc::dhcp::OptionCollection& options);
/// @brief Parses provided buffer as DHCPv6 options and creates Option objects.
@@ -130,6 +133,8 @@ public:
/// iteration its content will be treated as buffer to be parsed.
///
/// @param buf Buffer to be parsed.
+ /// @param option_space A name of the option space which holds definitions
+ /// of to be used to parse options in the packets.
/// @param options Reference to option container. Options will be
/// put here.
/// @param relay_msg_offset reference to a size_t structure. If specified,
@@ -138,6 +143,7 @@ public:
/// length of the relay_msg option will be stored in it.
/// @return offset to the first byte after last parsed option
static size_t unpackOptions6(const OptionBuffer& buf,
+ const std::string& option_space,
isc::dhcp::OptionCollection& options,
size_t* relay_msg_offset = 0,
size_t* relay_msg_len = 0);
diff --git a/src/lib/dhcp/option.cc b/src/lib/dhcp/option.cc
index 46889e0..f5ab75e 100644
--- a/src/lib/dhcp/option.cc
+++ b/src/lib/dhcp/option.cc
@@ -135,10 +135,10 @@ Option::unpackOptions(const OptionBuffer& buf) {
switch (universe_) {
case V4:
- LibDHCP::unpackOptions4(buf, options_);
+ LibDHCP::unpackOptions4(buf, getEncapsulatedSpace(), options_);
return;
case V6:
- LibDHCP::unpackOptions6(buf, options_);
+ LibDHCP::unpackOptions6(buf, getEncapsulatedSpace(), options_);
return;
default:
isc_throw(isc::BadValue, "Invalid universe type " << universe_);
diff --git a/src/lib/dhcp/option_custom.cc b/src/lib/dhcp/option_custom.cc
index 0cca9b3..7eaf753 100644
--- a/src/lib/dhcp/option_custom.cc
+++ b/src/lib/dhcp/option_custom.cc
@@ -249,6 +249,12 @@ OptionCustom::createBuffers(const OptionBuffer& data_buf) {
// Proceed to the next data field.
data += data_size;
}
+
+ // Unpack suboptions if any.
+ if (data != data_buf.end() && !getEncapsulatedSpace().empty()) {
+ unpackOptions(OptionBuffer(data, data_buf.end()));
+ }
+
} else if (data_type != OPT_EMPTY_TYPE) {
// If data_type value is other than OPT_RECORD_TYPE, our option is
// empty (have no data at all) or it comprises one or more
@@ -319,6 +325,16 @@ OptionCustom::createBuffers(const OptionBuffer& data_buf) {
} else {
isc_throw(OutOfRange, "option buffer truncated");
}
+
+ // Unpack suboptions if any.
+ if (data != data_buf.end() && !getEncapsulatedSpace().empty()) {
+ unpackOptions(OptionBuffer(data, data_buf.end()));
+ }
+ }
+ } else if (data_type == OPT_EMPTY_TYPE) {
+ // Unpack suboptions if any.
+ if (data != data_buf.end() && !getEncapsulatedSpace().empty()) {
+ unpackOptions(OptionBuffer(data, data_buf.end()));
}
}
// If everything went ok we can replace old buffer set with new ones.
diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc
index 8c1cad0..c75c6f9 100644
--- a/src/lib/dhcp/option_definition.cc
+++ b/src/lib/dhcp/option_definition.cc
@@ -118,7 +118,11 @@ OptionDefinition::optionFactory(Option::Universe u, uint16_t type,
try {
switch(type_) {
case OPT_EMPTY_TYPE:
- return (factoryEmpty(u, type));
+ if (getEncapsulatedSpace().empty()) {
+ return (factoryEmpty(u, type));
+ } else {
+ return (OptionPtr(new OptionCustom(*this, u, begin, end)));
+ }
case OPT_BINARY_TYPE:
return (factoryGeneric(u, type, begin, end));
diff --git a/src/lib/dhcp/pkt4.cc b/src/lib/dhcp/pkt4.cc
index 4fc1c42..40df6d0 100644
--- a/src/lib/dhcp/pkt4.cc
+++ b/src/lib/dhcp/pkt4.cc
@@ -215,7 +215,7 @@ Pkt4::unpack() {
// a vector as an input.
buffer_in.readVector(opts_buffer, opts_len);
if (callback_.empty()) {
- LibDHCP::unpackOptions4(opts_buffer, options_);
+ LibDHCP::unpackOptions4(opts_buffer, "dhcp4", options_);
} else {
// The last two arguments are set to NULL because they are
// specific to DHCPv6 options parsing. They are unused for
diff --git a/src/lib/dhcp/pkt6.cc b/src/lib/dhcp/pkt6.cc
index 9d194a5..10cc173 100644
--- a/src/lib/dhcp/pkt6.cc
+++ b/src/lib/dhcp/pkt6.cc
@@ -328,7 +328,7 @@ Pkt6::unpackMsg(OptionBuffer::const_iterator begin,
// If custom option parsing function has been set, use this function
// to parse options. Otherwise, use standard function from libdhcp.
if (callback_.empty()) {
- LibDHCP::unpackOptions6(opt_buffer, options_);
+ LibDHCP::unpackOptions6(opt_buffer, "dhcp6", options_);
} else {
// The last two arguments hold the DHCPv6 Relay message offset and
// length. Setting them to NULL because we are dealing with the
@@ -375,7 +375,7 @@ Pkt6::unpackRelayMsg() {
// If custom option parsing function has been set, use this function
// to parse options. Otherwise, use standard function from libdhcp.
if (callback_.empty()) {
- LibDHCP::unpackOptions6(opt_buffer, relay.options_,
+ LibDHCP::unpackOptions6(opt_buffer, "dhcp6", relay.options_,
&relay_msg_offset, &relay_msg_len);
} else {
callback_(opt_buffer, "dhcp6", relay.options_,
diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc
index 776b084..016ddf6 100644
--- a/src/lib/dhcp/tests/libdhcp++_unittest.cc
+++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc
@@ -105,6 +105,33 @@ public:
testStdOptionDefs(Option::V6, code, begin, end, expected_type,
encapsulates);
}
+
+ /// @brief Create a sample DHCPv4 option 43 with suboptions.
+ static OptionBuffer createVendorOption() {
+ const uint8_t opt_data[] = {
+ 0x2B, 0x0D, // Vendor-Specific Information (CableLabs)
+ // Suboptions start here...
+ 0x02, 0x05, // Device Type Option (length = 5)
+ 'D', 'u', 'm', 'm', 'y',
+ 0x04, 0x04, // Serial Number Option (length = 4)
+ 0x42, 0x52, 0x32, 0x32 // Serial number
+ };
+ return (OptionBuffer(opt_data, opt_data + sizeof(opt_data)));
+ }
+
+ /// @brief Create a sample DHCPv4 option 82 with suboptions.
+ static OptionBuffer createAgentInformationOption() {
+ const uint8_t opt_data[] = {
+ 0x52, 0x0E, // Agent Information Option (length = 14)
+ // Suboptions start here...
+ 0x01, 0x04, // Agent Circuit ID (length = 4)
+ 0x20, 0x00, 0x00, 0x02, // ID
+ 0x02, 0x06, // Agent Remote ID
+ 0x20, 0xE5, 0x2A, 0xB8, 0x15, 0x14 // ID
+ };
+ return (OptionBuffer(opt_data, opt_data + sizeof(opt_data)));
+ }
+
private:
/// @brief Test DHCPv4 or DHCPv6 option definition.
@@ -159,8 +186,13 @@ private:
EXPECT_EQ(encapsulates, def->getEncapsulatedSpace());
OptionPtr option;
// Create the option.
- ASSERT_NO_THROW(option = def->optionFactory(u, code, begin, end))
- << "Option creation failed for option code " << code;
+ try {
+ option = def->optionFactory(u, code, begin, end);
+ } catch (const Exception &ex) {
+ std::cout << ex.what() << ": " << code << std::endl;
+ }
+ // ASSERT_NO_THROW(option = def->optionFactory(u, code, begin, end))
+ // << "Option creation failed for option code " << code;
// Make sure it is not NULL.
ASSERT_TRUE(option);
// And the actual object type is the one that we expect.
@@ -293,7 +325,7 @@ TEST_F(LibDhcpTest, unpackOptions6) {
EXPECT_NO_THROW ({
LibDHCP::unpackOptions6(OptionBuffer(buf.begin(), buf.begin() + sizeof(v6packed)),
- options);
+ "dhcp6", options);
});
EXPECT_EQ(options.size(), 5); // there should be 5 options
@@ -421,7 +453,7 @@ TEST_F(LibDhcpTest, unpackOptions4) {
isc::dhcp::OptionCollection options; // list of options
ASSERT_NO_THROW(
- LibDHCP::unpackOptions4(v4packed, options);
+ LibDHCP::unpackOptions4(v4packed, "dhcp4", options);
);
isc::dhcp::OptionCollection::const_iterator x = options.find(12);
@@ -653,8 +685,8 @@ TEST_F(LibDhcpTest, stdOptionDefs4) {
LibDhcpTest::testStdOptionDefs4(DHO_DEFAULT_TCP_TTL, begin, begin + 1,
typeid(OptionInt<uint8_t>));
- LibDhcpTest::testStdOptionDefs4(DHO_TCP_KEEPALIVE_INTERVAL, begin, begin + 4,
- typeid(OptionInt<uint32_t>));
+ LibDhcpTest::testStdOptionDefs4(DHO_TCP_KEEPALIVE_INTERVAL, begin,
+ begin + 4, typeid(OptionInt<uint32_t>));
LibDhcpTest::testStdOptionDefs4(DHO_TCP_KEEPALIVE_GARBAGE, begin, begin + 1,
typeid(OptionCustom));
@@ -668,8 +700,13 @@ TEST_F(LibDhcpTest, stdOptionDefs4) {
LibDhcpTest::testStdOptionDefs4(DHO_NTP_SERVERS, begin, end,
typeid(Option4AddrLst));
- LibDhcpTest::testStdOptionDefs4(DHO_VENDOR_ENCAPSULATED_OPTIONS, begin, end,
- typeid(Option),
+ // The following option requires well formed buffer to be created from.
+ // Not just a dummy one. This buffer includes some suboptions.
+ OptionBuffer vendor_opts_buf = createVendorOption();
+ LibDhcpTest::testStdOptionDefs4(DHO_VENDOR_ENCAPSULATED_OPTIONS,
+ vendor_opts_buf.begin(),
+ vendor_opts_buf.end(),
+ typeid(OptionCustom),
"vendor-encapsulated-options-space");
LibDhcpTest::testStdOptionDefs4(DHO_NETBIOS_NAME_SERVERS, begin, end,
@@ -744,8 +781,14 @@ TEST_F(LibDhcpTest, stdOptionDefs4) {
LibDhcpTest::testStdOptionDefs4(DHO_FQDN, begin, begin + 3,
typeid(Option4ClientFqdn));
- LibDhcpTest::testStdOptionDefs4(DHO_DHCP_AGENT_OPTIONS, begin, end,
- typeid(Option), "dhcp-agent-options-space");
+ // The following option requires well formed buffer to be created from.
+ // Not just a dummy one. This buffer includes some suboptions.
+ OptionBuffer agent_info_buf = createAgentInformationOption();
+ LibDhcpTest::testStdOptionDefs4(DHO_DHCP_AGENT_OPTIONS,
+ agent_info_buf.begin(),
+ agent_info_buf.end(),
+ typeid(OptionCustom),
+ "dhcp-agent-options-space");
LibDhcpTest::testStdOptionDefs4(DHO_AUTHENTICATE, begin, end,
typeid(Option));
diff --git a/src/lib/dhcp/tests/option_unittest.cc b/src/lib/dhcp/tests/option_unittest.cc
index 3a47d0e..a3aea9f 100644
--- a/src/lib/dhcp/tests/option_unittest.cc
+++ b/src/lib/dhcp/tests/option_unittest.cc
@@ -61,6 +61,8 @@ public:
/// Contains custom implementation of the callback.
///
/// @param buf a A buffer holding options in on-wire format.
+ /// @param option_space A name of the option space being encapsulated by
+ /// the option being parsed.
/// @param [out] options A reference to the collection where parsed options
/// will be stored.
/// @param relay_msg_offset Reference to a size_t structure. If specified,
@@ -69,7 +71,7 @@ public:
/// length of the relay_msg option will be stored in it.
/// @return An offset to the first byte after last parsed option.
size_t execute(const OptionBuffer& buf,
- const std::string&,
+ const std::string& option_space,
isc::dhcp::OptionCollection& options,
size_t* relay_msg_offset,
size_t* relay_msg_len) {
@@ -77,7 +79,7 @@ public:
// callback has been actually called.
executed_ = true;
// Use default implementation of the unpack algorithm to parse options.
- return (LibDHCP::unpackOptions6(buf, options, relay_msg_offset,
+ return (LibDHCP::unpackOptions6(buf, option_space, options, relay_msg_offset,
relay_msg_len));
}
diff --git a/src/lib/dhcp/tests/pkt4_unittest.cc b/src/lib/dhcp/tests/pkt4_unittest.cc
index 242e7d7..72ffff7 100644
--- a/src/lib/dhcp/tests/pkt4_unittest.cc
+++ b/src/lib/dhcp/tests/pkt4_unittest.cc
@@ -66,17 +66,19 @@ public:
/// Contains custom implementation of the callback.
///
/// @param buf a A buffer holding options in on-wire format.
+ /// @param option_space A name of the option space being encapsulated by
+ /// the option being parsed.
/// @param [out] options A reference to the collection where parsed options
/// will be stored.
/// @return An offset to the first byte after last parsed option.
size_t execute(const OptionBuffer& buf,
- const std::string&,
+ const std::string& option_space,
isc::dhcp::OptionCollection& options) {
// Set the executed_ member to true to allow verification that the
// callback has been actually called.
executed_ = true;
// Use default implementation of the unpack algorithm to parse options.
- return (LibDHCP::unpackOptions4(buf, options));
+ return (LibDHCP::unpackOptions4(buf, option_space, options));
}
/// A flag which indicates if callback function has been called.
diff --git a/src/lib/dhcp/tests/pkt6_unittest.cc b/src/lib/dhcp/tests/pkt6_unittest.cc
index 0687321..e18b545 100644
--- a/src/lib/dhcp/tests/pkt6_unittest.cc
+++ b/src/lib/dhcp/tests/pkt6_unittest.cc
@@ -66,6 +66,8 @@ public:
/// Contains custom implementation of the callback.
///
/// @param buf a A buffer holding options in on-wire format.
+ /// @param option_space A name of the option space encapsulated by the
+ /// option being parsed.
/// @param [out] options A reference to the collection where parsed options
/// will be stored.
/// @param relay_msg_offset Reference to a size_t structure. If specified,
@@ -74,7 +76,7 @@ public:
/// length of the relay_msg option will be stored in it.
/// @return An offset to the first byte after last parsed option.
size_t execute(const OptionBuffer& buf,
- const std::string&,
+ const std::string& option_space,
isc::dhcp::OptionCollection& options,
size_t* relay_msg_offset,
size_t* relay_msg_len) {
@@ -82,7 +84,7 @@ public:
// callback has been actually called.
executed_ = true;
// Use default implementation of the unpack algorithm to parse options.
- return (LibDHCP::unpackOptions6(buf, options, relay_msg_offset,
+ return (LibDHCP::unpackOptions6(buf, option_space, options, relay_msg_offset,
relay_msg_len));
}
More information about the bind10-changes
mailing list