From: "ralf_lici (Code Review)" Date: Wed, 25 Jun 2025 12:43:25 +0000 References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <4b9ddbfcbc72cdbceb017dd4f346c6d831bdcf80-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="FXfY4hrpvYI="; 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: plaisthos , flichtenheld Cc: openvpn-devel --FXfY4hrpvYI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1068?usp=3Demail to review the following change. 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 --- M src/openvpn/dco_linux.c 1 file changed, 0 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/68/1068/1 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: 1 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --FXfY4hrpvYI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

ralf_lici would like plaisthos and flichtenheld to review this change.

V= iew Change

dco linux: avoid sending local port to ovpn

When send= ing an OVPN_CMD_NEW_PEER netlink message to ovpn, we currently
attempt t= o include the local port along with the local address. However,
`dco_mul= ti_get_localaddr()` does not record the port, so we end up
sending a zer= o value. This zero is rejected by ovpn's netlink policy,
leading to = an error and aborted connection.

Since openvpn does not actually nee= d to send the local port because the
module retrieves it directly from t= he socket, this commit ensures that
only the local address is sent.
<= br>Change-Id: I5d9535d46e5a5488f4a2b637a6fcb99aad668fee
Signed-off-by: R= alf Lici <ralf@...2726...>
---
M src/openvpn/dco_linux.c
1 f= ile changed, 0 insertions(+), 2 deletions(-)

git pull ssh://gerri=
t.openvpn.net:29418/openvpn refs/changes/68/1068/1
diff --git a/src=
/openvpn/dco_linux.c b/src/openvpn/dco_linux.c
index 034541= 3..22a445a 100644
--- a/src/openvpn/dco_linux.c
<= span>+++ 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_famil= y =3D=3D AF_INET6)
{
= NLA_PUT(nl_msg, OVPN_A_PEER_LOCAL_IPV6, sizeof(struct in6_addr),
= &((struct sockaddr_in6 *)localaddr)->sin6= _addr);
- NL= A_PUT_U16(nl_msg, OVPN_A_PEER_LOCAL_PORT, ((struct sockaddr_in6 *)localaddr= )->sin6_port);
}
}<= br>

To view, visit change 1068. To u= nsubscribe, 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: 1
Gerrit-Owner: ralf_lici <ralf@...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-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--FXfY4hrpvYI=--