Skip to content

Commit d251033

Browse files
committed
[#3390] Rebased and addressed comments
1 parent c8c9382 commit d251033

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/lib/dhcp/libdhcp++.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,11 +1259,11 @@ LibDHCP::splitNtpServerOptions6(OptionCollection& options) {
12591259
if (range.first == range.second) {
12601260
return;
12611261
}
1262-
auto ntp_servers = OptionCollection(range.first, range.second);
1262+
auto const& ntp_servers = OptionCollection(range.first, range.second);
12631263
static_cast<void>(options.erase(range.first, range.second));
1264-
auto def = D6O_NTP_SERVER_DEF();
1265-
for (auto opt : ntp_servers) {
1266-
for (auto sub : opt.second->getOptions()) {
1264+
auto const& def = D6O_NTP_SERVER_DEF();
1265+
for (auto const& opt : ntp_servers) {
1266+
for (auto const& sub : opt.second->getOptions()) {
12671267
auto new_option(new OptionCustom(def, Option::V6));
12681268
new_option->addOption(sub.second);
12691269
options.insert(make_pair(D6O_NTP_SERVER, new_option));

src/lib/dhcp/tests/libdhcp++_unittest.cc

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3736,25 +3736,22 @@ TEST_F(LibDhcpTest, unpackOptions6LenientFqdn) {
37363736
TEST_F(LibDhcpTest, v6NtpServer) {
37373737
// A NTP server option with the 3 suboptions.
37383738
std::vector<uint8_t> bin {
3739-
0, 56, 0, 53, // ntp-server
3740-
0, 1, 0, 16, // ntp-server-address
3739+
0, 56, 0, 53, // ntp-server
3740+
0, 1, 0, 16, // ntp-server-address
37413741
0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, // 2001:db8::abcd
37423742
0, 0, 0, 0, 0, 0, 0xab, 0xcd,
3743-
0, 2, 0, 16, // ntp-server-multicast
3744-
0xff, 0x02, 0, 0, 0, 0, 0, 0, // ff02::101
3743+
0, 2, 0, 16, // ntp-server-multicast
3744+
0xff, 0x02, 0, 0, 0, 0, 0, 0, // ff02::101
37453745
0, 0, 0, 0, 0, 0, 0x01, 0x01,
3746-
0, 3, 0, 9, // ntp-server-fqdn
3747-
3, 0x66, 0x6f, 0x6f, // foo.bar.
3746+
0, 3, 0, 9, // ntp-server-fqdn
3747+
3, 0x66, 0x6f, 0x6f, // foo.bar.
37483748
3, 0x62, 0x61, 0x72, 0
37493749
};
37503750

37513751
// List of parsed options will be stored here.
3752-
isc::dhcp::OptionCollection options;
3753-
3752+
OptionCollection options;
37543753
OptionBuffer buf(bin);
3755-
37563754
size_t parsed = 0;
3757-
37583755
EXPECT_NO_THROW(parsed = LibDHCP::unpackOptions6(buf, DHCP6_OPTION_SPACE,
37593756
options));
37603757
EXPECT_EQ(bin.size(), parsed);
@@ -3841,7 +3838,7 @@ TEST_F(LibDhcpTest, v6NtpServer) {
38413838
option->addOption(fqdn);
38423839

38433840
// Pack output.
3844-
isc::util::OutputBuffer outbuf(0);
3841+
OutputBuffer outbuf(0);
38453842
ASSERT_NO_THROW(option->pack(outbuf, true));
38463843
ASSERT_EQ(bin.size(), outbuf.getLength());
38473844
EXPECT_TRUE(memcmp(&bin[0], outbuf.getData(), bin.size()) == 0);
@@ -3902,7 +3899,7 @@ TEST_F(LibDhcpTest, splitNtpServerOptions6) {
39023899
expected += " type=00003, len=00009: \"foo.bar.\" (fqdn)\n";
39033900
expected += "type=00059, len=00006: \"foobar\" (string)\n";
39043901
ostringstream output;
3905-
for (auto opt : col) {
3902+
for (auto const& opt : col) {
39063903
output << opt.second->toText() << endl;
39073904
}
39083905
EXPECT_EQ(expected, output.str());

0 commit comments

Comments
 (0)