From: "stipa (Code Review)" Date: Thu, 21 Nov 2024 18:07:54 +0000 References: Reply-To: lstipakov@...277..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="wY8WqgL3G2s="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: dco-win: simplity do_close_link_socket() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --wY8WqgL3G2s= 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/+/813?usp=3Demail to review the following change. Change subject: dco-win: simplity do_close_link_socket() ...................................................................... dco-win: simplity 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(+), 8 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/13/813/1 diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 9371024..656fedf 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -3940,16 +3940,16 @@ 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_socket) - { - c->c2.link_socket->sd =3D SOCKET_UNDEFINED; - } - if (c->c2.link_socket && c->c2.link_socket_owned) { + /* 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_socket->sd =3D SOCKET_UNDEFINED; + } + link_socket_close(c->c2.link_socket); c->c2.link_socket =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: 1 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --wY8WqgL3G2s= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

stipa would like plaisthos and flichtenheld to review t= his change.

Vi= ew Change

dco-win: simplity do_close_link_socket()

c->c2.link= _socket_owned is true in client mode
and for the global context in the s= erver mode -
those are exactly the cases when we want to
set sd to un= defined when using dco-win.

Change-Id: I3232dd8d855ca3f198b4ca3b2ef4= f67cec49f3d4
Signed-off-by: Lev Stipakov <lev@...515...>
---M src/openvpn/init.c
1 file changed, 8 insertions(+), 8 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/13/813=
/1
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
<= span>index 9371024..656fedf 100644
--- a/src/openvpn/init.c=
+++ b/src/openvpn/init.c
@@ -3940,16 +3940= ,16 @@
static void
do_close_link_socket(s= truct context *c)
{
- /* in dco-win case, link socket is a tun handle which is=
- * closed in do_c= lose_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_socket)
- {
- c->c2.link_socket->sd =3D SOCKET_UNDEFINED;
<= span style=3D"color: hsl(0, 100%, 40%);">- }
-
if (c->c2.link_socket &a= mp;& c->c2.link_socket_owned)
{
+ /* in dco-win case, link so= cket is a tun handle which is
+ * closed in do_close_tun(). Set it to UNDEFINED so

+ * we won't u= se WinSock API to close it. */
+ if (tuntap_is_dco_win(c->c1.tuntap))
+ {
+ c->c2.link_socket->sd =3D SO= CKET_UNDEFINED;
+ = }
+
link_socket_close(c->c2.link_socket);
= c->c2.link_socket =3D NULL;
}

To view, visit change 813. To unsubscribe, or for help writing= mail filters, visit setting= s.

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