CfgMgr::instance().getStagingCfg()->
getCfgIface().openSockets(AF_INET, 10000);
- // eth0 and eth1 were explicitly selected. eth2 was not.
+ // An address on eth0 was selected
EXPECT_TRUE(test_config.socketOpen("eth0", "10.0.0.1"));
+ // The 192.0.2.3 address on eth1 was selected.
EXPECT_TRUE(test_config.socketOpen("eth1", "192.0.2.3"));
+ // The 192.0.2.5 was not selected, thus the socket should not
+ // be bound to this address.
EXPECT_FALSE(test_config.socketOpen("eth1", "192.0.2.5"));
}
addr != addrs.end();
++addr) {
- // Skip non-IPv4 addresses and thos that weren't selected..
+ // Skip non-IPv4 addresses and those that weren't selected..
if (!addr->get().isV4() || !addr->isSpecified()) {
continue;
}
/// @param iface_name Interface name.
/// @param address Address to which the socket is bound.
bool socketOpen(const std::string& iface_name,
- const std::string & address) const;
+ const std::string& address) const;
/// @brief Checks if unicast socket is opened on interface.
///
// Otherwise, activate first one.
} else {
- IOAddress address("0.0.0.0");
+ IOAddress address(0);
if (iface->getAddress4(address)) {
iface->setActive(address, true);
}
// Validate V6 address.
if (family == AF_INET6) {
// Check that the address is a valid unicast address.
- if (!addr.isV6() || addr.isV6LinkLocal() || addr.isV6Multicast()) {
+ if (!addr.isV6() || addr.isV6Multicast()) {
isc_throw(InvalidIfaceName, "address '" << addr << "' is not"
" a valid IPv6 unicast address");
}
}
if (family == AF_INET6) {
- LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_ADD_UNICAST)
+ LOG_INFO(dhcpsrv_logger, DHCPSRV_CFGMGR_USE_UNICAST)
.arg(addr.toText()).arg(name);
} else {
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-#ifndef IFACE_CFG_H
-#define IFACE_CFG_H
+#ifndef CFG_IFACE_H
+#define CFG_IFACE_H
#include <asiolink/io_address.h>
#include <map>
}
}
-#endif // IFACE_CFG_H
+#endif // CFG_IFACE_H
An info message issued when new interface is being added to the collection of
interfaces on which server listens to DHCP messages.
-% DHCPSRV_CFGMGR_ADD_UNICAST listening on unicast address %1, on interface %2
-A debug message issued when new configuring DHCP server to listen on unicast
-address on the specific interface.
% DHCPSRV_CFGMGR_ADD_SUBNET4 adding subnet %1
A debug message reported when the DHCP configuration manager is adding the
uncommon use.
% DHCPSRV_CFGMGR_USE_ADDRESS listening on address %1, on interface %2
-A message issued when server is configured to listen on the explicitly specified
+A message issued when the server is configured to listen on the explicitly specified
IP address on the given interface.
+% DHCPSRV_CFGMGR_USE_UNICAST listening on unicast address %1, on interface %2
+An info message issued when new configuring DHCP server to listen on unicast
+address on the specific interface.
+
% DHCPSRV_CLOSE_DB closing currently open %1 database
This is a debug message, issued when the DHCP server closes the currently
open lease database. It is issued at program shutdown and whenever
ASSERT_THROW(cfg.use(AF_INET6, "/2001:db8:1::1"), InvalidIfaceName);
ASSERT_THROW(cfg.use(AF_INET6, "*/2001:db8:1::1"), InvalidIfaceName);
ASSERT_THROW(cfg.use(AF_INET6, "bogus/2001:db8:1::1"), NoSuchIface);
- ASSERT_THROW(cfg.use(AF_INET6, "eth0/fe80::3a60:77ff:fed5:cdef"),
- InvalidIfaceName);
- ASSERT_THROW(cfg.use(AF_INET6, "eth0/fe80::3a60:77ff:fed5:cdef"),
- InvalidIfaceName);
ASSERT_THROW(cfg.use(AF_INET6, "eth0/2001:db8:1::2"), NoSuchAddress);
ASSERT_NO_THROW(cfg.use(AF_INET6, "*"));
ASSERT_THROW(cfg.use(AF_INET6, "*"), DuplicateIfaceName);