[svn] commit: r1130 - /trunk/src/bin/auth/main.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Mar 5 17:26:06 UTC 2010


Author: each
Date: Fri Mar  5 17:26:06 2010
New Revision: 1130

Log:
- set IPV6_V6ONLY socket option
- a few other dual-stack fixes

Modified:
    trunk/src/bin/auth/main.cc

Modified: trunk/src/bin/auth/main.cc
==============================================================================
--- trunk/src/bin/auth/main.cc (original)
+++ trunk/src/bin/auth/main.cc Fri Mar  5 17:26:06 2010
@@ -104,6 +104,13 @@
     if (s < 0) {
         cerr << "failed to open socket" << endl;
         return (-1);
+    }
+
+    if (af == AF_INET6) {
+        int on = 1;
+        if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
+            cerr << "couldn't set IPV6_V6ONLY socket option" << endl;
+        }
     }
 
     if (bind(s, res->ai_addr, res->ai_addrlen) < 0) {
@@ -147,7 +154,7 @@
         cerr << "-4 and -6 can't coexist" << endl;
         usage();
     }
-    if (!ipv4_only) {
+    if (!ipv6_only) {
         ps4 = getSocket(AF_INET, port);
         if (ps4 < 0) {
             exit(1);
@@ -200,13 +207,17 @@
                 throw FatalError("select error");
             }
 
-            if (FD_ISSET(ps4, &fds)) {
-                ++counter;
-                auth_server->processMessage(ps4);
-            }
-            if (FD_ISSET(ps6, &fds)) {
-                ++counter;
-                auth_server->processMessage(ps6);
+            if (ps4 >= 0) {
+                if (FD_ISSET(ps4, &fds)) {
+                    ++counter;
+                    auth_server->processMessage(ps4);
+                }
+            }
+            if (ps6 >= 0) {
+                if (FD_ISSET(ps6, &fds)) {
+                    ++counter;
+                    auth_server->processMessage(ps6);
+                }
             }
     
             if (FD_ISSET(ss, &fds)) {




More information about the bind10-changes mailing list