]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy: Follow up to r1918412: Find if one of the conn->addr[->next] is alive.
authorYann Ylavic <ylavic@apache.org>
Wed, 19 Jun 2024 10:39:56 +0000 (10:39 +0000)
committerYann Ylavic <ylavic@apache.org>
Wed, 19 Jun 2024 10:39:56 +0000 (10:39 +0000)
ap_proxy_connect_backend() will use the first conn->addr[->next] that works, so
the current address alive can be any of them.

* modules/proxy/proxy_util.c(ap_proxy_determine_address):
  Loop for all conn->addr[->next] to determine if addr_alive.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918429 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_util.c

index 1f3a191b6429c6d67c43a1482b374893d898abdf..3725b7b114a13ff54091e722ddc02411f84c1209 100644 (file)
@@ -3017,8 +3017,18 @@ PROXY_DECLARE(apr_status_t) ap_proxy_determine_address(const char *proxy_functio
                                   proxy_addrs_equal(conn->addr, address->addr));
                 if (conn_alive) {
                     apr_sockaddr_t *remote_addr = NULL;
+                    /* apr_socket_connect() in ap_proxy_connect_backend() will
+                     * do a simple pointer copy of its given conn->addr[->next]
+                     * so the current conn->addr is alive iif sock->remote_addr
+                     * is one of the conn->addr[->next].
+                     */
                     apr_socket_addr_get(&remote_addr, APR_REMOTE, conn->sock);
-                    addr_alive = (conn->addr == remote_addr);
+                    for (addr = conn->addr; addr; addr = addr->next) {
+                        if (addr == remote_addr) {
+                            addr_alive = 1;
+                            break;
+                        }
+                    }
                 }
                 else if (conn->sock && (r ? APLOGrdebug(r) : APLOGdebug(s))) {
                     apr_sockaddr_t *local_addr = NULL;