BIND 10 master, updated. 312e27c04145572a62815627ed63d9dc4ef866cd Merge branch 'trac1283'
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Jan 17 10:22:30 UTC 2014
The branch, master has been updated
via 312e27c04145572a62815627ed63d9dc4ef866cd (commit)
via 1d1e8b67f60e66804663fc9c3e8da4721f08074e (commit)
via 7607200420438907d7d3e036a967c20c6b9b3f99 (commit)
via df980e49b85b8f04aefbd2bdf3ad1b6da85c3ad9 (commit)
from e3038321406be5d3548edb666de79b63b818dba2 (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 312e27c04145572a62815627ed63d9dc4ef866cd
Merge: e303832 1d1e8b6
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Jan 17 14:44:23 2014 +0530
Merge branch 'trac1283'
Conflicts:
src/lib/dhcp/iface_mgr.cc
-----------------------------------------------------------------------
Summary of changes:
src/bin/d2/d2_cfg_mgr.cc | 5 +--
src/bin/dhcp4/config_parser.cc | 2 +-
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc | 40 ++++++++++----------
src/bin/dhcp4/tests/dhcp4_test_utils.cc | 8 ++--
src/bin/dhcp6/config_parser.cc | 4 +-
src/bin/dhcp6/dhcp6_srv.cc | 2 +-
src/bin/dhcp6/tests/config_parser_unittest.cc | 6 +--
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc | 24 ++++++------
src/bin/dhcp6/tests/dhcp6_test_utils.cc | 8 ++--
src/lib/asiolink/io_address.cc | 6 +++
src/lib/asiolink/io_address.h | 16 ++++++++
src/lib/asiolink/io_endpoint.cc | 4 +-
src/lib/asiolink/tests/io_address_unittest.cc | 12 +++++-
src/lib/dhcp/iface_mgr.cc | 8 ++--
src/lib/dhcp/option6_addrlst.cc | 6 +--
src/lib/dhcp/option6_iaaddr.cc | 7 ++--
src/lib/dhcp/option6_iaprefix.cc | 4 +-
src/lib/dhcp/option_custom.cc | 6 +--
src/lib/dhcp/option_definition.cc | 2 +-
src/lib/dhcp/pkt4.cc | 4 +-
src/lib/dhcp/pkt6.cc | 4 +-
src/lib/dhcp/pkt_filter.cc | 6 +--
src/lib/dhcp/pkt_filter_inet.cc | 3 +-
src/lib/dhcp/tests/iface_mgr_unittest.cc | 10 ++---
src/lib/dhcp/tests/option_custom_unittest.cc | 12 +++---
src/lib/dhcp/tests/option_data_types_unittest.cc | 4 +-
src/lib/dhcp/tests/pkt4_unittest.cc | 16 ++++----
src/lib/dhcp/tests/protocol_util_unittest.cc | 4 +-
src/lib/dhcp_ddns/ncr_msg.cc | 2 +-
src/lib/dhcpsrv/alloc_engine.cc | 2 +-
src/lib/dhcpsrv/lease.cc | 4 +-
src/lib/dhcpsrv/memfile_lease_mgr.cc | 4 +-
src/lib/dhcpsrv/mysql_lease_mgr.cc | 4 +-
src/lib/dhcpsrv/pool.cc | 8 ++--
src/lib/dhcpsrv/subnet.cc | 11 +++---
src/lib/dhcpsrv/tests/alloc_engine_unittest.cc | 32 ++++++++--------
.../dhcpsrv/tests/memfile_lease_mgr_unittest.cc | 4 +-
src/lib/dhcpsrv/tests/test_utils.cc | 4 +-
38 files changed, 167 insertions(+), 141 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/d2/d2_cfg_mgr.cc b/src/bin/d2/d2_cfg_mgr.cc
index ef63a0a..efa4de5 100644
--- a/src/bin/d2/d2_cfg_mgr.cc
+++ b/src/bin/d2/d2_cfg_mgr.cc
@@ -119,7 +119,7 @@ std::string
D2CfgMgr::reverseV4Address(const isc::asiolink::IOAddress& ioaddr) {
if (!ioaddr.isV4()) {
isc_throw(D2CfgError, "D2CfgMgr address is not IPv4 address :"
- << ioaddr.toText());
+ << ioaddr);
}
// Get the address in byte vector form.
@@ -148,8 +148,7 @@ D2CfgMgr::reverseV4Address(const isc::asiolink::IOAddress& ioaddr) {
std::string
D2CfgMgr::reverseV6Address(const isc::asiolink::IOAddress& ioaddr) {
if (!ioaddr.isV6()) {
- isc_throw(D2CfgError, "D2Cfg address is not IPv6 address: "
- << ioaddr.toText());
+ isc_throw(D2CfgError, "D2Cfg address is not IPv6 address: " << ioaddr);
}
// Turn the address into a string of digits.
diff --git a/src/bin/dhcp4/config_parser.cc b/src/bin/dhcp4/config_parser.cc
index ea9323b..7774edc 100644
--- a/src/bin/dhcp4/config_parser.cc
+++ b/src/bin/dhcp4/config_parser.cc
@@ -265,7 +265,7 @@ protected:
Triplet<uint32_t> valid = getParam("valid-lifetime");
stringstream tmp;
- tmp << addr.toText() << "/" << (int)len
+ tmp << addr << "/" << (int)len
<< " with params t1=" << t1 << ", t2=" << t2 << ", valid=" << valid;
LOG_INFO(dhcp4_logger, DHCP4_CONFIG_NEW_SUBNET).arg(tmp.str());
diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
index 057847c..65a9ca5 100644
--- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
+++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
@@ -584,7 +584,7 @@ TEST_F(Dhcpv4SrvFakeIfaceTest, DiscoverHint) {
// lifetime is correct, that T1 and T2 are returned properly
checkAddressParams(offer, subnet_);
- EXPECT_EQ(offer->getYiaddr().toText(), hint.toText());
+ EXPECT_EQ(offer->getYiaddr(), hint);
// Check identifiers
checkServerId(offer, srv->getServerID());
@@ -624,7 +624,7 @@ TEST_F(Dhcpv4SrvFakeIfaceTest, DiscoverNoClientId) {
// lifetime is correct, that T1 and T2 are returned properly
checkAddressParams(offer, subnet_);
- EXPECT_EQ(offer->getYiaddr().toText(), hint.toText());
+ EXPECT_EQ(offer->getYiaddr(), hint);
// Check identifiers
checkServerId(offer, srv->getServerID());
@@ -664,7 +664,7 @@ TEST_F(Dhcpv4SrvFakeIfaceTest, DiscoverInvalidHint) {
// lifetime is correct, that T1 and T2 are returned properly
checkAddressParams(offer, subnet_);
- EXPECT_NE(offer->getYiaddr().toText(), hint.toText());
+ EXPECT_NE(offer->getYiaddr(), hint);
// Check identifiers
checkServerId(offer, srv->getServerID());
@@ -735,12 +735,12 @@ TEST_F(Dhcpv4SrvFakeIfaceTest, ManyDiscovers) {
checkClientId(offer3, clientid3);
// Finally check that the addresses offered are different
- EXPECT_NE(addr1.toText(), addr2.toText());
- EXPECT_NE(addr2.toText(), addr3.toText());
- EXPECT_NE(addr3.toText(), addr1.toText());
- cout << "Offered address to client1=" << addr1.toText() << endl;
- cout << "Offered address to client2=" << addr2.toText() << endl;
- cout << "Offered address to client3=" << addr3.toText() << endl;
+ EXPECT_NE(addr1, addr2);
+ EXPECT_NE(addr2, addr3);
+ EXPECT_NE(addr3, addr1);
+ cout << "Offered address to client1=" << addr1 << endl;
+ cout << "Offered address to client2=" << addr2 << endl;
+ cout << "Offered address to client3=" << addr3 << endl;
}
// Checks whether echoing back client-id is controllable, i.e.
@@ -802,7 +802,7 @@ TEST_F(Dhcpv4SrvFakeIfaceTest, RequestBasic) {
// Check if we get response at all
checkResponse(ack, DHCPACK, 1234);
- EXPECT_EQ(hint.toText(), ack->getYiaddr().toText());
+ EXPECT_EQ(hint, ack->getYiaddr());
// Check that address was returned from proper range, that its lease
// lifetime is correct, that T1 and T2 are returned properly
@@ -886,9 +886,9 @@ TEST_F(Dhcpv4SrvFakeIfaceTest, ManyRequests) {
IOAddress addr3 = ack3->getYiaddr();
// Check that every client received the address it requested
- EXPECT_EQ(req_addr1.toText(), addr1.toText());
- EXPECT_EQ(req_addr2.toText(), addr2.toText());
- EXPECT_EQ(req_addr3.toText(), addr3.toText());
+ EXPECT_EQ(req_addr1, addr1);
+ EXPECT_EQ(req_addr2, addr2);
+ EXPECT_EQ(req_addr3, addr3);
// Check that the assigned address is indeed from the configured pool
checkAddressParams(ack1, subnet_);
@@ -910,12 +910,12 @@ TEST_F(Dhcpv4SrvFakeIfaceTest, ManyRequests) {
l = checkLease(ack3, clientid3, req3->getHWAddr(), addr3);
// Finally check that the addresses offered are different
- EXPECT_NE(addr1.toText(), addr2.toText());
- EXPECT_NE(addr2.toText(), addr3.toText());
- EXPECT_NE(addr3.toText(), addr1.toText());
- cout << "Offered address to client1=" << addr1.toText() << endl;
- cout << "Offered address to client2=" << addr2.toText() << endl;
- cout << "Offered address to client3=" << addr3.toText() << endl;
+ EXPECT_NE(addr1, addr2);
+ EXPECT_NE(addr2, addr3);
+ EXPECT_NE(addr3, addr1);
+ cout << "Offered address to client1=" << addr1 << endl;
+ cout << "Offered address to client2=" << addr2 << endl;
+ cout << "Offered address to client3=" << addr3 << endl;
}
// Checks whether echoing back client-id is controllable
@@ -1003,7 +1003,7 @@ TEST_F(Dhcpv4SrvFakeIfaceTest, RenewBasic) {
// Check if we get response at all
checkResponse(ack, DHCPACK, 1234);
- EXPECT_EQ(addr.toText(), ack->getYiaddr().toText());
+ EXPECT_EQ(addr, ack->getYiaddr());
// Check that address was returned from proper range, that its lease
// lifetime is correct, that T1 and T2 are returned properly
diff --git a/src/bin/dhcp4/tests/dhcp4_test_utils.cc b/src/bin/dhcp4/tests/dhcp4_test_utils.cc
index 8f96c1e..e983e7b 100644
--- a/src/bin/dhcp4/tests/dhcp4_test_utils.cc
+++ b/src/bin/dhcp4/tests/dhcp4_test_utils.cc
@@ -126,7 +126,7 @@ void Dhcpv4SrvTest::messageCheck(const Pkt4Ptr& q, const Pkt4Ptr& a) {
EXPECT_TRUE(a->getOption(DHO_DHCP_SERVER_IDENTIFIER));
// Check that something is offered
- EXPECT_TRUE(a->getYiaddr().toText() != "0.0.0.0");
+ EXPECT_NE("0.0.0.0", a->getYiaddr().toText());
}
::testing::AssertionResult
@@ -299,14 +299,14 @@ Lease4Ptr Dhcpv4SrvTest::checkLease(const Pkt4Ptr& rsp,
Lease4Ptr lease = LeaseMgrFactory::instance().getLease4(expected_addr);
if (!lease) {
- cout << "Lease for " << expected_addr.toText()
+ cout << "Lease for " << expected_addr
<< " not found in the database backend.";
return (Lease4Ptr());
}
- EXPECT_EQ(rsp->getYiaddr().toText(), expected_addr.toText());
+ EXPECT_EQ(rsp->getYiaddr(), expected_addr);
- EXPECT_EQ(expected_addr.toText(), lease->addr_.toText());
+ EXPECT_EQ(expected_addr, lease->addr_);
if (client_id) {
EXPECT_TRUE(*lease->client_id_ == *id);
}
diff --git a/src/bin/dhcp6/config_parser.cc b/src/bin/dhcp6/config_parser.cc
index fb0e962..32105ad 100644
--- a/src/bin/dhcp6/config_parser.cc
+++ b/src/bin/dhcp6/config_parser.cc
@@ -497,12 +497,12 @@ protected:
"parser error: interface (defined for locally reachable "
"subnets) and interface-id (defined for subnets reachable"
" via relays) cannot be defined at the same time for "
- "subnet " << addr.toText() << "/" << (int)len);
+ "subnet " << addr << "/" << (int)len);
}
}
stringstream tmp;
- tmp << addr.toText() << "/" << static_cast<int>(len)
+ tmp << addr << "/" << static_cast<int>(len)
<< " with params t1=" << t1 << ", t2=" << t2 << ", pref="
<< pref << ", valid=" << valid;
diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc
index 9b2b2c4..601a95c 100644
--- a/src/bin/dhcp6/dhcp6_srv.cc
+++ b/src/bin/dhcp6/dhcp6_srv.cc
@@ -1199,7 +1199,7 @@ Dhcpv6Srv::createRemovalNameChangeRequest(const Lease6Ptr& lease) {
if (!lease->duid_) {
isc_throw(isc::Unexpected, "DUID must be set when creating"
<< " NameChangeRequest for DNS records removal for "
- << lease->addr_.toText());
+ << lease->addr_);
}
isc::dhcp_ddns::D2Dhcid dhcid(*lease->duid_, hostname_wire);
diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc
index 84dd5b7..179f460 100644
--- a/src/bin/dhcp6/tests/config_parser_unittest.cc
+++ b/src/bin/dhcp6/tests/config_parser_unittest.cc
@@ -965,8 +965,7 @@ TEST_F(Dhcp6ParserTest, pdPoolBasics) {
// verify that it was interpreted correctly by checking the last address
// value.
isc::asiolink::IOAddress prefixAddress("2001:db8:1::");
- EXPECT_EQ(lastAddrInPrefix(prefixAddress, 64).toText(),
- p6->getLastAddress().toText());
+ EXPECT_EQ(lastAddrInPrefix(prefixAddress, 64), p6->getLastAddress());
}
// Goal of this test is verify that a list of PD pools can be configured.
@@ -1099,8 +1098,7 @@ TEST_F(Dhcp6ParserTest, subnetAndPrefixDelegated) {
// verify that it was interpreted correctly by checking the last address
// value.
isc::asiolink::IOAddress prefixAddress("2001:db8:1::");
- EXPECT_EQ(lastAddrInPrefix(prefixAddress, 64).toText(),
- p6->getLastAddress().toText());
+ EXPECT_EQ(lastAddrInPrefix(prefixAddress, 64), p6->getLastAddress());
}
diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
index 393d466..75c65d8 100644
--- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
+++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
@@ -642,12 +642,12 @@ TEST_F(Dhcpv6SrvTest, ManySolicits) {
checkClientId(reply3, clientid3);
// Finally check that the addresses offered are different
- EXPECT_NE(addr1->getAddress().toText(), addr2->getAddress().toText());
- EXPECT_NE(addr2->getAddress().toText(), addr3->getAddress().toText());
- EXPECT_NE(addr3->getAddress().toText(), addr1->getAddress().toText());
- cout << "Offered address to client1=" << addr1->getAddress().toText() << endl;
- cout << "Offered address to client2=" << addr2->getAddress().toText() << endl;
- cout << "Offered address to client3=" << addr3->getAddress().toText() << endl;
+ EXPECT_NE(addr1->getAddress(), addr2->getAddress());
+ EXPECT_NE(addr2->getAddress(), addr3->getAddress());
+ EXPECT_NE(addr3->getAddress(), addr1->getAddress());
+ cout << "Offered address to client1=" << addr1->getAddress() << endl;
+ cout << "Offered address to client2=" << addr2->getAddress() << endl;
+ cout << "Offered address to client3=" << addr3->getAddress() << endl;
}
// This test verifies that incoming REQUEST can be handled properly, that a
@@ -852,12 +852,12 @@ TEST_F(Dhcpv6SrvTest, ManyRequests) {
checkClientId(reply3, clientid3);
// Finally check that the addresses offered are different
- EXPECT_NE(addr1->getAddress().toText(), addr2->getAddress().toText());
- EXPECT_NE(addr2->getAddress().toText(), addr3->getAddress().toText());
- EXPECT_NE(addr3->getAddress().toText(), addr1->getAddress().toText());
- cout << "Assigned address to client1=" << addr1->getAddress().toText() << endl;
- cout << "Assigned address to client2=" << addr2->getAddress().toText() << endl;
- cout << "Assigned address to client3=" << addr3->getAddress().toText() << endl;
+ EXPECT_NE(addr1->getAddress(), addr2->getAddress());
+ EXPECT_NE(addr2->getAddress(), addr3->getAddress());
+ EXPECT_NE(addr3->getAddress(), addr1->getAddress());
+ cout << "Assigned address to client1=" << addr1->getAddress() << endl;
+ cout << "Assigned address to client2=" << addr2->getAddress() << endl;
+ cout << "Assigned address to client3=" << addr3->getAddress() << endl;
}
// This test verifies that incoming (positive) RENEW can be handled properly, that a
diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.cc b/src/bin/dhcp6/tests/dhcp6_test_utils.cc
index 93b6e44..88dee36 100644
--- a/src/bin/dhcp6/tests/dhcp6_test_utils.cc
+++ b/src/bin/dhcp6/tests/dhcp6_test_utils.cc
@@ -80,12 +80,12 @@ Dhcpv6SrvTest::checkLease(const DuidPtr& duid, const OptionPtr& ia_na,
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA,
addr->getAddress());
if (!lease) {
- std::cout << "Lease for " << addr->getAddress().toText()
+ std::cout << "Lease for " << addr->getAddress()
<< " not found in the database backend.";
return (Lease6Ptr());
}
- EXPECT_EQ(addr->getAddress().toText(), lease->addr_.toText());
+ EXPECT_EQ(addr->getAddress(), lease->addr_);
EXPECT_TRUE(*lease->duid_ == *duid);
EXPECT_EQ(ia->getIAID(), lease->iaid_);
EXPECT_EQ(subnet_->getID(), lease->subnet_id_);
@@ -101,12 +101,12 @@ Dhcpv6SrvTest::checkPdLease(const DuidPtr& duid, const OptionPtr& ia_pd,
Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(Lease::TYPE_PD,
prefix->getAddress());
if (!lease) {
- std::cout << "PD lease for " << prefix->getAddress().toText()
+ std::cout << "PD lease for " << prefix->getAddress()
<< " not found in the database backend.";
return (Lease6Ptr());
}
- EXPECT_EQ(prefix->getAddress().toText(), lease->addr_.toText());
+ EXPECT_EQ(prefix->getAddress(), lease->addr_);
EXPECT_TRUE(*lease->duid_ == *duid);
EXPECT_EQ(ia->getIAID(), lease->iaid_);
EXPECT_EQ(subnet_->getID(), lease->subnet_id_);
diff --git a/src/lib/asiolink/io_address.cc b/src/lib/asiolink/io_address.cc
index 90bdf57..7986725 100644
--- a/src/lib/asiolink/io_address.cc
+++ b/src/lib/asiolink/io_address.cc
@@ -114,5 +114,11 @@ IOAddress::operator uint32_t() const {
}
}
+std::ostream&
+operator<<(std::ostream& os, const IOAddress& address) {
+ os << address.toText();
+ return (os);
+}
+
} // namespace asiolink
} // namespace isc
diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h
index 5b11b87..8b18bf6 100644
--- a/src/lib/asiolink/io_address.h
+++ b/src/lib/asiolink/io_address.h
@@ -232,6 +232,22 @@ private:
asio::ip::address asio_address_;
};
+/// \brief Insert the IOAddress as a string into stream.
+///
+/// This method converts the \c address into a string and inserts it
+/// into the output stream \c os.
+///
+/// This function overloads the global operator<< to behave as described
+/// in ostream::operator<< but applied to \c IOAddress objects.
+///
+/// \param os A \c std::ostream object on which the insertion operation is
+/// performed.
+/// \param address The \c IOAddress object output by the operation.
+/// \return A reference to the same \c std::ostream object referenced by
+/// parameter \c os after the insertion operation.
+std::ostream&
+operator<<(std::ostream& os, const IOAddress& address);
+
} // namespace asiolink
} // namespace isc
#endif // IO_ADDRESS_H
diff --git a/src/lib/asiolink/io_endpoint.cc b/src/lib/asiolink/io_endpoint.cc
index 2354521..e6928f6 100644
--- a/src/lib/asiolink/io_endpoint.cc
+++ b/src/lib/asiolink/io_endpoint.cc
@@ -64,12 +64,12 @@ IOEndpoint::operator!=(const IOEndpoint& other) const {
ostream&
operator<<(ostream& os, const IOEndpoint& endpoint) {
if (endpoint.getFamily() == AF_INET6) {
- os << "[" << endpoint.getAddress().toText() << "]";
+ os << "[" << endpoint.getAddress() << "]";
} else {
// In practice this should be AF_INET, but it's not guaranteed by
// the interface. We'll use the result of textual address
// representation opaquely.
- os << endpoint.getAddress().toText();
+ os << endpoint.getAddress();
}
os << ":" << boost::lexical_cast<string>(endpoint.getPort());
return (os);
diff --git a/src/lib/asiolink/tests/io_address_unittest.cc b/src/lib/asiolink/tests/io_address_unittest.cc
index 4bd7626..5486d5c 100644
--- a/src/lib/asiolink/tests/io_address_unittest.cc
+++ b/src/lib/asiolink/tests/io_address_unittest.cc
@@ -21,6 +21,7 @@
#include <algorithm>
#include <cstring>
#include <vector>
+#include <sstream>
using namespace isc::asiolink;
@@ -83,7 +84,7 @@ TEST(IOAddressTest, fromBytes) {
EXPECT_NO_THROW({
addr = IOAddress::fromBytes(AF_INET, v4);
});
- EXPECT_EQ(addr.toText(), IOAddress("192.0.2.3").toText());
+ EXPECT_EQ(addr, IOAddress("192.0.2.3"));
}
TEST(IOAddressTest, toBytesV4) {
@@ -172,3 +173,12 @@ TEST(IOAddressTest, lessThanEqual) {
EXPECT_TRUE(addr6 <= addr7);
}
+
+// test operator<<. We simply confirm it appends the result of toText().
+TEST(IOAddressTest, LeftShiftOperator) {
+ const IOAddress addr("192.0.2.5");
+
+ std::ostringstream oss;
+ oss << addr;
+ EXPECT_EQ(addr.toText(), oss.str());
+}
diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc
index 8624c69..e3ffe48 100644
--- a/src/lib/dhcp/iface_mgr.cc
+++ b/src/lib/dhcp/iface_mgr.cc
@@ -226,7 +226,7 @@ void Iface::addUnicast(const isc::asiolink::IOAddress& addr) {
for (Iface::AddressCollection::const_iterator i = unicasts_.begin();
i != unicasts_.end(); ++i) {
if (*i == addr) {
- isc_throw(BadValue, "Address " << addr.toText()
+ isc_throw(BadValue, "Address " << addr
<< " already defined on the " << name_ << " interface.");
}
}
@@ -499,7 +499,6 @@ IfaceMgr::openSockets6(const uint16_t port,
try {
openSocket(iface->getName(), *addr, port);
-
} catch (const Exception& ex) {
IFACEMGR_ERROR(SocketConfigError, error_handler,
"Failed to open unicast socket on interface "
@@ -560,7 +559,6 @@ IfaceMgr::openSockets6(const uint16_t port,
" interface " << iface->getName() << ": "
<< ex.what());
continue;
-
}
count++;
@@ -662,7 +660,7 @@ int IfaceMgr::openSocket(const std::string& ifname, const IOAddress& addr,
} else {
isc_throw(BadValue, "Failed to detect family of address: "
- << addr.toText());
+ << addr);
}
}
@@ -737,7 +735,7 @@ int IfaceMgr::openSocketFromAddress(const IOAddress& addr,
}
// If we got here it means that we did not find specified address
// on any available interface.
- isc_throw(BadValue, "There is no such address " << addr.toText());
+ isc_throw(BadValue, "There is no such address " << addr);
}
int IfaceMgr::openSocketFromRemoteAddress(const IOAddress& remote_addr,
diff --git a/src/lib/dhcp/option6_addrlst.cc b/src/lib/dhcp/option6_addrlst.cc
index cb14070..45c2262 100644
--- a/src/lib/dhcp/option6_addrlst.cc
+++ b/src/lib/dhcp/option6_addrlst.cc
@@ -102,9 +102,9 @@ std::string Option6AddrLst::toText(int indent /* =0 */) {
tmp << "type=" << type_ << " " << addrs_.size() << "addr(s): ";
- for (AddressContainer::const_iterator addr=addrs_.begin();
- addr!=addrs_.end(); ++addr) {
- tmp << addr->toText() << " ";
+ for (AddressContainer::const_iterator addr = addrs_.begin();
+ addr != addrs_.end(); ++addr) {
+ tmp << *addr << " ";
}
return tmp.str();
}
diff --git a/src/lib/dhcp/option6_iaaddr.cc b/src/lib/dhcp/option6_iaaddr.cc
index 39efa61..cbcd555 100644
--- a/src/lib/dhcp/option6_iaaddr.cc
+++ b/src/lib/dhcp/option6_iaaddr.cc
@@ -37,7 +37,7 @@ Option6IAAddr::Option6IAAddr(uint16_t type, const isc::asiolink::IOAddress& addr
valid_(valid) {
setEncapsulatedSpace("dhcp6");
if (!addr.isV6()) {
- isc_throw(isc::BadValue, addr_.toText() << " is not an IPv6 address");
+ isc_throw(isc::BadValue, addr_ << " is not an IPv6 address");
}
}
@@ -57,8 +57,7 @@ void Option6IAAddr::pack(isc::util::OutputBuffer& buf) {
buf.writeUint16(len() - getHeaderLen());
if (!addr_.isV6()) {
- isc_throw(isc::BadValue, addr_.toText()
- << " is not an IPv6 address");
+ isc_throw(isc::BadValue, addr_ << " is not an IPv6 address");
}
buf.writeData(&addr_.toBytes()[0], isc::asiolink::V6ADDRESS_LEN);
@@ -93,7 +92,7 @@ std::string Option6IAAddr::toText(int indent /* =0 */) {
for (int i=0; i<indent; i++)
tmp << " ";
- tmp << "type=" << type_ << "(IAADDR) addr=" << addr_.toText()
+ tmp << "type=" << type_ << "(IAADDR) addr=" << addr_
<< ", preferred-lft=" << preferred_ << ", valid-lft="
<< valid_ << endl;
diff --git a/src/lib/dhcp/option6_iaprefix.cc b/src/lib/dhcp/option6_iaprefix.cc
index a7776d7..d28b4f7 100644
--- a/src/lib/dhcp/option6_iaprefix.cc
+++ b/src/lib/dhcp/option6_iaprefix.cc
@@ -51,7 +51,7 @@ Option6IAPrefix::Option6IAPrefix(uint32_t type, OptionBuffer::const_iterator beg
void Option6IAPrefix::pack(isc::util::OutputBuffer& buf) {
if (!addr_.isV6()) {
- isc_throw(isc::BadValue, addr_.toText() << " is not an IPv6 address");
+ isc_throw(isc::BadValue, addr_ << " is not an IPv6 address");
}
buf.writeUint16(type_);
@@ -98,7 +98,7 @@ std::string Option6IAPrefix::toText(int indent /* =0 */) {
for (int i=0; i<indent; i++)
tmp << " ";
- tmp << "type=" << type_ << "(IAPREFIX) prefix=" << addr_.toText() << "/"
+ tmp << "type=" << type_ << "(IAPREFIX) prefix=" << addr_ << "/"
<< prefix_len_ << ", preferred-lft=" << preferred_ << ", valid-lft="
<< valid_ << endl;
diff --git a/src/lib/dhcp/option_custom.cc b/src/lib/dhcp/option_custom.cc
index 278c0c9..0709d20 100644
--- a/src/lib/dhcp/option_custom.cc
+++ b/src/lib/dhcp/option_custom.cc
@@ -54,7 +54,7 @@ OptionCustom::addArrayDataField(const asiolink::IOAddress& address) {
if ((address.isV4() && definition_.getType() != OPT_IPV4_ADDRESS_TYPE) ||
(address.isV6() && definition_.getType() != OPT_IPV6_ADDRESS_TYPE)) {
isc_throw(BadDataTypeCast, "invalid address specified "
- << address.toText() << ". Expected a valid IPv"
+ << address << ". Expected a valid IPv"
<< (definition_.getType() == OPT_IPV4_ADDRESS_TYPE ?
"4" : "6") << " address.");
}
@@ -375,7 +375,7 @@ OptionCustom::dataFieldToText(const OptionDataType data_type,
break;
case OPT_IPV4_ADDRESS_TYPE:
case OPT_IPV6_ADDRESS_TYPE:
- text << readAddress(index).toText();
+ text << readAddress(index);
break;
case OPT_FQDN_TYPE:
text << readFqdn(index);
@@ -443,7 +443,7 @@ OptionCustom::writeAddress(const asiolink::IOAddress& address,
if ((address.isV4() && buffers_[index].size() != V4ADDRESS_LEN) ||
(address.isV6() && buffers_[index].size() != V6ADDRESS_LEN)) {
isc_throw(BadDataTypeCast, "invalid address specified "
- << address.toText() << ". Expected a valid IPv"
+ << address << ". Expected a valid IPv"
<< (buffers_[index].size() == V4ADDRESS_LEN ? "4" : "6")
<< " address.");
}
diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc
index be1a5e7..78cb39b 100644
--- a/src/lib/dhcp/option_definition.cc
+++ b/src/lib/dhcp/option_definition.cc
@@ -497,7 +497,7 @@ OptionDefinition::writeToBuffer(const std::string& value,
asiolink::IOAddress address(value);
if (!address.isV4() && !address.isV6()) {
isc_throw(BadDataTypeCast, "provided address "
- << address.toText()
+ << address
<< " is not a valid IPv4 or IPv6 address.");
}
OptionDataTypeUtil::writeAddress(address, buf);
diff --git a/src/lib/dhcp/pkt4.cc b/src/lib/dhcp/pkt4.cc
index e9c2093..c1864b2 100644
--- a/src/lib/dhcp/pkt4.cc
+++ b/src/lib/dhcp/pkt4.cc
@@ -278,8 +278,8 @@ void Pkt4::repack() {
std::string
Pkt4::toText() {
stringstream tmp;
- tmp << "localAddr=" << local_addr_.toText() << ":" << local_port_
- << " remoteAddr=" << remote_addr_.toText()
+ tmp << "localAddr=" << local_addr_ << ":" << local_port_
+ << " remoteAddr=" << remote_addr_
<< ":" << remote_port_ << ", msgtype=" << static_cast<int>(getType())
<< ", transid=0x" << hex << transid_ << dec << endl;
diff --git a/src/lib/dhcp/pkt6.cc b/src/lib/dhcp/pkt6.cc
index 308880e..296a389 100644
--- a/src/lib/dhcp/pkt6.cc
+++ b/src/lib/dhcp/pkt6.cc
@@ -453,8 +453,8 @@ Pkt6::unpackTCP() {
std::string
Pkt6::toText() {
stringstream tmp;
- tmp << "localAddr=[" << local_addr_.toText() << "]:" << local_port_
- << " remoteAddr=[" << remote_addr_.toText()
+ tmp << "localAddr=[" << local_addr_ << "]:" << local_port_
+ << " remoteAddr=[" << remote_addr_
<< "]:" << remote_port_ << endl;
tmp << "msgtype=" << static_cast<int>(msg_type_) << ", transid=0x" <<
hex << transid_ << dec << endl;
diff --git a/src/lib/dhcp/pkt_filter.cc b/src/lib/dhcp/pkt_filter.cc
index 9c1995d..1eef9c7 100644
--- a/src/lib/dhcp/pkt_filter.cc
+++ b/src/lib/dhcp/pkt_filter.cc
@@ -29,7 +29,7 @@ PktFilter::openFallbackSocket(const isc::asiolink::IOAddress& addr,
int sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
isc_throw(SocketConfigError, "failed to create fallback socket for"
- " address " << addr.toText() << ", port " << port
+ " address " << addr << ", port " << port
<< ", reason: " << strerror(errno));
}
// Bind the socket to a specified address and port.
@@ -44,7 +44,7 @@ PktFilter::openFallbackSocket(const isc::asiolink::IOAddress& addr,
// Remember to close the socket if we failed to bind it.
close(sock);
isc_throw(SocketConfigError, "failed to bind fallback socket to"
- " address " << addr.toText() << ", port " << port
+ " address " << addr << ", port " << port
<< ", reason: " << strerror(errno)
<< " - is another DHCP server running?");
}
@@ -54,7 +54,7 @@ PktFilter::openFallbackSocket(const isc::asiolink::IOAddress& addr,
if (fcntl(sock, F_SETFL, O_NONBLOCK) != 0) {
close(sock);
isc_throw(SocketConfigError, "failed to set SO_NONBLOCK option on the"
- " fallback socket, bound to " << addr.toText() << ", port "
+ " fallback socket, bound to " << addr << ", port "
<< port << ", reason: " << strerror(errno));
}
// Successfully created and bound a fallback socket. Return a descriptor.
diff --git a/src/lib/dhcp/pkt_filter_inet.cc b/src/lib/dhcp/pkt_filter_inet.cc
index 1694798..1af3970 100644
--- a/src/lib/dhcp/pkt_filter_inet.cc
+++ b/src/lib/dhcp/pkt_filter_inet.cc
@@ -79,7 +79,8 @@ PktFilterInet::openSocket(const Iface& iface,
if (bind(sock, (struct sockaddr *)&addr4, sizeof(addr4)) < 0) {
close(sock);
- isc_throw(SocketConfigError, "Failed to bind socket " << sock << " to " << addr.toText()
+ isc_throw(SocketConfigError, "Failed to bind socket " << sock
+ << " to " << addr
<< "/port=" << port);
}
diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc
index 853cc42..dc5d85b 100644
--- a/src/lib/dhcp/tests/iface_mgr_unittest.cc
+++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc
@@ -428,10 +428,10 @@ TEST_F(IfaceMgrTest, dhcp6Sniffer) {
cout << " pkt = new Pkt6(" << pkt->data_len_ << ");" << endl;
cout << " pkt->remote_port_ = " << pkt-> remote_port_ << ";" << endl;
cout << " pkt->remote_addr_ = IOAddress(\""
- << pkt->remote_addr_.toText() << "\");" << endl;
+ << pkt->remote_addr_ << "\");" << endl;
cout << " pkt->local_port_ = " << pkt-> local_port_ << ";" << endl;
cout << " pkt->local_addr_ = IOAddress(\""
- << pkt->local_addr_.toText() << "\");" << endl;
+ << pkt->local_addr_ << "\");" << endl;
cout << " pkt->ifindex_ = " << pkt->ifindex_ << ";" << endl;
cout << " pkt->iface_ = \"" << pkt->iface_ << "\";" << endl;
@@ -1015,7 +1015,7 @@ TEST_F(IfaceMgrTest, sendReceive6) {
EXPECT_EQ(0, memcmp(&sendPkt->data_[0], &rcvPkt->data_[0],
rcvPkt->data_.size()));
- EXPECT_EQ(sendPkt->getRemoteAddr().toText(), rcvPkt->getRemoteAddr().toText());
+ EXPECT_EQ(sendPkt->getRemoteAddr(), rcvPkt->getRemoteAddr());
// since we opened 2 sockets on the same interface and none of them is multicast,
// none is preferred over the other for sending data, so we really should not
@@ -2336,7 +2336,7 @@ TEST_F(IfaceMgrTest, DISABLED_detectIfaces_linux) {
const Iface::AddressCollection& addrs = i->getAddresses();
for (Iface::AddressCollection::const_iterator a= addrs.begin();
a != addrs.end(); ++a) {
- cout << a->toText() << " ";
+ cout << *a << " ";
}
cout << endl;
}
@@ -2394,7 +2394,7 @@ TEST_F(IfaceMgrTest, DISABLED_detectIfaces_linux) {
<< " address on " << detected->getFullName() << " interface." << endl;
FAIL();
}
- cout << "Address " << addr->toText() << " on interface " << detected->getFullName()
+ cout << "Address " << *addr << " on interface " << detected->getFullName()
<< " matched with 'ifconfig -a' output." << endl;
}
}
diff --git a/src/lib/dhcp/tests/option_custom_unittest.cc b/src/lib/dhcp/tests/option_custom_unittest.cc
index 4add2d8..6b181e6 100644
--- a/src/lib/dhcp/tests/option_custom_unittest.cc
+++ b/src/lib/dhcp/tests/option_custom_unittest.cc
@@ -667,7 +667,7 @@ TEST_F(OptionCustomTest, ipv4AddressDataArray) {
for (int i = 0; i < 3; ++i) {
IOAddress address("10.10.10.10");
ASSERT_NO_THROW(address = option->readAddress(i));
- EXPECT_EQ(addresses[i].toText(), address.toText());
+ EXPECT_EQ(addresses[i], address);
}
// Check that it is ok if buffer length is not a multiple of IPv4
@@ -717,7 +717,7 @@ TEST_F(OptionCustomTest, ipv6AddressDataArray) {
for (int i = 0; i < 3; ++i) {
IOAddress address("fe80::4");
ASSERT_NO_THROW(address = option->readAddress(i));
- EXPECT_EQ(addresses[i].toText(), address.toText());
+ EXPECT_EQ(addresses[i], address);
}
// Check that it is ok if buffer length is not a multiple of IPv6
@@ -1451,7 +1451,7 @@ TEST_F(OptionCustomTest, unpack) {
for (int i = 0; i < 3; ++i) {
IOAddress address("10.10.10.10");
ASSERT_NO_THROW(address = option->readAddress(i));
- EXPECT_EQ(addresses[i].toText(), address.toText());
+ EXPECT_EQ(addresses[i], address);
}
// Remove all addresses we had added. We are going to replace
@@ -1478,7 +1478,7 @@ TEST_F(OptionCustomTest, unpack) {
for (int i = 0; i < 2; ++i) {
IOAddress address("10.10.10.10");
ASSERT_NO_THROW(address = option->readAddress(i));
- EXPECT_EQ(addresses[i].toText(), address.toText());
+ EXPECT_EQ(addresses[i], address);
}
}
@@ -1513,7 +1513,7 @@ TEST_F(OptionCustomTest, initialize) {
for (int i = 0; i < 3; ++i) {
IOAddress address("fe80::4");
ASSERT_NO_THROW(address = option->readAddress(i));
- EXPECT_EQ(addresses[i].toText(), address.toText());
+ EXPECT_EQ(addresses[i], address);
}
// Clear addresses we had previously added.
@@ -1539,7 +1539,7 @@ TEST_F(OptionCustomTest, initialize) {
for (int i = 0; i < 2; ++i) {
IOAddress address("10.10.10.10");
ASSERT_NO_THROW(address = option->readAddress(i));
- EXPECT_EQ(addresses[i].toText(), address.toText());
+ EXPECT_EQ(addresses[i], address);
}
}
diff --git a/src/lib/dhcp/tests/option_data_types_unittest.cc b/src/lib/dhcp/tests/option_data_types_unittest.cc
index 717a330..a6a33b2 100644
--- a/src/lib/dhcp/tests/option_data_types_unittest.cc
+++ b/src/lib/dhcp/tests/option_data_types_unittest.cc
@@ -93,7 +93,7 @@ TEST_F(OptionDataTypesTest, readAddress) {
// Check that the read address matches address that
// we used as input.
- EXPECT_EQ(address.toText(), address_out.toText());
+ EXPECT_EQ(address, address_out);
// Check that an attempt to read the buffer as IPv6 address
// causes an error as the IPv6 address needs at least 16 bytes
@@ -109,7 +109,7 @@ TEST_F(OptionDataTypesTest, readAddress) {
address = asiolink::IOAddress("2001:db8:1:0::1");
writeAddress(address, buf);
EXPECT_NO_THROW(address_out = OptionDataTypeUtil::readAddress(buf, AF_INET6));
- EXPECT_EQ(address.toText(), address_out.toText());
+ EXPECT_EQ(address, address_out);
// Truncate the buffer and expect an error to be reported when
// trying to read it.
diff --git a/src/lib/dhcp/tests/pkt4_unittest.cc b/src/lib/dhcp/tests/pkt4_unittest.cc
index b1bb852..edff356 100644
--- a/src/lib/dhcp/tests/pkt4_unittest.cc
+++ b/src/lib/dhcp/tests/pkt4_unittest.cc
@@ -316,10 +316,10 @@ TEST_F(Pkt4Test, fixedFields) {
EXPECT_EQ(dummySecs, pkt->getSecs());
EXPECT_EQ(dummyFlags, pkt->getFlags());
- EXPECT_EQ(dummyCiaddr.toText(), pkt->getCiaddr().toText());
- EXPECT_EQ(dummyYiaddr.toText(), pkt->getYiaddr().toText());
- EXPECT_EQ(dummySiaddr.toText(), pkt->getSiaddr().toText());
- EXPECT_EQ(dummyGiaddr.toText(), pkt->getGiaddr().toText());
+ EXPECT_EQ(dummyCiaddr, pkt->getCiaddr());
+ EXPECT_EQ(dummyYiaddr, pkt->getYiaddr());
+ EXPECT_EQ(dummySiaddr, pkt->getSiaddr());
+ EXPECT_EQ(dummyGiaddr, pkt->getGiaddr());
// Chaddr contains link-layer addr (MAC). It is no longer always 16 bytes
// long and its length depends on hlen value (it is up to 16 bytes now).
@@ -382,10 +382,10 @@ TEST_F(Pkt4Test, fixedFieldsUnpack) {
EXPECT_EQ(dummySecs, pkt->getSecs());
EXPECT_EQ(dummyFlags, pkt->getFlags());
- EXPECT_EQ(dummyCiaddr.toText(), pkt->getCiaddr().toText());
- EXPECT_EQ(string("1.2.3.4"), pkt->getYiaddr().toText());
- EXPECT_EQ(string("192.0.2.255"), pkt->getSiaddr().toText());
- EXPECT_EQ(string("255.255.255.255"), pkt->getGiaddr().toText());
+ EXPECT_EQ(dummyCiaddr, pkt->getCiaddr());
+ EXPECT_EQ("1.2.3.4", pkt->getYiaddr().toText());
+ EXPECT_EQ("192.0.2.255", pkt->getSiaddr().toText());
+ EXPECT_EQ("255.255.255.255", pkt->getGiaddr().toText());
// chaddr is always 16 bytes long and contains link-layer addr (MAC)
EXPECT_EQ(0, memcmp(dummyChaddr, &pkt->getHWAddr()->hwaddr_[0], dummyHlen));
diff --git a/src/lib/dhcp/tests/protocol_util_unittest.cc b/src/lib/dhcp/tests/protocol_util_unittest.cc
index 199ca27..971eb7f 100644
--- a/src/lib/dhcp/tests/protocol_util_unittest.cc
+++ b/src/lib/dhcp/tests/protocol_util_unittest.cc
@@ -359,7 +359,7 @@ TEST(ProtocolUtilTest, writeIpUdpHeader) {
in_buf.readData(src_addr_data, 4);
src_addr = IOAddress::fromBytes(AF_INET, src_addr_data);
);
- EXPECT_EQ(IOAddress("192.0.2.1").toText(), src_addr.toText());
+ EXPECT_EQ(IOAddress("192.0.2.1"), src_addr);
// Validate destination address.
IOAddress dest_addr("::1");
@@ -368,7 +368,7 @@ TEST(ProtocolUtilTest, writeIpUdpHeader) {
in_buf.readData(dest_addr_data, 4);
dest_addr = IOAddress::fromBytes(AF_INET, dest_addr_data);
);
- EXPECT_EQ(IOAddress("192.0.2.111").toText(), dest_addr.toText());
+ EXPECT_EQ(IOAddress("192.0.2.111"), dest_addr);
// UDP header starts here.
diff --git a/src/lib/dhcp_ddns/ncr_msg.cc b/src/lib/dhcp_ddns/ncr_msg.cc
index 13bc5bc..ae1816f 100644
--- a/src/lib/dhcp_ddns/ncr_msg.cc
+++ b/src/lib/dhcp_ddns/ncr_msg.cc
@@ -611,7 +611,7 @@ NameChangeRequest::toText() const {
<< "Reverse Change: " << (reverse_change_ ? "yes" : "no")
<< std::endl
<< "FQDN: [" << fqdn_ << "]" << std::endl
- << "IP Address: [" << ip_io_address_.toText() << "]" << std::endl
+ << "IP Address: [" << ip_io_address_ << "]" << std::endl
<< "DHCID: [" << dhcid_.toStr() << "]" << std::endl
<< "Lease Expires On: " << getLeaseExpiresOnStr() << std::endl
<< "Lease Length: " << lease_length_ << std::endl;
diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc
index dd1481e..37f2fdf 100644
--- a/src/lib/dhcpsrv/alloc_engine.cc
+++ b/src/lib/dhcpsrv/alloc_engine.cc
@@ -90,7 +90,7 @@ AllocEngine::IterativeAllocator::increasePrefix(const isc::asiolink::IOAddress&
const uint8_t prefix_len) {
if (!prefix.isV6()) {
isc_throw(BadValue, "Prefix operations are for IPv6 only (attempted to "
- "increase prefix " << prefix.toText() << ")");
+ "increase prefix " << prefix << ")");
}
// Get a buffer holding an address.
diff --git a/src/lib/dhcpsrv/lease.cc b/src/lib/dhcpsrv/lease.cc
index 4ca6a3c..a15d300 100644
--- a/src/lib/dhcpsrv/lease.cc
+++ b/src/lib/dhcpsrv/lease.cc
@@ -175,7 +175,7 @@ Lease6::toText() const {
stream << "Type: " << typeToText(type_) << "("
<< static_cast<int>(type_) << ") ";
- stream << "Address: " << addr_.toText() << "\n"
+ stream << "Address: " << addr_ << "\n"
<< "Prefix length: " << static_cast<int>(prefixlen_) << "\n"
<< "IAID: " << iaid_ << "\n"
<< "Pref life: " << preferred_lft_ << "\n"
@@ -190,7 +190,7 @@ std::string
Lease4::toText() const {
ostringstream stream;
- stream << "Address: " << addr_.toText() << "\n"
+ stream << "Address: " << addr_ << "\n"
<< "Valid life: " << valid_lft_ << "\n"
<< "T1: " << t1_ << "\n"
<< "T2: " << t2_ << "\n"
diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc
index dbc3bdd..c6c9c9f 100644
--- a/src/lib/dhcpsrv/memfile_lease_mgr.cc
+++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc
@@ -247,7 +247,7 @@ Memfile_LeaseMgr::updateLease4(const Lease4Ptr& lease) {
Lease4Storage::iterator lease_it = storage4_.find(lease->addr_);
if (lease_it == storage4_.end()) {
isc_throw(NoSuchLease, "failed to update the lease with address "
- << lease->addr_.toText() << " - no such lease");
+ << lease->addr_ << " - no such lease");
}
**lease_it = *lease;
}
@@ -260,7 +260,7 @@ Memfile_LeaseMgr::updateLease6(const Lease6Ptr& lease) {
Lease6Storage::iterator lease_it = storage6_.find(lease->addr_);
if (lease_it == storage6_.end()) {
isc_throw(NoSuchLease, "failed to update the lease with address "
- << lease->addr_.toText() << " - no such lease");
+ << lease->addr_ << " - no such lease");
}
**lease_it = *lease;
}
diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc
index 623440b..c006bbf 100644
--- a/src/lib/dhcpsrv/mysql_lease_mgr.cc
+++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc
@@ -1809,12 +1809,12 @@ MySqlLeaseMgr::updateLeaseCommon(StatementIndex stindex, MYSQL_BIND* bind,
int affected_rows = mysql_stmt_affected_rows(statements_[stindex]);
if (affected_rows == 0) {
isc_throw(NoSuchLease, "unable to update lease for address " <<
- lease->addr_.toText() << " as it does not exist");
+ lease->addr_ << " as it does not exist");
} else if (affected_rows > 1) {
// Should not happen - primary key constraint should only have selected
// one row.
isc_throw(DbOperationError, "apparently updated more than one lease "
- "that had the address " << lease->addr_.toText());
+ "that had the address " << lease->addr_);
}
}
diff --git a/src/lib/dhcpsrv/pool.cc b/src/lib/dhcpsrv/pool.cc
index f1ba871..d9c3da0 100644
--- a/src/lib/dhcpsrv/pool.cc
+++ b/src/lib/dhcpsrv/pool.cc
@@ -34,8 +34,8 @@ bool Pool::inRange(const isc::asiolink::IOAddress& addr) const {
std::string
Pool::toText() const {
std::stringstream tmp;
- tmp << "type=" << Lease::typeToText(type_) << ", " << first_.toText()
- << "-" << last_.toText();
+ tmp << "type=" << Lease::typeToText(type_) << ", " << first_
+ << "-" << last_;
return (tmp.str());
}
@@ -143,8 +143,8 @@ Pool6::Pool6(Lease::Type type, const isc::asiolink::IOAddress& prefix,
std::string
Pool6::toText() const {
std::stringstream tmp;
- tmp << "type=" << Lease::typeToText(type_) << ", " << first_.toText()
- << "-" << last_.toText() << ", delegated_len="
+ tmp << "type=" << Lease::typeToText(type_) << ", " << first_
+ << "-" << last_ << ", delegated_len="
<< static_cast<int>(prefix_len_);
return (tmp.str());
}
diff --git a/src/lib/dhcpsrv/subnet.cc b/src/lib/dhcpsrv/subnet.cc
index 56ed105..0134d8c 100644
--- a/src/lib/dhcpsrv/subnet.cc
+++ b/src/lib/dhcpsrv/subnet.cc
@@ -165,7 +165,7 @@ void Subnet::setLastAllocated(Lease::Type type,
std::string
Subnet::toText() const {
std::stringstream tmp;
- tmp << prefix_.toText() << "/" << static_cast<unsigned int>(prefix_len_);
+ tmp << prefix_ << "/" << static_cast<unsigned int>(prefix_len_);
return (tmp.str());
}
@@ -190,7 +190,7 @@ Subnet4::Subnet4(const isc::asiolink::IOAddress& prefix, uint8_t length,
void Subnet4::setSiaddr(const isc::asiolink::IOAddress& siaddr) {
if (!siaddr.isV4()) {
isc_throw(BadValue, "Can't set siaddr to non-IPv4 address "
- << siaddr.toText());
+ << siaddr);
}
siaddr_ = siaddr;
}
@@ -266,9 +266,8 @@ Subnet::addPool(const PoolPtr& pool) {
IOAddress last_addr = pool->getLastAddress();
if (!inRange(first_addr) || !inRange(last_addr)) {
- isc_throw(BadValue, "Pool (" << first_addr.toText() << "-"
- << last_addr.toText()
- << " does not belong in this (" << prefix_.toText() << "/"
+ isc_throw(BadValue, "Pool (" << first_addr << "-" << last_addr
+ << " does not belong in this (" << prefix_ << "/"
<< static_cast<int>(prefix_len_) << ") subnet");
}
@@ -335,7 +334,7 @@ Subnet6::Subnet6(const isc::asiolink::IOAddress& prefix, uint8_t length,
:Subnet(prefix, length, t1, t2, valid_lifetime),
preferred_(preferred_lifetime){
if (!prefix.isV6()) {
- isc_throw(BadValue, "Non IPv6 prefix " << prefix.toText()
+ isc_throw(BadValue, "Non IPv6 prefix " << prefix
<< " specified in subnet6");
}
}
diff --git a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
index 8f952b4..8a37915 100644
--- a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
+++ b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
@@ -281,10 +281,10 @@ public:
ASSERT_TRUE(lease);
// Allocated address must be different
- EXPECT_NE(used_addr.toText(), lease->addr_.toText());
+ EXPECT_NE(used_addr, lease->addr_);
// We should NOT get what we asked for, because it is used already
- EXPECT_NE(requested.toText(), lease->addr_.toText());
+ EXPECT_NE(requested, lease->addr_);
// Do all checks on the lease
checkLease6(lease, type, expected_pd_len);
@@ -325,7 +325,7 @@ public:
ASSERT_TRUE(lease);
// We should NOT get what we asked for, because it is used already
- EXPECT_NE(hint.toText(), lease->addr_.toText());
+ EXPECT_NE(hint, lease->addr_);
// Do all checks on the lease
checkLease6(lease, type, expected_pd_len);
@@ -476,7 +476,7 @@ TEST_F(AllocEngine6Test, allocWithValidHint6) {
false);
// We should get what we asked for
- EXPECT_EQ(lease->addr_.toText(), "2001:db8:1::15");
+ EXPECT_EQ("2001:db8:1::15", lease->addr_.toText());
}
// This test checks if the address allocation with a hint that is in range,
@@ -864,7 +864,7 @@ TEST_F(AllocEngine6Test, solicitReuseExpiredLease6) {
CalloutHandlePtr())));
// Check that we got that single lease
ASSERT_TRUE(lease);
- EXPECT_EQ(addr.toText(), lease->addr_.toText());
+ EXPECT_EQ(addr, lease->addr_);
// Do all checks on the lease (if subnet-id, preferred/valid times are ok etc.)
checkLease6(lease, Lease::TYPE_NA, 128);
@@ -876,7 +876,7 @@ TEST_F(AllocEngine6Test, solicitReuseExpiredLease6) {
// Check that we got that single lease
ASSERT_TRUE(lease);
- EXPECT_EQ(addr.toText(), lease->addr_.toText());
+ EXPECT_EQ(addr, lease->addr_);
}
// This test checks if an expired lease can be reused in REQUEST (actual allocation)
@@ -912,7 +912,7 @@ TEST_F(AllocEngine6Test, requestReuseExpiredLease6) {
// Check that he got that single lease
ASSERT_TRUE(lease);
- EXPECT_EQ(addr.toText(), lease->addr_.toText());
+ EXPECT_EQ(addr, lease->addr_);
// Check that the lease is indeed updated in LeaseMgr
Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA,
@@ -1075,10 +1075,10 @@ TEST_F(AllocEngine4Test, allocWithUsedHint4) {
ASSERT_TRUE(lease);
// Allocated address must be different
- EXPECT_TRUE(used->addr_.toText() != lease->addr_.toText());
+ EXPECT_NE(used->addr_, lease->addr_);
// We should NOT get what we asked for, because it is used already
- EXPECT_TRUE(lease->addr_.toText() != "192.0.2.106");
+ EXPECT_NE("192.0.2.106", lease->addr_.toText());
// Do all checks on the lease
checkLease4(lease);
@@ -1115,7 +1115,7 @@ TEST_F(AllocEngine4Test, allocBogusHint4) {
EXPECT_FALSE(old_lease_);
// We should NOT get what we asked for, because it is used already
- EXPECT_TRUE(lease->addr_.toText() != "10.1.1.1");
+ EXPECT_NE("10.1.1.1", lease->addr_.toText());
// Do all checks on the lease
checkLease4(lease);
@@ -1371,7 +1371,7 @@ TEST_F(AllocEngine4Test, discoverReuseExpiredLease4) {
old_lease_);
// Check that we got that single lease
ASSERT_TRUE(lease);
- EXPECT_EQ(addr.toText(), lease->addr_.toText());
+ EXPECT_EQ(addr, lease->addr_);
// We are reusing expired lease, the old (expired) instance should be
// returned. The returned instance should be the same as the original
@@ -1384,13 +1384,13 @@ TEST_F(AllocEngine4Test, discoverReuseExpiredLease4) {
// CASE 2: Asking specifically for this address
lease = engine->allocateLease4(subnet_, clientid_, hwaddr_,
- IOAddress(addr.toText()),
+ IOAddress(addr),
false, false, "",
true, CalloutHandlePtr(),
old_lease_);
// Check that we got that single lease
ASSERT_TRUE(lease);
- EXPECT_EQ(addr.toText(), lease->addr_.toText());
+ EXPECT_EQ(addr, lease->addr_);
// We are updating expired lease. The copy of the old lease should be
// returned and it should be equal to the original lease.
@@ -1425,14 +1425,14 @@ TEST_F(AllocEngine4Test, requestReuseExpiredLease4) {
// A client comes along, asking specifically for this address
lease = engine->allocateLease4(subnet_, clientid_, hwaddr_,
- IOAddress(addr.toText()),
+ IOAddress(addr),
false, true, "host.example.com.",
false, CalloutHandlePtr(),
old_lease_);
// Check that he got that single lease
ASSERT_TRUE(lease);
- EXPECT_EQ(addr.toText(), lease->addr_.toText());
+ EXPECT_EQ(addr, lease->addr_);
// Check that the lease is indeed updated in LeaseMgr
Lease4Ptr from_mgr = LeaseMgrFactory::instance().getLease4(addr);
@@ -1481,7 +1481,7 @@ TEST_F(AllocEngine4Test, renewLease4) {
callout_handle, false);
// Check that he got that single lease
ASSERT_TRUE(lease);
- EXPECT_EQ(addr.toText(), lease->addr_.toText());
+ EXPECT_EQ(addr, lease->addr_);
// Check that the lease matches subnet_, hwaddr_,clientid_ parameters
checkLease4(lease);
diff --git a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
index 5712604..6570750 100644
--- a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
@@ -95,7 +95,7 @@ TEST_F(MemfileLeaseMgrTest, addGetDelete6) {
IOAddress("2001:db8:1::456"));
ASSERT_TRUE(x);
- EXPECT_EQ(x->addr_.toText(), addr.toText());
+ EXPECT_EQ(x->addr_, addr);
EXPECT_TRUE(*x->duid_ == *duid);
EXPECT_EQ(x->iaid_, iaid);
EXPECT_EQ(x->subnet_id_, subnet_id);
@@ -114,7 +114,7 @@ TEST_F(MemfileLeaseMgrTest, addGetDelete6) {
ASSERT_TRUE(y);
EXPECT_TRUE(*y->duid_ == *duid);
EXPECT_EQ(y->iaid_, iaid);
- EXPECT_EQ(y->addr_.toText(), addr.toText());
+ EXPECT_EQ(y->addr_, addr);
// Test getLease6(duid, iaid, subnet_id) - wrong iaid
uint32_t invalid_iaid = 9; // no such iaid
diff --git a/src/lib/dhcpsrv/tests/test_utils.cc b/src/lib/dhcpsrv/tests/test_utils.cc
index e418c62..44d60ea 100644
--- a/src/lib/dhcpsrv/tests/test_utils.cc
+++ b/src/lib/dhcpsrv/tests/test_utils.cc
@@ -48,7 +48,7 @@ detailCompareLease(const Lease4Ptr& first, const Lease4Ptr& second) {
// odd things happen when they are different: the EXPECT_EQ macro appears to
// call the operator uint32_t() function, which causes an exception to be
// thrown for IPv6 addresses.
- EXPECT_EQ(first->addr_.toText(), second->addr_.toText());
+ EXPECT_EQ(first->addr_, second->addr_);
EXPECT_TRUE(first->hwaddr_ == second->hwaddr_);
if (first->client_id_ && second->client_id_) {
EXPECT_TRUE(*first->client_id_ == *second->client_id_);
@@ -83,7 +83,7 @@ detailCompareLease(const Lease6Ptr& first, const Lease6Ptr& second) {
// odd things happen when they are different: the EXPECT_EQ macro appears to
// call the operator uint32_t() function, which causes an exception to be
// thrown for IPv6 addresses.
- EXPECT_EQ(first->addr_.toText(), second->addr_.toText());
+ EXPECT_EQ(first->addr_, second->addr_);
EXPECT_EQ(first->prefixlen_, second->prefixlen_);
EXPECT_EQ(first->iaid_, second->iaid_);
ASSERT_TRUE(first->duid_);
More information about the bind10-changes
mailing list