From: "cron2 (Code Review)" Date: Tue, 31 Dec 2024 15:31:12 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="0iJBTATFrK8="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dco-win: simplify do_close_link_socket() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stipa , plaisthos , flichtenheld Cc: openvpn-devel --0iJBTATFrK8= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#8) to the change originally created by= stipa. ( http://gerrit.openvpn.net/c/openvpn/+/813?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: dco-win: simplify do_close_link_socket() ...................................................................... dco-win: simplify do_close_link_socket() c->c2.link_socket_owned is true in client mode and for the global context in the server mode - those are exactly the cases when we want to set sd to undefined when using dco-win. Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4 Signed-off-by: Lev Stipakov Acked-by: Gert Doering Message-Id: <20241231145417.12128-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 328.html Signed-off-by: Gert Doering --- M src/openvpn/init.c 1 file changed, 8 insertions(+), 11 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/13/813/8 diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 850cd12..2bd5518 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -4018,21 +4018,18 @@ static void do_close_link_socket(struct context *c) { - /* in dco-win case, link socket is a tun handle which is - * closed in do_close_tun(). Set it to UNDEFINED so - * we won't use WinSock API to close it. */ - if (tuntap_is_dco_win(c->c1.tuntap) && c->c2.link_sockets) - { - for (int i =3D 0; i < c->c1.link_sockets_num; i++) - { - c->c2.link_sockets[i]->sd =3D SOCKET_UNDEFINED; - } - } - if (c->c2.link_sockets && c->c2.link_socket_owned) { for (int i =3D 0; i < c->c1.link_sockets_num; i++) { + /* in dco-win case, link socket is a tun handle which is + * closed in do_close_tun(). Set it to UNDEFINED so + * we won't use WinSock API to close it. */ + if (tuntap_is_dco_win(c->c1.tuntap)) + { + c->c2.link_sockets[i]->sd =3D SOCKET_UNDEFINED; + } + link_socket_close(c->c2.link_sockets[i]); } c->c2.link_sockets =3D NULL; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?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: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4 Gerrit-Change-Number: 813 Gerrit-PatchSet: 8 Gerrit-Owner: stipa Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --0iJBTATFrK8= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #8 to the change originally cr= eated by stipa.

View Change

The following approvals got outdated and= were removed: Code-Review+2 by cron2

dco-win: simplify do_close_link_socket()

c-&g= t;c2.link_socket_owned is true in client mode
and for the global context= in the server mode -
those are exactly the cases when we want to
set= sd to undefined when using dco-win.

Change-Id: I3232dd8d855ca3f198b= 4ca3b2ef4f67cec49f3d4
Signed-off-by: Lev Stipakov <lev@...515...><= br>Acked-by: Gert Doering <gert@...1296...>
Message-Id: <202412= 31145417.12128-1-gert@...1296...>
URL: https://www.mail-archive.com/o= penvpn-devel@lists.sourceforge.net/msg30328.html
Signed-off-by: Gert Doe= ring <gert@...1296...>
---
M src/openvpn/init.c
1 file chang= ed, 8 insertions(+), 11 deletions(-)

git pull ssh://gerrit.openvp=
n.net:29418/openvpn refs/changes/13/813/8
diff --git a/src/openvpn/=
init.c b/src/openvpn/init.c
index 850cd12..2bd5518 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/i= nit.c
@@ -4018,21 +4018,18 @@
static void<= /span>
do_close_link_socket(struct context *c)
{=
- /* in dco-win cas= e, link socket is a tun handle which is
- * closed in do_close_tun(). Set it to UNDEFINED so
- * we won't use= WinSock API to close it. */
- if (tuntap_is_dco_win(c->c1.tuntap) && c->c2.link_= sockets)
- {<= br>- for (int i =3D 0; i &= lt; c->c1.link_sockets_num; i++)
- {
- c->c2.link_sockets[i]->sd =3D SOCKET_UNDEFINED;<= br>- }
- }
-
if (c->c2.link_sockets &&= ; c->c2.link_socket_owned)
{
= for (int i =3D 0; i < c->c1.link_sockets_num; i++)
{

+ = /* in dco-win case, link socket is a tun handle which is
+ * closed in do_close_= tun(). Set it to UNDEFINED so

+ * we won't use WinSock API to close it. */
+ if (tuntap_is= _dco_win(c->c1.tuntap))
+ {
= + c->c2.link_sockets[i]->sd =3D SOCKET_UNDEFINED;
+ }
= +
= link_socket_close(c->c2.link_sockets[i]);
}
c->c2.link_sockets =3D NULL;

To view, visit change 813. To unsubscribe, or for help writing ma= il filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef= 4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 8
Gerrit-Owner: stipa <lstipakov@...277...>= ;
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-MessageType: newpatchset
--0iJBTATFrK8=--