[svn] commit: r2468 - in /branches/trac221b/src/bin/auth: asio_link.cc tests/asio_link_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Sat Jul 10 00:32:39 UTC 2010


Author: jinmei
Date: Sat Jul 10 00:32:39 2010
New Revision: 2468

Log:
added tests for address family mismatches (give an ipv4 address with -6, etc)

Modified:
    branches/trac221b/src/bin/auth/asio_link.cc
    branches/trac221b/src/bin/auth/tests/asio_link_unittest.cc

Modified: branches/trac221b/src/bin/auth/asio_link.cc
==============================================================================
--- branches/trac221b/src/bin/auth/asio_link.cc (original)
+++ branches/trac221b/src/bin/auth/asio_link.cc Sat Jul 10 00:32:39 2010
@@ -524,13 +524,15 @@
         }
 
         if (addr.is_v6() && !use_ipv6) {
-            isc_throw(FatalError,
-                      "[b10-auth] Error: -4 conflicts with " << addr);
+            isc_throw(IOError,
+                      "IPv6 address is specified while IPv6 is disabled: "
+                      << addr);
         }
 
         if (addr.is_v4() && !use_ipv4) {
-            isc_throw(FatalError,
-                      "[b10-auth] Error: -6 conflicts with " << addr);
+            isc_throw(IOError,
+                      "IPv4 address is specified while IPv4 is disabled: "
+                      << addr);
         }
 
         if (addr.is_v4()) {

Modified: branches/trac221b/src/bin/auth/tests/asio_link_unittest.cc
==============================================================================
--- branches/trac221b/src/bin/auth/tests/asio_link_unittest.cc (original)
+++ branches/trac221b/src/bin/auth/tests/asio_link_unittest.cc Sat Jul 10 00:32:39 2010
@@ -105,6 +105,14 @@
                  IOError);
 }
 
+TEST(IOServiceTest, addressFamilyMismatch) {
+    IOService(NULL, "192.0.2.1", *TEST_PORT, false, true);
+    EXPECT_THROW(IOService(NULL, "192.0.2.1", *TEST_PORT, false, true),
+                 IOError);
+    EXPECT_THROW(IOService(NULL, "2001:db8::1", *TEST_PORT, true, false),
+                 IOError);
+}
+
 struct addrinfo*
 resolveAddress(const int family, const int sock_type, const int protocol) {
     const char* const addr = (family == AF_INET6) ?




More information about the bind10-changes mailing list