Browse Source

[1959] Added couple @todos for postponed things during review, part 1.

Tomek Mrugalski 12 years ago
parent
commit
10cf1a64da
3 changed files with 14 additions and 3 deletions
  1. 9 3
      src/lib/dhcp/iface_mgr.cc
  2. 2 0
      src/lib/dhcp/iface_mgr.h
  3. 3 0
      src/lib/dhcp/option.h

+ 9 - 3
src/lib/dhcp/iface_mgr.cc

@@ -498,11 +498,15 @@ IfaceMgr::getLocalAddress(const IOAddress& remote_addr, const uint16_t port) {
     asio::error_code err_code;
     // If remote address is broadcast address we have to
     // allow this on the socket.
-    if (remote_addr.getAddress().is_v4() && 
+    if (remote_addr.getAddress().is_v4() &&
         (remote_addr == IOAddress("255.255.255.255"))) {
         // Socket has to be open prior to setting the broadcast
         // option. Otherwise set_option will complain about
         // bad file descriptor.
+
+        // @todo: We don't specify interface in any way here. 255.255.255.255
+        // We can very easily end up with a socket working on a different
+        // interface.
         sock.open(asio::ip::udp::v4(), err_code);
         if (err_code) {
             isc_throw(Unexpected, "failed to open UDPv4 socket");
@@ -580,8 +584,10 @@ int IfaceMgr::openSocket6(Iface& iface, const IOAddress& addr, uint16_t port) {
     struct sockaddr_in6 addr6;
     memset(&addr6, 0, sizeof(addr6));
     addr6.sin6_family = AF_INET6;
-    addr6.sin6_port = htons(port);    if (addr.toText() != "::1")
-      addr6.sin6_scope_id = if_nametoindex(iface.getName().c_str());
+    addr6.sin6_port = htons(port);
+    if (addr.toText() != "::1") {
+        addr6.sin6_scope_id = if_nametoindex(iface.getName().c_str());
+    }
 
     memcpy(&addr6.sin6_addr,
            addr.getAddress().to_v6().to_bytes().data(),

+ 2 - 0
src/lib/dhcp/iface_mgr.h

@@ -72,8 +72,10 @@ public:
     };
 
     /// type that holds a list of socket informations
+    /// @todo: Add SocketCollectionConstIter type
     typedef std::list<SocketInfo> SocketCollection;
 
+
     /// @brief represents a single network interface
     ///
     /// Iface structure represents network interface with all useful

+ 3 - 0
src/lib/dhcp/option.h

@@ -63,6 +63,9 @@ public:
     /// @param type option type
     /// @param buf pointer to a buffer
     ///
+    /// @todo Passing a separate buffer for each option means that a copy
+    ///       was done. We can avoid it by passing 2 iterators.
+    ///
     /// @return a pointer to a created option object
     typedef OptionPtr Factory(Option::Universe u, uint16_t type, const OptionBuffer& buf);