Iface* iface = IfaceMgr::instance().getIface("eth0");
ASSERT_FALSE(iface == NULL);
EXPECT_TRUE(iface->hasAddress(IOAddress("10.0.0.1")));
+ EXPECT_FALSE(iface->hasAddress(IOAddress("10.0.0.2")));
EXPECT_TRUE(iface->hasAddress(IOAddress("fe80::3a60:77ff:fed5:cdef")));
EXPECT_TRUE(iface->hasAddress(IOAddress("2001:db8:1::1")));
EXPECT_FALSE(iface->hasAddress(IOAddress("2001:db8:1::2")));
" a valid IPv6 unicast address");
}
+ // There are valid cases where link local address can be specified to
+ // receive unicast traffic, e.g. sent by relay agent.
+ if (addr.isV6LinkLocal()) {
+ LOG_WARN(dhcpsrv_logger, DHCPSRV_CFGMGR_UNICAST_LINK_LOCAL)
+ .arg(addr.toText()).arg(name);
+ }
+
// Interface must have this address assigned.
if (!iface->hasAddress(addr)) {
isc_throw(NoSuchAddress,
/// @brief Protocol family.
Family family_;
+
/// @brief Represents a set of interface names.
typedef std::set<std::string> IfaceSet;
+
/// @brief A set of interface names specified by the user.
IfaceSet iface_set_;
+
/// @brief A map of interfaces and unicast addresses.
typedef std::map<std::string, asiolink::IOAddress> UnicastMap;
+
/// @brief A map which holds the pairs of interface names and unicast
/// addresses for which the unicast sockets should be opened.
///
/// This is only used for V6 family.
UnicastMap unicast_map_;
+
/// @brief A booolean value which indicates that the wildcard interface name
/// has been specified (*).
bool wildcard_used_;
returned the specified IPv6 subnet, because detected relay agent address
matches value specified for this subnet.
+% DHCPSRV_CFGMGR_UNICAST_LINK_LOCAL specified link local address %1 for unicast traffic on interface %2
+This warning message is logged when user specified a link-local address to
+receive unicast traffic. The warning message is issued because it is an
+uncommon use.
+
% 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
// select all interfaces to open IPv4 sockets.
TEST_F(CfgIfaceTest, wildcardV4) {
CfgIface cfg(CfgIface::V4);
- ASSERT_NO_THROW(cfg.use(CfgIface::ALL_IFACES_KEYWORD));
+ ASSERT_NO_THROW(cfg.use("*"));
cfg.openSockets(DHCP4_SERVER_PORT);
// select all interfaces to open IPv6 sockets.
TEST_F(CfgIfaceTest, wildcardV6) {
CfgIface cfg(CfgIface::V6);
- ASSERT_NO_THROW(cfg.use(CfgIface::ALL_IFACES_KEYWORD));
+ ASSERT_NO_THROW(cfg.use("*"));
cfg.openSockets(DHCP4_SERVER_PORT);
ASSERT_THROW(cfg.use("eth0/fe80::3a60:77ff:fed5:cdef"), InvalidIfaceName);
ASSERT_THROW(cfg.use("eth0/2001:db8:1::2"), NoSuchAddress);
- ASSERT_NO_THROW(cfg.use(CfgIface::ALL_IFACES_KEYWORD));
- ASSERT_THROW(cfg.use(CfgIface::ALL_IFACES_KEYWORD), DuplicateIfaceName);
+ ASSERT_NO_THROW(cfg.use("*"));
+ ASSERT_THROW(cfg.use("*"), DuplicateIfaceName);
}
} // end of anonymous namespace