From: "cron2 (Code Review)" Date: Mon, 30 Mar 2026 11:28:19 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., gianmarco@...2726..., openvpn-devel@lists.sourceforge.net, antonio@...2726... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="E9tJXQe4gzQ="; 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: its_Giaan , plaisthos Cc: openvpn-devel --E9tJXQe4gzQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1555?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 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: closes OpenVPN/openvpn#995 Change-Id: I7cf5d5ef7e2531f397ad97baf4663e3763072f6b Signed-off-by: Gianmarco De Gregori Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1555 Message-Id: <20260316134841.28362-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36= 164.html Signed-off-by: Gert Doering --- M src/openvpn/socket.c 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/55/1555/3 diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 5df0792..624ce4f 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: 3 Gerrit-Owner: its_Giaan Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --E9tJXQe4gzQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #3 to the change originally created by its_Giaan.<= /p>

Vi= ew Change

The following approvals got outdated and were removed: Code-Review+2 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: closes= OpenVPN/openvpn#995

Change-Id: I7cf5d5ef7e2531f397ad97baf4663e37630= 72f6b
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>Acked-by: Antonio Quartulli <antonio@...2726...>
Gerrit URL: htt= ps://gerrit.openvpn.net/c/openvpn/+/1555
Message-Id: <20260316134841.= 28362-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-de= vel@lists.sourceforge.net/msg36164.html
Signed-off-by: Gert Doering <= gert@...1296...>
---
M src/openvpn/socket.c
1 file changed, 7 i= nsertions(+), 0 deletions(-)

git pull ssh://gerr=
it.openvpn.net:29418/openvpn refs/changes/55/1555/3
diff --git a/sr=
c/openvpn/socket.c b/src/openvpn/socket.c
index 5df0792..62= 4ce4f 100644
--- a/src/openvpn/socket.c
+++= b/src/openvpn/socket.c
@@ -1357,6 +1357,13 @@
proto =3D o->ce.proto;
}

+ /* If --lpo= rt is specified in a client connection block,
+ * it takes precedence over the global settin= g. */
+ if (o->= mode =3D=3D MODE_POINT_TO_POINT && o->ce.local_port_defined)

+ {
+ port =3D o->ce.local_port;=
+ }
+
if (c->m= ode =3D=3D CM_CHILD_TCP || c->mode =3D=3D CM_CHILD_UDP)
= {
struct link_socket *tmp_sock =3D NULL;

To view, visit change 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: 3
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>
= --E9tJXQe4gzQ=--