]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1950. [port] Solaris 2.5.1 and earlier cannot bind() then connect()
authorMark Andrews <marka@isc.org>
Wed, 4 Jan 2006 04:15:55 +0000 (04:15 +0000)
committerMark Andrews <marka@isc.org>
Wed, 4 Jan 2006 04:15:55 +0000 (04:15 +0000)
                        a TCP socket. This prevents the source address being
                        set for TCP connections. [RT #15628]

CHANGES
config.h.in
configure
configure.in
doc/arm/Bv9ARM-book.xml
lib/dns/request.c
lib/dns/resolver.c
lib/dns/xfrin.c

diff --git a/CHANGES b/CHANGES
index 7ea44525f72bd2843edf88b18effd6e449e09f01..b44ecce4ceaf291249443daddcca3be42a93a025 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+1950.  [port]          Solaris 2.5.1 and earlier cannot bind() then connect()
+                       a TCP socket. This prevents the source address being
+                       set for TCP connections. [RT #15628]
+
 1949.  [func]          Addition memory leakage checks. [RT #15544]
 
 1948.  [bug]           If was possible to trigger a REQUIRE failure in
index a2b05ddf082752270daa6b26aff6d397c851d1e3..45444d9b1dfc83d477742ee67837611c09fed54d 100644 (file)
@@ -16,7 +16,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: config.h.in,v 1.75 2005/10/20 23:50:53 marka Exp $ */
+/* $Id: config.h.in,v 1.77 2006/01/05 00:30:34 marka Exp $ */
 
 /*! \file */
 
@@ -150,6 +150,9 @@ int sigwait(const unsigned int *set, int *sig);
 /* Define if threads need PTHREAD_SCOPE_SYSTEM */
 #undef NEED_PTHREAD_SCOPE_SYSTEM
 
+/* Define if you cannot bind() before connect() for TCP sockets. */
+#undef BROKEN_TCP_BIND_BEFORE_CONNECT
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
index 898af1d0f56d10c1c3f0cacdf82b44ddf83f6353..2d8224af9aeaa4c50847094071b381aeee282c6f 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2004-2006  Internet Systems Consortium, Inc. ("ISC")
 # Copyright (C) 1996-2003  Internet Software Consortium.
 #
 # Permission to use, copy, modify, and distribute this software for any
@@ -14,7 +14,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 #
-# $Id: configure,v 1.385 2005/10/20 23:50:53 marka Exp $
+# $Id: configure,v 1.386 2006/01/04 04:15:55 marka Exp $
 #
 # Portions Copyright (C) 1996-2001  Nominum, Inc.
 #
@@ -29,7 +29,7 @@
 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# From configure.in Revision: 1.396 .
+# From configure.in Revision: 1.397 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59.
 #
@@ -27822,6 +27822,19 @@ _ACEOF
        ;;
 esac
 #
+# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
+# This prevents the source address being set.
+#
+case "$host" in
+*-solaris2.[012345]|*-solaris2.5.1)
+
+cat >>confdefs.h <<\_ACEOF
+#define BROKEN_TCP_BIND_BEFORE_CONNECT 1
+_ACEOF
+
+       ;;
+esac
+#
 # The following sections deal with tools used for formatting
 # the documentation.  They are all optional, unless you are
 # a developer editing the documentation source.
index 0c66e2966688bc524c48a8a4d5acea1d61e4acb9..eef4800adfd8454d6561350f1d6c38a2f2b5086e 100644 (file)
@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
 esyscmd([sed "s/^/# /" COPYRIGHT])dnl
 AC_DIVERT_POP()dnl
 
-AC_REVISION($Revision: 1.396 $)
+AC_REVISION($Revision: 1.397 $)
 
 AC_INIT(lib/dns/name.c)
 AC_PREREQ(2.59)
@@ -2020,6 +2020,16 @@ case "$host" in
        ;;
 esac
 #
+# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket.
+# This prevents the source address being set.
+#
+case "$host" in
+*-solaris2.[[012345]]|*-solaris2.5.1)
+       AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1,
+                 [Define if you cannot bind() before connect() for TCP sockets.])
+       ;;
+esac
+#
 # The following sections deal with tools used for formatting
 # the documentation.  They are all optional, unless you are
 # a developer editing the documentation source.
index 3d249e78223151b0c09e574ecb3ff9e79d88873e..423ae7bfed5b0c89245cc9f1ab73dc52262e39b4 100644 (file)
@@ -18,7 +18,7 @@
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- File: $Id: Bv9ARM-book.xml,v 1.284 2006/01/04 02:35:49 marka Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.285 2006/01/04 04:14:39 marka Exp $ -->
 <book xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>BIND 9 Administrator Reference Manual</title>
 
@@ -5977,6 +5977,12 @@ query-source-v6 address * port *;
               unprivileged port.
             </para>
           </note>
+         <note>
+           <para>
+             Solaris 2.5.1 and earlier does not support setting the source
+             address for TCP sockets.
+           </para>
+         </note>
           <note>
             <para>
               See also <command>transfer-source</command> and
@@ -6202,6 +6208,12 @@ query-source-v6 address * port *;
                   <command>zone</command> block in the configuration
                   file.
                 </para>
+               <note>
+                 <para>
+                   Solaris 2.5.1 and earlier does not support setting the
+                   source address for TCP sockets.
+                 </para>
+                </note>
               </listitem>
             </varlistentry>
 
@@ -6277,6 +6289,12 @@ query-source-v6 address * port *;
                   <command>view</command> block in the configuration
                   file.
                 </para>
+               <note>
+                 <para>
+                   Solaris 2.5.1 and earlier does not support setting the
+                   source address for TCP sockets.
+                 </para>
+                </note>
               </listitem>
             </varlistentry>
 
index a5493e9fc161750413c084004fa43f6b38c65dac..b3c645625ee63f81711c3dcf047eb1e4861396f7 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: request.c,v 1.74 2005/04/29 00:22:51 marka Exp $ */
+/* $Id: request.c,v 1.75 2006/01/04 04:14:39 marka Exp $ */
 
 /*! \file */
 
@@ -514,6 +514,7 @@ create_tcp_dispatch(dns_requestmgr_t *requestmgr, isc_sockaddr_t *srcaddr,
                                   isc_sockettype_tcp, &socket);
        if (result != ISC_R_SUCCESS)
                return (result);
+#ifndef BROKEN_TCP_BIND_BEFORE_CONNECT
        if (srcaddr == NULL) {
                isc_sockaddr_anyofpf(&bind_any,
                                     isc_sockaddr_pf(destaddr));
@@ -525,6 +526,7 @@ create_tcp_dispatch(dns_requestmgr_t *requestmgr, isc_sockaddr_t *srcaddr,
        }
        if (result != ISC_R_SUCCESS)
                goto cleanup;
+#endif
        attrs = 0;
        attrs |= DNS_DISPATCHATTR_TCP;
        attrs |= DNS_DISPATCHATTR_PRIVATE;
index a2769ce8be77ad67b1780204125f4e1f3e8eb661..dbba5abdbfbf6db7d119780140a7be0371e37f96 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.323 2006/01/04 00:37:24 marka Exp $ */
+/* $Id: resolver.c,v 1.324 2006/01/04 04:14:39 marka Exp $ */
 
 /*! \file */
 
@@ -1070,9 +1070,11 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
                if (result != ISC_R_SUCCESS)
                        goto cleanup_query;
 
+#ifndef BROKEN_TCP_BIND_BEFORE_CONNECT
                result = isc_socket_bind(query->tcpsocket, &addr);
                if (result != ISC_R_SUCCESS)
                        goto cleanup_socket;
+#endif
 
                /*
                 * A dispatch will be created once the connect succeeds.
index 806d6d11c39d4901e506db51f5aad8d377222340..fb3eced043f6666993d3b561f30ce2039c115bca 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: xfrin.c,v 1.143 2006/01/04 03:03:11 marka Exp $ */
+/* $Id: xfrin.c,v 1.144 2006/01/04 04:14:39 marka Exp $ */
 
 /*! \file */
 
@@ -821,7 +821,9 @@ xfrin_start(dns_xfrin_ctx_t *xfr) {
                                isc_sockaddr_pf(&xfr->sourceaddr),
                                isc_sockettype_tcp,
                                &xfr->socket));
+#ifndef BROKEN_TCP_BIND_BEFORE_CONNECT
        CHECK(isc_socket_bind(xfr->socket, &xfr->sourceaddr));
+#endif
        CHECK(isc_socket_connect(xfr->socket, &xfr->masteraddr, xfr->task,
                                 xfrin_connect_done, xfr));
        xfr->connects++;