BIND 10 master, updated. 1f77f60db465b53342d88b4280b1889f1888b411 [master] put doxy back in .cc for #1186 to handle

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Oct 7 11:12:42 UTC 2011


The branch, master has been updated
       via  1f77f60db465b53342d88b4280b1889f1888b411 (commit)
       via  7ae9a73236a4bb7eed9f02b30563b7f4e040863f (commit)
       via  b8d12c83236964f6bbb5cd3910b0960abd0117c1 (commit)
      from  a3c0c4cffe519c5d70185ec989fe707102a71836 (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 1f77f60db465b53342d88b4280b1889f1888b411
Author: Jelte Jansen <jelte at isc.org>
Date:   Fri Oct 7 13:05:45 2011 +0200

    [master] put doxy back in .cc for #1186 to handle

commit 7ae9a73236a4bb7eed9f02b30563b7f4e040863f
Author: Jelte Jansen <jelte at isc.org>
Date:   Fri Oct 7 12:55:01 2011 +0200

    [master] typo in doxygen (and moved to header)
    
    reported by stephen, discussed on jabber

commit b8d12c83236964f6bbb5cd3910b0960abd0117c1
Author: Jelte Jansen <jelte at isc.org>
Date:   Fri Oct 7 11:06:04 2011 +0200

    [master] fix for strict aliasing problem
    
    Don't really need sockaddr_storage if we only do v6. Also added a few consts to caught exceptions

-----------------------------------------------------------------------

Summary of changes:
 src/bin/dhcp6/iface_mgr.cc |   34 ++++++++++++++--------------------
 1 files changed, 14 insertions(+), 20 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/dhcp6/iface_mgr.cc b/src/bin/dhcp6/iface_mgr.cc
index 7998d28..1e2551a 100644
--- a/src/bin/dhcp6/iface_mgr.cc
+++ b/src/bin/dhcp6/iface_mgr.cc
@@ -35,7 +35,7 @@ void
 IfaceMgr::instanceCreate() {
     if (instance_) {
         // no need to do anything. Instance is already created.
-        // Who called it again anyway? Uh oh. Had to be us, as 
+        // Who called it again anyway? Uh oh. Had to be us, as
         // this is private method.
         return;
     }
@@ -91,7 +91,7 @@ IfaceMgr::IfaceMgr() {
         if (!openSockets()) {
             isc_throw(Unexpected, "Failed to open/bind sockets.");
         }
-    } catch (std::exception& ex) {
+    } catch (const std::exception& ex) {
         cout << "IfaceMgr creation failed:" << ex.what() << endl;
 
         // TODO Uncomment this (or call LOG_FATAL) once
@@ -138,7 +138,7 @@ IfaceMgr::detectIfaces() {
         iface.addrs_.push_back(addr);
         ifaces_.push_back(iface);
         interfaces.close();
-    } catch (std::exception& ex) {
+    } catch (const std::exception& ex) {
         // TODO: deallocate whatever memory we used
         // not that important, since this function is going to be
         // thrown away as soon as we get proper interface detection
@@ -227,7 +227,7 @@ IfaceMgr::getIface(const std::string& ifname) {
 
 
 /**
- * Opens UDP/IPv6 socket and binds it to specific address, interface nad port.
+ * Opens UDP/IPv6 socket and binds it to specific address, interface and port.
  *
  * @param ifname name of the interface
  * @param addr address to be bound.
@@ -241,27 +241,22 @@ int
 IfaceMgr::openSocket(const std::string& ifname,
                      const IOAddress& addr,
                      int port) {
-    struct sockaddr_storage name;
-    int name_len;
-    struct sockaddr_in6 *addr6;
+    struct sockaddr_in6 addr6;
 
     cout << "Creating socket on " << ifname << "/" << addr.toText()
          << "/port=" << port << endl;
 
-    memset(&name, 0, sizeof(name));
-    addr6 = (struct sockaddr_in6 *)&name;
-    addr6->sin6_family = AF_INET6;
-    addr6->sin6_port = htons(port);
-    addr6->sin6_scope_id = if_nametoindex(ifname.c_str());
+    memset(&addr6, 0, sizeof(addr6));
+    addr6.sin6_family = AF_INET6;
+    addr6.sin6_port = htons(port);
+    addr6.sin6_scope_id = if_nametoindex(ifname.c_str());
 
-    memcpy(&addr6->sin6_addr,
+    memcpy(&addr6.sin6_addr,
            addr.getAddress().to_v6().to_bytes().data(),
-           sizeof(addr6->sin6_addr));
-
+           sizeof(addr6.sin6_addr));
 #ifdef HAVE_SA_LEN
-    addr6->sin6_len = sizeof(*addr6);
+    addr6->sin6_len = sizeof(addr6);
 #endif
-    name_len = sizeof(*addr6);
 
     // TODO: use sockcreator once it becomes available
 
@@ -282,13 +277,12 @@ IfaceMgr::openSocket(const std::string& ifname,
         return (-1);
     }
 
-    if (bind(sock, (struct sockaddr *)&name, name_len) < 0) {
+    if (bind(sock, (struct sockaddr *)&addr6, sizeof(addr6)) < 0) {
         cout << "Failed to bind socket " << sock << " to " << addr.toText()
              << "/port=" << port << endl;
         close(sock);
         return (-1);
     }
-
 #ifdef IPV6_RECVPKTINFO
     /* RFC3542 - a new way */
     if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO,
@@ -476,7 +470,7 @@ IfaceMgr::receive() {
         // during reception (see iov_len below), so we are
         // safe
         pkt = new Pkt6(65536);
-    } catch (std::exception& ex) {
+    } catch (const std::exception& ex) {
         cout << "Failed to create new packet." << endl;
         return (0);
     }




More information about the bind10-changes mailing list