From: "its_Giaan (Code Review)" Date: Thu, 17 Oct 2024 14:47:28 +0000 In-Reply-To: References: Reply-To: gianmarco@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., a@...2181... Message-ID: <2ae9e33bdf9ee1be7025624daeb75eab299a7701-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="XEIfm7XmPho="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: override ai_family if 'local' numeric address was specified List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --XEIfm7XmPho= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, ordex, plaisthos. Hello flichtenheld, ordex, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/762?usp=3Demail to look at the new patch set (#5). Change subject: override ai_family if 'local' numeric address was specified ...................................................................... override ai_family if 'local' numeric address was specified This change ensures that when a numeric IP address is specified as argument to a 'local' directive, its ai_family overrides the one extracted from the 'proto' config option. Change-Id: Ie2471e6b2d6974e70423b09918ad1c2136253754 Signed-off-by: Antonio Quartulli Signed-off-by: Gianmarco De Gregori --- M src/openvpn/socket.c 1 file changed, 9 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/62/762/5 diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 67c8f06..06acd5a 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -488,9 +488,8 @@ sig_info =3D &sigrec; } - /* try numeric ipv6 addr first */ + /* try numeric ip addr first */ CLEAR(hints); - hints.ai_family =3D ai_family; hints.ai_flags =3D AI_NUMERICHOST; if (flags & GETADDR_PASSIVE) @@ -518,6 +517,10 @@ const char *fmt; int level =3D 0; + /* this is not a numeric IP, therefore force resolution using the + * provided ai_family */ + hints.ai_family =3D ai_family; + if (hostname && (flags & GETADDR_RANDOMIZE)) { hostname =3D hostname_randomize(hostname, &gc); @@ -1716,6 +1719,10 @@ sock->local_host, sock->local_port, 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; } gc_free(&gc); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/762?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: Ie2471e6b2d6974e70423b09918ad1c2136253754 Gerrit-Change-Number: 762 Gerrit-PatchSet: 5 Gerrit-Owner: its_Giaan Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-Attention: ordex Gerrit-MessageType: newpatchset --XEIfm7XmPho= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, ordex, plaisthos. <= /p>

its_Giaan uploaded patch set #5 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/762?usp=3Demail">View Chang= e

override ai_family if 'local' numeric address was specified
This change ensures that when a numeric IP address is specified
as= argument to a 'local' directive, its ai_family overrides
the on= e extracted from the 'proto' config option.

Change-Id: Ie247= 1e6b2d6974e70423b09918ad1c2136253754
Signed-off-by: Antonio Quartulli &l= t;a@...2181...>
Signed-off-by: Gianmarco De Gregori <gianmarco@...493...= 2726...>
---
M src/openvpn/socket.c
1 file changed, 9 insertion= s(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/open=
vpn refs/changes/62/762/5
diff --git a/src/openvpn/socket.c b/src/o=
penvpn/socket.c
index 67c8f06..06acd5a 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -488,9 +488,8 @@
sig_info =3D &am= p;sigrec;
}

- /* try numeric ipv6 addr first */+ /* try numeric ip addr f= irst */
CLEAR(hints);
- hints.ai_family =3D ai_family;
= hints.ai_flags =3D AI_NUMERICHOST;

= if (flags & GETADDR_PASSIVE)
@@ -518,6 +517,10 @@
const char *fmt;
int level = =3D 0;

+ /* this is not a numeric IP, therefore force resolution using = the
+ * provi= ded ai_family */
+ = hints.ai_family =3D ai_family;
+
if (hostname && (flags &a= mp; GETADDR_RANDOMIZE))
{
= hostname =3D hostname_randomize(hostname, &gc);
@@= -1716,6 +1719,10 @@
sock->local_host, = sock->local_port,
gai_strerror(status))= ;
}
+
+ /*= the resolved 'local entry' might have a different family than what=
+ * was glob= ally configured */
+ = sock->info.af =3D sock->info.lsa->bind_local->ai_family;=
}

gc_free(&= ;gc);

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie2471e6b2d6974e70423b09918a= d1c2136253754
Gerrit-Change-Number: 762
Gerrit-PatchSet: 5
Gerrit-Owner: its_Giaan <gianmarco@...2786...= ..>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: ordex <a@...2181...> <= /div>
Gerrit-MessageType: newpatchset
--XEIfm7XmPho=--