BIND 10 master, updated. 6ab70c0a6b695f23987fa38de47aeec1d56f97af [master] ChangeLog updated after #1485 merge.
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Feb 5 11:45:11 UTC 2014
The branch, master has been updated
via 6ab70c0a6b695f23987fa38de47aeec1d56f97af (commit)
via ecdb62db16b3f3d447db4a9d2a4079d5260431f0 (commit)
via 7aa18afc3a7ef40af3b1772c79d531ed62fc4188 (commit)
via 650d4636d56af1a6b5a329f4522357b914ea99e1 (commit)
via aa415e021bb1f9e0bb7449fbd9e2b52e84b69bd0 (commit)
via 4013083662dc7a9e6445ee7804dd6a0f5a21af01 (commit)
via 0ceb981bb577cb14d0df4c31ac94c44e94402e67 (commit)
from aafa7f654275feaec7258b8434dd845f8400da8a (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 6ab70c0a6b695f23987fa38de47aeec1d56f97af
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Wed Feb 5 11:53:04 2014 +0100
[master] ChangeLog updated after #1485 merge.
commit ecdb62db16b3f3d447db4a9d2a4079d5260431f0
Merge: aafa7f6 7aa18af
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Wed Feb 5 11:48:42 2014 +0100
Merge branch 'trac1485'
commit 7aa18afc3a7ef40af3b1772c79d531ed62fc4188
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Wed Feb 5 11:48:25 2014 +0100
[1485] Minor changes after review:
- IOAddress test renamed
- flipped isV6() with !isV4() in perfdhcp/test_control.cc
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 ++++
src/bin/d2/tests/nc_test_utils.cc | 9 +++++--
src/lib/asiolink/io_address.cc | 21 +++++++++++----
src/lib/asiolink/io_address.h | 18 +++++++------
src/lib/asiolink/tests/io_address_unittest.cc | 35 +++++++++++++++++++++++++
src/lib/dhcp/iface_mgr.cc | 14 +++++-----
src/lib/dhcp_ddns/ncr_udp.cc | 7 +++--
src/lib/dhcpsrv/cfgmgr.cc | 2 +-
src/lib/dhcpsrv/d2_client.cc | 2 +-
tests/tools/perfdhcp/test_control.cc | 7 +++--
10 files changed, 88 insertions(+), 32 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 7871b2f..2a5cf11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+746. [func] tomek
+ IOAddress no longer exposes underlying asio objects. The getAddress()
+ method has been removed and replaced with several convenience methods.
+ (Trac #1485, git ecdb62db16b3f3d447db4a9d2a4079d5260431f0)
+
745. [bug] muks
b10-auth now returns rcode=REFUSED for all questions with
qtype=RRSIG (i.e., where RRSIGs are queried directly). This is
diff --git a/src/bin/d2/tests/nc_test_utils.cc b/src/bin/d2/tests/nc_test_utils.cc
index b65b9e4..a907abe 100644
--- a/src/bin/d2/tests/nc_test_utils.cc
+++ b/src/bin/d2/tests/nc_test_utils.cc
@@ -16,6 +16,8 @@
#include <dns/opcode.h>
#include <dns/messagerenderer.h>
#include <nc_test_utils.h>
+#include <asio.hpp>
+#include <asiolink/udp_endpoint.h>
#include <gtest/gtest.h>
@@ -42,7 +44,9 @@ FauxServer::FauxServer(asiolink::IOService& io_service,
server_socket_.reset(new asio::ip::udp::socket(io_service_.get_io_service(),
asio::ip::udp::v4()));
server_socket_->set_option(asio::socket_base::reuse_address(true));
- server_socket_->bind(asio::ip::udp::endpoint(address_.getAddress(), port_));
+
+ isc::asiolink::UDPEndpoint endpoint(address_, port_);
+ server_socket_->bind(endpoint.getASIOEndpoint());
}
FauxServer::FauxServer(asiolink::IOService& io_service,
@@ -53,7 +57,8 @@ FauxServer::FauxServer(asiolink::IOService& io_service,
server_socket_.reset(new asio::ip::udp::socket(io_service_.get_io_service(),
asio::ip::udp::v4()));
server_socket_->set_option(asio::socket_base::reuse_address(true));
- server_socket_->bind(asio::ip::udp::endpoint(address_.getAddress(), port_));
+ isc::asiolink::UDPEndpoint endpoint(address_, port_);
+ server_socket_->bind(endpoint.getASIOEndpoint());
}
diff --git a/src/lib/asiolink/io_address.cc b/src/lib/asiolink/io_address.cc
index 7986725..6a6ac18 100644
--- a/src/lib/asiolink/io_address.cc
+++ b/src/lib/asiolink/io_address.cc
@@ -100,14 +100,25 @@ IOAddress::getFamily() const {
}
}
-const asio::ip::address&
-IOAddress::getAddress() const {
- return asio_address_;
+bool
+IOAddress::isV6LinkLocal() const {
+ if (!asio_address_.is_v6()) {
+ return (false);
+ }
+ return (asio_address_.to_v6().is_link_local());
+}
+
+bool
+IOAddress::isV6Multicast() const {
+ if (!asio_address_.is_v6()) {
+ return (false);
+ }
+ return (asio_address_.to_v6().is_multicast());
}
IOAddress::operator uint32_t() const {
- if (getAddress().is_v4()) {
- return (getAddress().to_v4().to_ulong());
+ if (asio_address_.is_v4()) {
+ return (asio_address_.to_v4().to_ulong());
} else {
isc_throw(BadValue, "Can't convert " << toText()
<< " address to IPv4.");
diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h
index 53edb35..cb898e3 100644
--- a/src/lib/asiolink/io_address.h
+++ b/src/lib/asiolink/io_address.h
@@ -91,14 +91,6 @@ public:
/// \return A string representation of the address.
std::string toText() const;
- /// \brief Returns const reference to the underlying address object.
- ///
- /// This is useful, when access to interface offerted by
- // asio::ip::address_v4 and asio::ip::address_v6 is beneficial.
- ///
- /// \return A const reference to asio::ip::address object
- const asio::ip::address& getAddress() const;
-
/// \brief Returns the address family
///
/// \return AF_INET for IPv4 or AF_INET6 for IPv6.
@@ -118,6 +110,16 @@ public:
return (asio_address_.is_v6());
}
+ /// \brief checks whether and address is IPv6 and is link-local
+ ///
+ /// \return true if the address is IPv6 link-local, false otherwise
+ bool isV6LinkLocal() const;
+
+ /// \brief checks whether and address is IPv6 and is multicast
+ ///
+ /// \return true if the address is IPv6 multicast, false otherwise
+ bool isV6Multicast() const;
+
/// \brief Creates an address from over wire data.
///
/// \param family AF_NET for IPv4 or AF_NET6 for IPv6.
diff --git a/src/lib/asiolink/tests/io_address_unittest.cc b/src/lib/asiolink/tests/io_address_unittest.cc
index 5486d5c..221ed5e 100644
--- a/src/lib/asiolink/tests/io_address_unittest.cc
+++ b/src/lib/asiolink/tests/io_address_unittest.cc
@@ -182,3 +182,38 @@ TEST(IOAddressTest, LeftShiftOperator) {
oss << addr;
EXPECT_EQ(addr.toText(), oss.str());
}
+
+// Tests address classification methods (which were previously used by accessing
+// underlying asio objects directly)
+TEST(IOAddressTest, accessClassificationMethods) {
+ IOAddress addr1("192.0.2.5"); // IPv4
+ IOAddress addr2("::"); // IPv6
+ IOAddress addr3("2001:db8::1"); // global IPv6
+ IOAddress addr4("fe80::1234"); // link-local
+ IOAddress addr5("ff02::1:2"); // multicast
+
+ EXPECT_TRUE (addr1.isV4());
+ EXPECT_FALSE(addr1.isV6());
+ EXPECT_FALSE(addr1.isV6LinkLocal());
+ EXPECT_FALSE(addr1.isV6Multicast());
+
+ EXPECT_FALSE(addr2.isV4());
+ EXPECT_TRUE (addr2.isV6());
+ EXPECT_FALSE(addr2.isV6LinkLocal());
+ EXPECT_FALSE(addr2.isV6Multicast());
+
+ EXPECT_FALSE(addr3.isV4());
+ EXPECT_TRUE (addr3.isV6());
+ EXPECT_FALSE(addr3.isV6LinkLocal());
+ EXPECT_FALSE(addr3.isV6Multicast());
+
+ EXPECT_FALSE(addr4.isV4());
+ EXPECT_TRUE (addr4.isV6());
+ EXPECT_TRUE (addr4.isV6LinkLocal());
+ EXPECT_FALSE(addr4.isV6Multicast());
+
+ EXPECT_FALSE(addr5.isV4());
+ EXPECT_TRUE (addr5.isV6());
+ EXPECT_FALSE(addr5.isV6LinkLocal());
+ EXPECT_TRUE (addr5.isV6Multicast());
+}
diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc
index 6a59124..a531134 100644
--- a/src/lib/dhcp/iface_mgr.cc
+++ b/src/lib/dhcp/iface_mgr.cc
@@ -523,7 +523,7 @@ IfaceMgr::openSockets6(const uint16_t port,
// with interface with 2 global addresses, we would bind 3 sockets
// (one for link-local and two for global). That would result in
// getting each message 3 times.
- if (!addr->getAddress().to_v6().is_link_local()){
+ if (!addr->isV6LinkLocal()){
continue;
}
@@ -693,7 +693,7 @@ int IfaceMgr::openSocketFromRemoteAddress(const IOAddress& remote_addr,
const uint16_t port) {
try {
// Get local address to be used to connect to remote location.
- IOAddress local_address(getLocalAddress(remote_addr, port).getAddress());
+ IOAddress local_address(getLocalAddress(remote_addr, port));
return openSocketFromAddress(local_address, port);
} catch (const Exception& e) {
isc_throw(SocketConfigError, e.what());
@@ -1033,7 +1033,7 @@ uint16_t IfaceMgr::getSocket(const isc::dhcp::Pkt6& pkt) {
}
// Sockets bound to multicast address are useless for sending anything.
- if (s->addr_.getAddress().to_v6().is_multicast()) {
+ if (s->addr_.isV6Multicast()) {
continue;
}
@@ -1050,10 +1050,10 @@ uint16_t IfaceMgr::getSocket(const isc::dhcp::Pkt6& pkt) {
// If we want to send something to link-local and the socket is
// bound to link-local or we want to send to global and the socket
// is bound to global, then use it as candidate
- if ( (pkt.getRemoteAddr().getAddress().to_v6().is_link_local() &&
- s->addr_.getAddress().to_v6().is_link_local()) ||
- (!pkt.getRemoteAddr().getAddress().to_v6().is_link_local() &&
- !s->addr_.getAddress().to_v6().is_link_local()) ) {
+ if ( (pkt.getRemoteAddr().isV6LinkLocal() &&
+ s->addr_.isV6LinkLocal()) ||
+ (!pkt.getRemoteAddr().isV6LinkLocal() &&
+ !s->addr_.isV6LinkLocal()) ) {
candidate = s;
}
}
diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc
index 9e83f7c..c69ad93 100644
--- a/src/lib/dhcp_ddns/ncr_udp.cc
+++ b/src/lib/dhcp_ddns/ncr_udp.cc
@@ -94,7 +94,7 @@ NameChangeUDPListener::~NameChangeUDPListener() {
void
NameChangeUDPListener::open(isc::asiolink::IOService& io_service) {
// create our endpoint and bind the the low level socket to it.
- isc::asiolink::UDPEndpoint endpoint(ip_address_.getAddress(), port_);
+ isc::asiolink::UDPEndpoint endpoint(ip_address_, port_);
// Create the low level socket.
try {
@@ -227,7 +227,7 @@ NameChangeUDPSender::~NameChangeUDPSender() {
void
NameChangeUDPSender::open(isc::asiolink::IOService& io_service) {
// create our endpoint and bind the the low level socket to it.
- isc::asiolink::UDPEndpoint endpoint(ip_address_.getAddress(), port_);
+ isc::asiolink::UDPEndpoint endpoint(ip_address_, port_);
// Create the low level socket.
try {
@@ -252,8 +252,7 @@ NameChangeUDPSender::open(isc::asiolink::IOService& io_service) {
// Create the server endpoint
server_endpoint_.reset(new isc::asiolink::
- UDPEndpoint(server_address_.getAddress(),
- server_port_));
+ UDPEndpoint(server_address_, server_port_));
send_callback_->setDataSource(server_endpoint_);
}
diff --git a/src/lib/dhcpsrv/cfgmgr.cc b/src/lib/dhcpsrv/cfgmgr.cc
index 8d41a15..798d508 100644
--- a/src/lib/dhcpsrv/cfgmgr.cc
+++ b/src/lib/dhcpsrv/cfgmgr.cc
@@ -152,7 +152,7 @@ CfgMgr::getSubnet6(const isc::asiolink::IOAddress& hint) {
// configuration. Such requirement makes sense in IPv4, but not in IPv6.
// The server does not need to have a global address (using just link-local
// is ok for DHCPv6 server) from the pool it serves.
- if ((subnets6_.size() == 1) && hint.getAddress().to_v6().is_link_local()) {
+ if ((subnets6_.size() == 1) && hint.isV6LinkLocal()) {
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE,
DHCPSRV_CFGMGR_ONLY_SUBNET6)
.arg(subnets6_[0]->toText()).arg(hint.toText());
diff --git a/src/lib/dhcpsrv/d2_client.cc b/src/lib/dhcpsrv/d2_client.cc
index 419c5ce..494c858 100644
--- a/src/lib/dhcpsrv/d2_client.cc
+++ b/src/lib/dhcpsrv/d2_client.cc
@@ -36,7 +36,7 @@ D2ClientConfig::D2ClientConfig(const bool enable_updates,
const std::string& generated_prefix,
const std::string& qualifying_suffix)
: enable_updates_(enable_updates),
- server_ip_(server_ip.getAddress()),
+ server_ip_(server_ip),
server_port_(server_port),
ncr_protocol_(ncr_protocol),
ncr_format_(ncr_format),
diff --git a/tests/tools/perfdhcp/test_control.cc b/tests/tools/perfdhcp/test_control.cc
index ab56bc3..b317eff 100644
--- a/tests/tools/perfdhcp/test_control.cc
+++ b/tests/tools/perfdhcp/test_control.cc
@@ -777,8 +777,7 @@ TestControl::openSocket() const {
} else if (options.getIpVersion() == 6) {
// If remote address is multicast we need to enable it on
// the socket that has been created.
- asio::ip::address_v6 remote_v6 = remoteaddr.getAddress().to_v6();
- if (remote_v6.is_multicast()) {
+ if (remoteaddr.isV6Multicast()) {
int hops = 1;
int ret = setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
&hops, sizeof(hops));
@@ -1640,7 +1639,7 @@ TestControl::sendRequest4(const TestControlSocket& socket,
/// Set client address.
asiolink::IOAddress yiaddr = offer_pkt4->getYiaddr();
- if (!yiaddr.getAddress().is_v4()) {
+ if (!yiaddr.isV4()) {
isc_throw(BadValue, "the YIADDR returned in OFFER packet is not "
" IPv4 address");
}
@@ -1748,7 +1747,7 @@ TestControl::sendRequest4(const TestControlSocket& socket,
/// Set client address.
asiolink::IOAddress yiaddr = offer_pkt4->getYiaddr();
- if (!yiaddr.getAddress().is_v4()) {
+ if (!yiaddr.isV4()) {
isc_throw(BadValue, "the YIADDR returned in OFFER packet is not "
" IPv4 address");
}
More information about the bind10-changes
mailing list