From: Marcin Siodelski Date: Thu, 16 Jan 2014 15:07:39 +0000 (+0100) Subject: [1283] Use IOAddress << operator in remaining places in DHCP code. X-Git-Tag: bind10-1.2.0beta1-release~132^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1d1e8b67f60e66804663fc9c3e8da4721f08074e;p=thirdparty%2Fkea.git [1283] Use IOAddress << operator in remaining places in DHCP code. --- diff --git a/src/bin/d2/d2_cfg_mgr.cc b/src/bin/d2/d2_cfg_mgr.cc index ef63a0ad94..efa4de5560 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/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc index 71f6467f23..6681cd7cb8 100644 --- a/src/lib/dhcp/iface_mgr.cc +++ b/src/lib/dhcp/iface_mgr.cc @@ -418,7 +418,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) { if (sock < 0) { const char* errstr = strerror(errno); isc_throw(SocketConfigError, "failed to open unicast socket on " - << addr->toText() << " on interface " << iface->getName() + << *addr << " on interface " << iface->getName() << ", reason: " << errstr); } @@ -449,7 +449,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) { if (sock < 0) { const char* errstr = strerror(errno); isc_throw(SocketConfigError, "failed to open link-local socket on " - << addr->toText() << " on interface " + << *addr << " on interface " << iface->getName() << ", reason: " << errstr); } diff --git a/src/lib/dhcp/option6_addrlst.cc b/src/lib/dhcp/option6_addrlst.cc index cb14070527..45c22625ee 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_iaprefix.cc b/src/lib/dhcp/option6_iaprefix.cc index 9acdd88b97..d28b4f7e66 100644 --- a/src/lib/dhcp/option6_iaprefix.cc +++ b/src/lib/dhcp/option6_iaprefix.cc @@ -98,7 +98,7 @@ std::string Option6IAPrefix::toText(int indent /* =0 */) { for (int i=0; igetFullName() << " 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/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index dd1481e9e1..37f2fdfcf3 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/subnet.cc b/src/lib/dhcpsrv/subnet.cc index 3ed23e7614..713def95ef 100644 --- a/src/lib/dhcpsrv/subnet.cc +++ b/src/lib/dhcpsrv/subnet.cc @@ -162,7 +162,7 @@ void Subnet::setLastAllocated(Lease::Type type, std::string Subnet::toText() const { std::stringstream tmp; - tmp << prefix_.toText() << "/" << static_cast(prefix_len_); + tmp << prefix_ << "/" << static_cast(prefix_len_); return (tmp.str()); } @@ -187,7 +187,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; } @@ -264,7 +264,7 @@ Subnet::addPool(const PoolPtr& pool) { if (!inRange(first_addr) || !inRange(last_addr)) { isc_throw(BadValue, "Pool (" << first_addr << "-" << last_addr - << " does not belong in this (" << prefix_.toText() << "/" + << " does not belong in this (" << prefix_ << "/" << static_cast(prefix_len_) << ") subnet"); } @@ -331,7 +331,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"); } }