From: "stipa (Code Review)" Date: Tue, 31 Dec 2024 10:54:07 +0000 In-Reply-To: References: Reply-To: lstipakov@...277..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., gert@...1296... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="/qAXKyDhQ6s="; 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: plaisthos , cron2 , flichtenheld Cc: openvpn-devel --/qAXKyDhQ6s= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, flichtenheld, plaisthos, stipa. Hello cron2, flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=3Demail to look at the new patch set (#7). The following approvals got outdated and were removed: Code-Review-1 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 --- M src/openvpn/init.c 1 file changed, 8 insertions(+), 11 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/13/813/7 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: 7 Gerrit-Owner: stipa Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-Attention: stipa Gerrit-MessageType: newpatchset --/qAXKyDhQ6s= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: cron2, flichtenheld, plaisthos, s= tipa.

stipa uploaded patch set #7 to this change.

View Change

The following approvals got outdated and were removed: Code-Review-1 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>---
M src/openvpn/init.c
1 file changed, 8 insertions(+), 11 delet= ions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/chan=
ges/13/813/7
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 850cd12..2bd5518 100644
--- a/src/open= vpn/init.c
+++ b/src/openvpn/init.c
@@ -401= 8,21 +4018,18 @@
static void
do_close_lin= k_socket(struct context *c)
{
- /* in dco-win case, link socket is a tun handl= e which is
- * clos= ed in do_close_tun(). Set it to UNDEFINED so
- * we won't use WinSock API to close it. */<= /span>
- 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_s= ockets[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 w= on't use WinSock API to close it. */
+ if (tuntap_is_dco_win(c->c1.tuntap))
+ {+ c->c2.lin= k_sockets[i]->sd =3D SOCKET_UNDEFINED;
+ }
+
link_socket_close(c->c2.li= nk_sockets[i]);
}
c->c= 2.link_sockets =3D NULL;

To view, visit= change 8= 13. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef= 4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 7
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-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: cron2 <gert@...1296...>= ;
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: stipa <lstipakov@...1663...= .>
Gerrit-MessageType: newpatchset
--/qAXKyDhQ6s=--