regression in IPv4 handling in r1907242. Cycle through the address list
handling v4/v6 addresses correctly
This commit is contained in:
parent
c3d05badc4
commit
7e2f467e22
@ -41,3 +41,83 @@ index 5f8135c52c..18806281a4 100644
|
||||
#endif
|
||||
|
||||
rv = apr_pool_create(&np, pool);
|
||||
|
||||
From 59341af138dd2c6fe9444ee9c865b769c0053bdd Mon Sep 17 00:00:00 2001
|
||||
From: Joe Orton <jorton@apache.org>
|
||||
Date: Tue, 27 Jun 2023 14:06:09 +0000
|
||||
Subject: [PATCH] * memcache/apr_memcache.c (conn_connect, mc_conn_construct):
|
||||
Fix regression in IPv4 handling in r1907242. Cycle through the address
|
||||
list handling v4/v6 addresses correctly.
|
||||
|
||||
Submitted by: Lubos Uhliarik <luhliari redhat.com>
|
||||
Github: closes #44
|
||||
|
||||
|
||||
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1910629 13f79535-47bb-0310-9956-ffa450edef68
|
||||
---
|
||||
memcache/apr_memcache.c | 36 ++++++++++++++++++------------------
|
||||
1 file changed, 18 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/memcache/apr_memcache.c b/memcache/apr_memcache.c
|
||||
index 41b93a0a33..09779d91b5 100644
|
||||
--- a/memcache/apr_memcache.c
|
||||
+++ b/memcache/apr_memcache.c
|
||||
@@ -300,14 +300,26 @@ static apr_status_t conn_connect(apr_memcache_conn_t *conn)
|
||||
return rv;
|
||||
}
|
||||
|
||||
- rv = apr_socket_timeout_set(conn->sock, 1 * APR_USEC_PER_SEC);
|
||||
- if (rv != APR_SUCCESS) {
|
||||
- return rv;
|
||||
+ /* Cycle through address until a connect() succeeds. */
|
||||
+ for (; sa; sa = sa->next) {
|
||||
+ rv = apr_socket_create(&conn->sock, sa->family, SOCK_STREAM, 0, conn->p);
|
||||
+ if (rv == APR_SUCCESS) {
|
||||
+ rv = apr_socket_timeout_set(conn->sock, 1 * APR_USEC_PER_SEC);
|
||||
+ if (rv != APR_SUCCESS) {
|
||||
+ return rv;
|
||||
+ }
|
||||
+
|
||||
+ rv = apr_socket_connect(conn->sock, sa);
|
||||
+ if (rv == APR_SUCCESS) {
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ apr_socket_close(conn->sock);
|
||||
+ }
|
||||
}
|
||||
|
||||
- rv = apr_socket_connect(conn->sock, sa);
|
||||
- if (rv != APR_SUCCESS) {
|
||||
- return rv;
|
||||
+ if (!sa) {
|
||||
+ return APR_ECONNREFUSED;
|
||||
}
|
||||
|
||||
rv = apr_socket_timeout_set(conn->sock, -1);
|
||||
@@ -327,11 +339,6 @@ mc_conn_construct(void **conn_, void *params, apr_pool_t *pool)
|
||||
apr_pool_t *np;
|
||||
apr_pool_t *tp;
|
||||
apr_memcache_server_t *ms = params;
|
||||
-#if APR_HAVE_SOCKADDR_UN
|
||||
- apr_int32_t family = ms->host[0] != '/' ? APR_UNSPEC : APR_UNIX;
|
||||
-#else
|
||||
- apr_int32_t family = APR_UNSPEC;
|
||||
-#endif
|
||||
|
||||
rv = apr_pool_create(&np, pool);
|
||||
if (rv != APR_SUCCESS) {
|
||||
@@ -349,13 +356,6 @@ mc_conn_construct(void **conn_, void *params, apr_pool_t *pool)
|
||||
conn->p = np;
|
||||
conn->tp = tp;
|
||||
|
||||
- rv = apr_socket_create(&conn->sock, family, SOCK_STREAM, 0, np);
|
||||
-
|
||||
- if (rv != APR_SUCCESS) {
|
||||
- apr_pool_destroy(np);
|
||||
- return rv;
|
||||
- }
|
||||
-
|
||||
conn->buffer = apr_palloc(conn->p, BUFFER_SIZE + 1);
|
||||
conn->blen = 0;
|
||||
conn->ms = ms;
|
||||
|
@ -25,7 +25,7 @@
|
||||
Summary: Apache Portable Runtime Utility library
|
||||
Name: apr-util
|
||||
Version: 1.6.3
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
License: ASL 2.0
|
||||
URL: https://apr.apache.org/
|
||||
Source0: https://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2
|
||||
@ -232,6 +232,10 @@ export LD_LIBRARY_PATH=%{buildroot}/%{_libdir}/apr-util-%{apuver}
|
||||
%{_datadir}/aclocal/*.m4
|
||||
|
||||
%changelog
|
||||
* Fri Jun 23 2023 Luboš Uhliarik <luhliari@redhat.com> - 1.6.3-3
|
||||
- regression in IPv4 handling in r1907242. Cycle through the address list
|
||||
handling v4/v6 addresses correctly
|
||||
|
||||
* Fri Feb 10 2023 Luboš Uhliarik <luhliari@redhat.com> - 1.6.3-2
|
||||
- memcache/apr_memcache.c (conn_connect): Allow use of IPv6
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user