]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1621. [bug] match-destinations did not work for IPv6 TCP queries.
authorMark Andrews <marka@isc.org>
Wed, 28 Apr 2004 14:17:03 +0000 (14:17 +0000)
committerMark Andrews <marka@isc.org>
Wed, 28 Apr 2004 14:17:03 +0000 (14:17 +0000)
                        [RT# 11156]

CHANGES
bin/named/client.c

diff --git a/CHANGES b/CHANGES
index 606ee1daaa919a351d6085b8847e7428b04ca1a9..0e1675d911475a128bba7cf1dc9a48484bb09a06 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,9 @@
                        "sending notifies" log message when also-notify was
                        used. [RT #11177]
 
+1621.  [bug]           match-destinations did not work for IPv6 TCP queries.
+                       [RT# 11156]
+
 1619.  [bug]           Missing ISC_LIST_UNLINK in end_reserved_dispatches().
                        [RT# 11118]
 
index 025360d567e66005b145afc4585a2b01bfdf2aaf..f40c110a3e7a51956223a2479802aa8302036fe6 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: client.c,v 1.176.2.14 2004/03/09 06:09:17 marka Exp $ */
+/* $Id: client.c,v 1.176.2.15 2004/04/28 14:17:03 marka Exp $ */
 
 #include <config.h>
 
@@ -1291,15 +1291,35 @@ client_request(isc_task_t *task, isc_event_t *event) {
        }
 
        /*
-        * Determine the destination address.  For IPv6, we get this from the
-        * pktinfo structure (if supported).  For IPv4, we have to make do with
+        * Determine the destination address.  For TCP/IPv6, we get this from
+        * the receiving socket.  For UDP/IPv6, we get it from the pktinfo
+        * structure (if supported).  For IPv4, we have to do with
         * the address of the interface where the request was received.
         */
        if (client->interface->addr.type.sa.sa_family == AF_INET6) {
-               if ((client->attributes & NS_CLIENTATTR_PKTINFO) != 0)
+               result = ISC_R_FAILURE;
+
+               if (TCP_CLIENT(client)) {
+                       isc_sockaddr_t destsockaddr;
+
+                       result = isc_socket_getsockname(client->tcpsocket,
+                                                       &destsockaddr);
+                       if (result == ISC_R_SUCCESS)
+                               isc_netaddr_fromsockaddr(&destaddr,
+                                                        &destsockaddr);
+               }
+               if (result != ISC_R_SUCCESS &&
+                   (client->attributes & NS_CLIENTATTR_PKTINFO) != 0) {
                        isc_netaddr_fromin6(&destaddr, &client->pktinfo.ipi6_addr);
-               else
-                       isc_netaddr_any6(&destaddr);
+                       result = ISC_R_SUCCESS;
+               }
+               if (result != ISC_R_SUCCESS) {
+                       UNEXPECTED_ERROR(__FILE__, __LINE__,
+                                        "failed to get request's "
+                                        "destination: %s",
+                                        isc_result_totext(result));
+                       goto cleanup;
+               }
        } else {
                isc_netaddr_fromsockaddr(&destaddr, &client->interface->addr);
        }