From: "its_Giaan (Code Review)"
Date: Fri, 27 Dec 2024 11:02:36 +0000
In-Reply-To:
References:
Reply-To: gianmarco@...2726..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, frank@...2641...,
gert@...1296..., a@...2181...
Message-ID:
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="nXVp7BVEnWA="; 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 , cron2 , flichtenheld
Cc: openvpn-devel
--nXVp7BVEnWA=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, its_Giaan, plaisthos.
Hello cron2, 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 (#8).
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, 14 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/62/762/8
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 7921433..0d7cd21 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -488,11 +488,15 @@
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 (!hostname)
+ {
+ hints.ai_family =3D ai_family;
+ }
+
if (flags & GETADDR_PASSIVE)
{
hints.ai_flags |=3D AI_PASSIVE;
@@ -518,6 +522,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 +1724,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: 8
Gerrit-Owner: its_Giaan
Gerrit-Reviewer: cron2
Gerrit-Reviewer: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-CC: ordex
Gerrit-Attention: plaisthos
Gerrit-Attention: its_Giaan
Gerrit-Attention: flichtenheld
Gerrit-MessageType: newpatchset
--nXVp7BVEnWA=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, its_Giaan, plaistho=
s.
its_Giaan uploaded patch set #8 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, 14 insertio=
ns(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/ope=
nvpn refs/changes/62/762/8
diff --git a/src/openvpn/socket.c b/src/=
openvpn/socket.c
index 7921433..0d7cd21 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c=
span>
@@ -488,11 +488,15 @@
sig_info =3D =
&sigrec;
}
- /* try numeric ipv6 addr first */
+ /* try numeric ip add=
r first */
CLEAR(hints);
- hints.ai_family =3D ai_family;
=
hints.ai_flags =3D AI_NUMERICHOST;
+ if (!hostname)
+ {
+ hints.ai_family =3D ai_family;
+ }
+
if (flags & GETADDR_P=
ASSIVE)
{
hints.ai_flags |=3D=
AI_PASSIVE;
@@ -518,6 +522,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 hos=
tname_randomize(hostname, &gc);
@@ -1716,6 +1724,10 @@<=
/span>
sock->local_host, sock->local_port,<=
/span>
gai_strerror(status));
=
}
+
<=
span style=3D"color: hsl(120, 100%, 40%);">+ /* the resolved 'lo=
cal 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 762. To unsubscribe, or for help writ=
ing mail filters, visit sett=
ings.
<=
link itemprop=3D"url" href=3D"http://gerrit.openvpn.net/c/openvpn/+/762?usp=
=3Demail"/>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie2471e6b2d6974e70423b09918a=
d1c2136253754
Gerrit-Change-Number: 762
Gerrit-PatchSet: 8
Gerrit-Owner: its_Giaan <gianmarco@...2786...=
..>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...=
1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-Attention: plaisthos <arne-openvpn@...220...=
..1227...>
Gerrit-Attention: its_Giaan <gianmarco@...1665...=
726...>
Gerrit-Attention: flichtenheld <frank@...2375...=
41...>
Gerrit-MessageType: newpatchset
--nXVp7BVEnWA=--