From: "cron2 (Code Review)" Date: Wed, 25 Jun 2025 16:49:51 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, ralf@...2726..., frank@...2641..., antonio@...2726... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="kt6tU/zS55k="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: dco linux: avoid sending local port to ovpn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ralf_lici Cc: plaisthos , flichtenheld , openvpn-devel --kt6tU/zS55k= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/10= 68?usp=3Demail ) Change subject: dco linux: avoid sending local port to ovpn ...................................................................... dco linux: avoid sending local port to ovpn When sending an OVPN_CMD_NEW_PEER netlink message to ovpn, we currently attempt to include the local port along with the local address. However, `dco_multi_get_localaddr()` does not record the port, so we end up sending a zero value. This zero is rejected by ovpn's netlink policy, leading to an error and aborted connection. Since openvpn does not actually need to send the local port because the module retrieves it directly from the socket, this commit ensures that only the local address is sent. Change-Id: I5d9535d46e5a5488f4a2b637a6fcb99aad668fee Signed-off-by: Ralf Lici Acked-by: Antonio Quartulli Message-Id: <20250625162638.7769-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 971.html Signed-off-by: Gert Doering --- M src/openvpn/dco_linux.c 1 file changed, 0 insertions(+), 2 deletions(-) diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 0345413..22a445a 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -265,13 +265,11 @@ { NLA_PUT(nl_msg, OVPN_A_PEER_LOCAL_IPV4, sizeof(struct in_addr), &((struct sockaddr_in *)localaddr)->sin_addr); - NLA_PUT_U16(nl_msg, OVPN_A_PEER_LOCAL_PORT, ((struct sockaddr_= in *)localaddr)->sin_port); } else if (localaddr->sa_family =3D=3D AF_INET6) { NLA_PUT(nl_msg, OVPN_A_PEER_LOCAL_IPV6, sizeof(struct in6_addr= ), &((struct sockaddr_in6 *)localaddr)->sin6_addr); - NLA_PUT_U16(nl_msg, OVPN_A_PEER_LOCAL_PORT, ((struct sockaddr_= in6 *)localaddr)->sin6_port); } } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1068?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: I5d9535d46e5a5488f4a2b637a6fcb99aad668fee Gerrit-Change-Number: 1068 Gerrit-PatchSet: 2 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --kt6tU/zS55k= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

dco linux: avoid sending local port to ovpn
When sending an OVPN_CMD_NEW_PEER netlink message to ovpn, we current= ly
attempt to include the local port along with the local address. Howev= er,
`dco_multi_get_localaddr()` does not record the port, so we end upsending a zero value. This zero is rejected by ovpn's netlink policy,=
leading to an error and aborted connection.

Since openvpn does n= ot actually need to send the local port because the
module retrieves it = directly from the socket, this commit ensures that
only the local addres= s is sent.

Change-Id: I5d9535d46e5a5488f4a2b637a6fcb99aad668fee
S= igned-off-by: Ralf Lici <ralf@...2726...>
Acked-by: Antonio Quartu= lli <antonio@...2726...>
Message-Id: <20250625162638.7769-1-ger= t@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1096...= ourceforge.net/msg31971.html
Signed-off-by: Gert Doering <gert@...1826...= 6...>
---
M src/openvpn/dco_linux.c
1 file changed, 0 insertion= s(+), 2 deletions(-)

diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.cindex 0345413..22a445a 100644
--- a/src/openvpn/dco_= linux.c
+++ b/src/openvpn/dco_linux.c
@@ -2= 65,13 +265,11 @@
{
NL= A_PUT(nl_msg, OVPN_A_PEER_LOCAL_IPV4, sizeof(struct in_addr),
&((struct sockaddr_in *)localaddr)->sin_addr= );
- NLA_PUT= _U16(nl_msg, OVPN_A_PEER_LOCAL_PORT, ((struct sockaddr_in *)localaddr)->= sin_port);
}
else if (loc= aladdr->sa_family =3D=3D AF_INET6)
{
= NLA_PUT(nl_msg, OVPN_A_PEER_LOCAL_IPV6, sizeof(struct in= 6_addr),
&((struct sockaddr_in6 *)= localaddr)->sin6_addr);
- NLA_PUT_U16(nl_msg, OVPN_A_PEER_LOCAL_PORT, ((struct socka= ddr_in6 *)localaddr)->sin6_port);
}
<= span> }


To view, = visit ch= ange 1068. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5d9535d46e5a5488f4a2b637a6f= cb99aad668fee
Gerrit-Change-Number: 1068
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--kt6tU/zS55k=--