From: "cron2 (Code Review)" Date: Mon, 19 May 2025 13:02:06 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="khLcBoL/oUA="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: socket: don't transfer bind family to socket in case of ANY address List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --khLcBoL/oUA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= ordex. ( http://gerrit.openvpn.net/c/openvpn/+/907?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by plaisthos Change subject: socket: don't transfer bind family to socket in case of ANY= address ...................................................................... socket: don't transfer bind family to socket in case of ANY address With the introduction of multisocket, we need to transfer the AI family of the bound address to the socket, as it may differ from what was set globally. However, this operation makes sense only when getaddrinfo() for bind is performed on a non-empty hostname. An empty hostname (ANY) may return AF_INET which will break following connection attempts to v6 only remotes. Change-Id: I27f305d3ae9bf650bab409e99173688d9f88ab65 Signed-off-by: Antonio Quartulli Acked-by: Arne Schwabe Message-Id: <20250325090121.28813-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 235.html Signed-off-by: Gert Doering --- M src/openvpn/socket.c 1 file changed, 13 insertions(+), 3 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/907/3 diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 34a049e..93d793b 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1741,9 +1741,19 @@ gai_strerror(status)); } - /* the resolved 'local entry' might have a different family than w= hat - * was globally configured */ - sock->info.af =3D sock->info.lsa->bind_local->ai_family; + /* the address family returned by openvpn_getaddrinfo() should be + * taken into consideration only if we really passed an hostname + * to resolve. Otherwise its value is not useful to us and may + * actually break our socket, i.e. when it returns AF_INET + * but our remote is v6 only. + */ + if (sock->local_host) + { + /* the resolved 'local entry' might have a different family th= an + * what was globally configured + */ + sock->info.af =3D sock->info.lsa->bind_local->ai_family; + } } =20 gc_free(&gc); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/907?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I27f305d3ae9bf650bab409e99173688d9f88ab65 Gerrit-Change-Number: 907 Gerrit-PatchSet: 3 Gerrit-Owner: ordex Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --khLcBoL/oUA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #3 to the change originally cr= eated by ordex.

View Change

The following approvals got outdated and= were removed: Code-Review+2 by plaisthos

socket: don't transfer bind family to socket=
 in case of ANY address

With the introduction of multisocket, we nee= d to transfer the
AI family of the bound address to the socket, as it ma= y differ
from what was set globally.

However, this operation make= s sense only when getaddrinfo()
for bind is performed on a non-empty hos= tname.
An empty hostname (ANY) may return AF_INET which will break
fo= llowing connection attempts to v6 only remotes.

Change-Id: I27f305d3= ae9bf650bab409e99173688d9f88ab65
Signed-off-by: Antonio Quartulli <an= tonio@...2726...>
Acked-by: Arne Schwabe <arne-openvpn@...1227...&= gt;
Message-Id: <20250325090121.28813-1-gert@...1296...>
URL: h= ttps://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31235.ht= ml
Signed-off-by: Gert Doering <gert@...1296...>
---
M src/o= penvpn/socket.c
1 file changed, 13 insertions(+), 3 deletions(-)

=
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/907/3
=
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 34a049e..93d793b 100644
--- a/src/openvpn/socket.= c
+++ b/src/openvpn/socket.c
@@ -1741,9 +17= 41,19 @@
gai_strerror(status));
= }

- /* the resolved 'local entry' might have a dif= ferent family than what
- * was globally configured */
- sock->info.af =3D sock->info.lsa->bind_l= ocal->ai_family;
+= /* the address family returned by openvpn_getaddrinfo() should be
+ * taken into= consideration only if we really passed an hostname
+ * to resolve. Otherwise its valu= e is not useful to us and may
+ * actually break our socket, i.e. when it returns AF_INE= T
+ * but our= remote is v6 only.
+= */
+ = if (sock->local_host)
+ {
+ = /* the resolved 'local entry' might have a different family = than
+ * = what was globally configured
+ */
+ sock->info.af =3D sock->info.lsa->bind_local->= ai_family;
+ }=
}

gc_free(&= ;gc);

To view, visit change 907. To unsubscr= ibe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I27f305d3ae9bf650bab409e9917= 3688d9f88ab65
Gerrit-Change-Number: 907
Gerrit-PatchSet: 3
Gerrit-Owner: ordex <antonio@...2726...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--khLcBoL/oUA=--