Skip to contentSkip to conversation

Change in openvpn[master]: dco-win: simplity do_close_link_socket()

Openvpn-devel In review stipa (Code Review) 2 participants 11 messages Nov 21, 2024 – Dec 31, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1732212459000.I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4@...2715...

#1 lore raw

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=email

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

---
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

src/openvpn/init.c +8 -8
index 9371024..656fedf 100644
@@ -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 = 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 = SOCKET_UNDEFINED;
+        }
+
         link_socket_close(c->c2.link_socket);
         c->c2.link_socket = NULL;
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, stipa.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/813?usp=email )

Change subject: dco-win: simplity do_close_link_socket()
......................................................................

Patch Set 1: Code-Review+2

(1 comment)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/813/comment/60683b6c_15115aef :
PS1, Line 7: dco-win: simplity do_close_link_socket() "simplify" ?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Fri, 22 Nov 2024 14:35:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/813?usp=email )

Change subject: dco-win: simplity do_close_link_socket()
......................................................................

Patch Set 1:

(1 comment)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/813/comment/16e659f9_3180727f :
PS1, Line 7: dco-win: simplity do_close_link_socket()

Quoted 1 line

"simplify" ?

Acknowledged

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Fri, 22 Nov 2024 15:07:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: dco-win: simplify do_close_link_socket()

In reply to a message not in the archive

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=email

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~ChecksSubmitRule 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

---
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

src/openvpn/init.c +8 -8
index 9371024..656fedf 100644
@@ -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 = 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 = SOCKET_UNDEFINED;
+        }
+
         link_socket_close(c->c2.link_socket);
         c->c2.link_socket = NULL;
     }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#5 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: dco-win: simplify do_close_link_socket()

In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/813?usp=email )

Change subject: dco-win: simplify do_close_link_socket()
......................................................................

Patch Set 5: Code-Review-1

(1 comment)

Patchset:

PS5:
This conflicts with https://gerrit.openvpn.net/c/openvpn/+/434/9/src/openvpn/init.c#4013

I want to move onwards with #434 first (as this is close to merging), and when this is done, come back here and rework the simplification into the new for() loop.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 5
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Sun, 29 Dec 2024 14:13:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#6 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: dco-win: simplify do_close_link_socket()

In reply to a message not in the archive

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=email

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

---
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

src/openvpn/init.c +8 -11
index 850cd12..2bd5518 100644
@@ -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 = 0; i < c->c1.link_sockets_num; i++)
-        {
-            c->c2.link_sockets[i]->sd = SOCKET_UNDEFINED;
-        }
-    }
-
     if (c->c2.link_sockets && c->c2.link_socket_owned)
     {
         for (int i = 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 = SOCKET_UNDEFINED;
+            }
+
             link_socket_close(c->c2.link_sockets[i]);
         }
         c->c2.link_sockets = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 7
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#7 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: dco-win: simplify do_close_link_socket()

In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/813?usp=email )

Change subject: dco-win: simplify do_close_link_socket()
......................................................................

Patch Set 7: Code-Review+2

(1 comment)

Patchset:

PS7:
Test compiled on MinGW, looks reasonable

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 7
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Tue, 31 Dec 2024 14:53:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#8 lore raw

PATCH v7 1/1 dco-win: simplify do_close_link_socket()

In reply to a message not in the archive

From: Lev Stipakov <[email protected]...>

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

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/813
This mail reflects revision 7 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/init.c +8 -11
index 850cd12..2bd5518 100644
@@ -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 = 0; i < c->c1.link_sockets_num; i++)
-        {
-            c->c2.link_sockets[i]->sd = SOCKET_UNDEFINED;
-        }
-    }
-
     if (c->c2.link_sockets && c->c2.link_socket_owned)
     {
         for (int i = 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 = SOCKET_UNDEFINED;
+            }
+
             link_socket_close(c->c2.link_sockets[i]);
         }
         c->c2.link_sockets = NULL;
#9 lore raw

[Openvpn-devel] [PATCH applied] Re: dco-win: simplify do_close_link_socket()

Looks reasonable, does the same thing with less lines of code, adjusted to multisocket. Test compiled on ubuntu/mingw.

Your patch has been applied to the master branch.

commit 1452625bc364cb5847daedaad238c7a5eb3eff5e

Author: Lev Stipakov
Date:   Tue Dec 31 15:54:17 2024 +0100
     dco-win: simplify do_close_link_socket()

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg30328.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#10 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: dco-win: simplify do_close_link_socket()

In reply to a message not in the archive

cron2 has uploaded a new patch set (#8) to the change originally created by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/813?usp=email )

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

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30328.html

---
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

src/openvpn/init.c +8 -11
index 850cd12..2bd5518 100644
@@ -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 = 0; i < c->c1.link_sockets_num; i++)
-        {
-            c->c2.link_sockets[i]->sd = SOCKET_UNDEFINED;
-        }
-    }
-
     if (c->c2.link_sockets && c->c2.link_socket_owned)
     {
         for (int i = 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 = SOCKET_UNDEFINED;
+            }
+
             link_socket_close(c->c2.link_sockets[i]);
         }
         c->c2.link_sockets = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 8
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#11 lore raw

[Openvpn-devel] [S] Change in openvpn[master]: dco-win: simplify do_close_link_socket()

In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/813?usp=email )

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

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30328.html

---
M src/openvpn/init.c

1 file changed, 8 insertions(+), 11 deletions(-)
src/openvpn/init.c +8 -11
index 850cd12..2bd5518 100644
@@ -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 = 0; i < c->c1.link_sockets_num; i++)
-        {
-            c->c2.link_sockets[i]->sd = SOCKET_UNDEFINED;
-        }
-    }
-
     if (c->c2.link_sockets && c->c2.link_socket_owned)
     {
         for (int i = 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 = SOCKET_UNDEFINED;
+            }
+
             link_socket_close(c->c2.link_sockets[i]);
         }
         c->c2.link_sockets = NULL;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/813?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3232dd8d855ca3f198b4ca3b2ef4f67cec49f3d4
Gerrit-Change-Number: 813
Gerrit-PatchSet: 8
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged