From: "its_Giaan (Code Review)" Date: Tue, 10 Mar 2026 16:19:28 +0000 In-Reply-To: References: Reply-To: gianmarco@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, antonio@...2726... Message-ID: <495a63af129f2c411e210e082d975faecafefcfc-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="npQggtYr1jE="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: socket: restore per-connection lport override over global default List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --npQggtYr1jE= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: its_Giaan, ordex, plaisthos. Hello ordex, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1555?usp=3Demail to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review-1 by ordex Change subject: socket: restore per-connection lport override over global d= efault ...................................................................... socket: restore per-connection lport override over global default OpenVPN 2.7.x introduced a regression where --lport specified inside a block did not override a globally defined local port. As a result, the socket was bound to the global default port instead of the per-connection value. Adjust the socket local_port selection logic to honour local_port_defined when set for the active connection profile. This change restores the documented and previously working behaviour from 2.6.x, where connection-level lport takes precedence over global defaults. Github: #995 Change-Id: I7cf5d5ef7e2531f397ad97baf4663e3763072f6b Signed-off-by: Gianmarco De Gregori --- M src/openvpn/socket.c 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/55/1555/2 diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 8d2d110..3c1d734 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1357,6 +1357,13 @@ proto =3D o->ce.proto; } + /* If --lport is specified in a client connection block, + * it takes precedence over the global setting. */ + if (o->mode =3D=3D MODE_POINT_TO_POINT && o->ce.local_port_defined) + { + port =3D o->ce.local_port; + } + if (c->mode =3D=3D CM_CHILD_TCP || c->mode =3D=3D CM_CHILD_UDP) { struct link_socket *tmp_sock =3D NULL; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1555?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I7cf5d5ef7e2531f397ad97baf4663e3763072f6b Gerrit-Change-Number: 1555 Gerrit-PatchSet: 2 Gerrit-Owner: its_Giaan Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: its_Giaan Gerrit-Attention: ordex --npQggtYr1jE= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: its_Giaan, ordex, plaisthos.

its_Giaan uploaded patch set #2 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/1555?usp=3Demail">View Chan= ge

The following approvals got outdated and were removed: Code-Review-1 by ordex

socket: restore per-connection lpor=
t override over global default

OpenVPN 2.7.x introduced a regression= where --lport specified
inside a <connection> block did not overr= ide a globally defined
local port. As a result, the socket was bound to = the global
default port instead of the per-connection value.

Adju= st the socket local_port selection logic to honour
local_port_defined wh= en set for the active connection profile.

This change restores the d= ocumented and previously working
behaviour from 2.6.x, where connection-= level lport takes
precedence over global defaults.

Github: #995
Change-Id: I7cf5d5ef7e2531f397ad97baf4663e3763072f6b
Signed-off-by= : Gianmarco De Gregori <gianmarco@...2726...>
---
M src/openvpn= /socket.c
1 file changed, 7 insertions(+), 0 deletions(-)

<= pre class=3D"blocks" style=3D"font-family: monospace,monospace; white-space= : pre-wrap;">git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/5= 5/1555/2
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 8d2d110..3c1d734 100644
--- a/src/open= vpn/socket.c
+++ b/src/openvpn/socket.c
@@ = -1357,6 +1357,13 @@
proto =3D o->ce.proto;
}

+ /* If --lport is specified in a client connection bloc= k,
+ * it takes p= recedence over the global setting. */
+ if (o->mode =3D=3D MODE_POINT_TO_POINT && = o->ce.local_port_defined)
+ {
+ = port =3D o->ce.local_port;
+ }
+<= /span>
if (c->mode =3D=3D CM_CHILD_TCP || c->mode =3D= =3D CM_CHILD_UDP)
{
struct li= nk_socket *tmp_sock =3D NULL;

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7cf5d5ef7e2531f397ad97baf46= 63e3763072f6b
Gerrit-Change-Number: 1555
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <gianmarco@...2786...= ..>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
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: its_Giaan <gianmarco@...1665...= 726...>
Gerrit-Attention: ordex <antonio@...2726...= >
= --npQggtYr1jE=--