From: "stipa (Code Review)" Date: Fri, 22 Nov 2024 15:36:03 +0000 In-Reply-To: References: Reply-To: lstipakov@...277..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <62ea5e82cbcda10c17d6ca9d639c07f36627de84-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="2hYIB/AX+Bs="; 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 , flichtenheld Cc: openvpn-devel --2hYIB/AX+Bs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello 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 (#2). The following approvals got outdated and were removed: Code-Review+2 by flichtenheld The change is no longer submittable: Code-Review and checks~ChecksSubmitRul= e are unsatisfied now. 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(+), 8 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/13/813/2 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: 2 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newpatchset --2hYIB/AX+Bs= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

stipa uploaded patch set #2 to this change.

View Change

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

The change is no longer submittable: Co= de-Review and checks~ChecksSubmitRule are unsatisfied now.

dco-win: simplif=
y do_close_link_socket()

c->c2.link_socket_owned is true in clien= t mode
and for the global context in the server mode -
those are exac= tly the cases when we want to
set sd to undefined when using dco-win.
Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Signed-off-by:= Lev Stipakov <lev@...515...>
---
M src/openvpn/init.c
1 fil= e changed, 8 insertions(+), 8 deletions(-)

git pull ssh://gerrit.=
openvpn.net:29418/openvpn refs/changes/13/813/2
diff --git a/src/op=
envpn/init.c b/src/openvpn/init.c
index 9371024..656fedf 10= 0644
--- a/src/openvpn/init.c
+++ b/src/ope= nvpn/init.c
@@ -3940,16 +3940,16 @@
static= void
do_close_link_socket(struct context *c)
{
- /* in dco-w= in case, link socket is a tun handle which is
- * closed in do_close_tun(). Set it to UNDEFINE= D 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_so= cket->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<= /span>
+ * 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 NU= LL;
}

To view, vis= it change= 813. 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: 2
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: newpatchset
--2hYIB/AX+Bs=--