]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3539] Address review comments.
authorMarcin Siodelski <marcin@isc.org>
Mon, 22 Dec 2014 11:24:07 +0000 (12:24 +0100)
committerMarcin Siodelski <marcin@isc.org>
Mon, 22 Dec 2014 11:24:07 +0000 (12:24 +0100)
src/bin/dhcp4/tests/config_parser_unittest.cc
src/lib/dhcp/iface_mgr.cc
src/lib/dhcp/tests/iface_mgr_test_config.h
src/lib/dhcpsrv/cfg_iface.cc
src/lib/dhcpsrv/cfg_iface.h
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/tests/cfg_iface_unittest.cc

index fe208ad13a1de68eb9a1cc0ae7e39571c0ce128a..f5f8ed9d0500b7a932cfc26c4662cff236d2c898 100644 (file)
@@ -3031,9 +3031,12 @@ TEST_F(Dhcp4ParserTest, selectedInterfacesAndAddresses) {
     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"));
 }
 
index 0e27a8268192a3e5c5c55d7f7db483e2f9a29a44..4bf8574098fed9a7f858f89221c9879de50fe159 100644 (file)
@@ -514,7 +514,7 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast,
              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;
             }
index 582f1c6db054d07cf58117d45a120dae184eddf1..cd6259f9dc3746167b646450f62fb17989308fec 100644 (file)
@@ -241,7 +241,7 @@ public:
     /// @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.
     ///
index cbe1ef3b438f82268d3da6ee8c10a16c3a095323..3c29ee4437eddf904c1403abd90a76220cfc36d4 100644 (file)
@@ -79,7 +79,7 @@ CfgIface::openSockets(const uint16_t family, const uint16_t port,
 
                 // Otherwise, activate first one.
                 } else {
-                    IOAddress address("0.0.0.0");
+                    IOAddress address(0);
                     if (iface->getAddress4(address)) {
                         iface->setActive(address, true);
                     }
@@ -251,7 +251,7 @@ CfgIface::use(const uint16_t family, const std::string& iface_name) {
         // 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");
             }
@@ -287,7 +287,7 @@ CfgIface::use(const uint16_t family, const std::string& iface_name) {
         }
 
         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 {
index c88fa0bbf730f000da4103064b4874e43bc49830..bf3113b008ad4cc30a64e837ce0093995bb79a1c 100644 (file)
@@ -12,8 +12,8 @@
 // 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>
@@ -209,4 +209,4 @@ private:
 }
 }
 
-#endif // IFACE_CFG_H
+#endif // CFG_IFACE_H
index 0ce79407282bf68f2ceac4d4db6ebc64ee7b0907..96b5e5e2640afda9c25e5f56861a0e033d71b984 100644 (file)
@@ -58,9 +58,6 @@ available sooner.
 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
@@ -143,9 +140,13 @@ receive unicast traffic. The warning message is issued because it is an
 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
index 457a2669521554d6f41a75e37fa7c90ac3aaf992..a0f62833fa301f12ee831a7328ef8ad3468b20ac 100644 (file)
@@ -283,10 +283,6 @@ TEST_F(CfgIfaceTest, invalidValues) {
     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);