Skip to contentSkip to conversation

Change in openvpn[master]: Add ASSERT to afunix code that dev_node is always the way we expect

Openvpn-devel In review plaisthos (Code Review) 2 participants 7 messages Oct 27, 2025 – Oct 28, 2025 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.1761601339000.Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e@...2715...

#1 lore raw

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1320?usp=email

to review the following change.

Change subject: Add ASSERT to afunix code that dev_node is always the way we expect
......................................................................

Add ASSERT to afunix code that dev_node is always the way we expect

The calling code only calls tun_afunix_exec_child if is_tun_afunix which checks that the path is having unix: as prefix.

But since adding an ASSERT here to ensure that it is really the case does not cost us anything, just add the ASSERT.

Found-By Zeropath
Change-Id Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e

---
M src/openvpn/tun_afunix.c

1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1320/1

src/openvpn/tun_afunix.c +2 -0
index 4d48a31..e6f2be1 100644
@@ -53,6 +53,8 @@
     const char *msgprefix = "ERROR: failure executing process for tun:";
     struct argv argv = argv_new();
 
+    /* we should always called with a proper unix: dev node string */
+    ASSERT(dev_node && strncmp(dev_node, "unix:", strlen("unix:")) == 0);
     /* since we know that dev-node starts with unix: we can just skip that
      * to get the program name */
     const char *program = dev_node + strlen("unix:");

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

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

#2 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: Add ASSERT to afunix code that dev_node is always set up the way we e...

In reply to a message not in the archive

Attention is currently required from: flichtenheld.

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

Change subject: Add ASSERT to afunix code that dev_node is always set up the way we expect
......................................................................

Add ASSERT to afunix code that dev_node is always set up the way we expect

The calling code only calls tun_afunix_exec_child if is_tun_afunix is true, which checks that the path is having unix: as prefix.

But since adding an ASSERT here to ensure that it is really the case does not cost us anything, just add the ASSERT.

Found-By Zeropath

Change-Id: Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e
---
M src/openvpn/tun_afunix.c

1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1320/2

src/openvpn/tun_afunix.c +2 -0
index 4d48a31..e6f2be1 100644
@@ -53,6 +53,8 @@
     const char *msgprefix = "ERROR: failure executing process for tun:";
     struct argv argv = argv_new();
 
+    /* we should always called with a proper unix: dev node string */
+    ASSERT(dev_node && strncmp(dev_node, "unix:", strlen("unix:")) == 0);
     /* since we know that dev-node starts with unix: we can just skip that
      * to get the program name */
     const char *program = dev_node + strlen("unix:");

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

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

#3 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: Add ASSERT to afunix code that dev_node is always set up the way we e...

In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

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

Change subject: Add ASSERT to afunix code that dev_node is always set up the way we expect
......................................................................

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e
Gerrit-Change-Number: 1320
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 28 Oct 2025 11:59:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#4 lore raw

PATCH v2 1/1 Add ASSERT to afunix code that dev_node is always set up the way we expect

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

The calling code only calls tun_afunix_exec_child if is_tun_afunix is true, which checks that the path is having unix: as prefix.

But since adding an ASSERT here to ensure that it is really the case does not cost us anything, just add the ASSERT.

Found-By Zeropath
Change-Id Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1320
---

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/+/1320
This mail reflects revision 2 of this Change.

Signed-off-by line for the author was added as per our policy.

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

src/openvpn/tun_afunix.c +2 -0
index 4d48a31..e6f2be1 100644
@@ -53,6 +53,8 @@
     const char *msgprefix = "ERROR: failure executing process for tun:";
     struct argv argv = argv_new();
 
+    /* we should always called with a proper unix: dev node string */
+    ASSERT(dev_node && strncmp(dev_node, "unix:", strlen("unix:")) == 0);
     /* since we know that dev-node starts with unix: we can just skip that
      * to get the program name */
     const char *program = dev_node + strlen("unix:");
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: Add ASSERT to afunix code that dev_node is always set up the way we expect

Looks reasonable, BB is happy, and the unit tests excercising tun_afunix (t_server_null) still pass. Also, I have a t_client test excercising this, which still works :-)

I have updated the commit message a bit (language, Reported-By:), and for one decided to try doing this in gerrit - it works, but is not the best way to do it (it then does a "v2" of the patch, which hides the test result of the actual patch, and creates extra noise on the list).

Your patch has been applied to the master branch.

commit 5bc0eae87ccf1abd6c400cb27d8e51819feb2036

Author: Arne Schwabe
Date:   Tue Oct 28 12:59:47 2025 +0100
     Add ASSERT to afunix code that dev_node is always set up the way we expect

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1320
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg33934.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: Add ASSERT to afunix code that dev_node is always set up the way we e...

In reply to a message not in the archive

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

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

Change subject: Add ASSERT to afunix code that dev_node is always set up the way we expect
......................................................................

Add ASSERT to afunix code that dev_node is always set up the way we expect

The calling code only calls tun_afunix_exec_child if is_tun_afunix is true, which checks that the path is having unix: as prefix.

But since adding an ASSERT here to ensure that it is really the case does not cost us anything, just add the ASSERT.

Found-By Zeropath
Change-Id Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1320
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33934.html

---
M src/openvpn/tun_afunix.c

1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1320/3

src/openvpn/tun_afunix.c +2 -0
index 124db6d..42bcd0d 100644
@@ -53,6 +53,8 @@
     const char *msgprefix = "ERROR: failure executing process for tun:";
     struct argv argv = argv_new();
 
+    /* we should always called with a proper unix: dev node string */
+    ASSERT(dev_node && strncmp(dev_node, "unix:", strlen("unix:")) == 0);
     /* since we know that dev-node starts with unix: we can just skip that
      * to get the program name */
     const char *program = dev_node + strlen("unix:");

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e
Gerrit-Change-Number: 1320
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#7 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: Add ASSERT to afunix code that dev_node is always set up the way we e...

In reply to a message not in the archive

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

Change subject: Add ASSERT to afunix code that dev_node is always set up the way we expect
......................................................................

Add ASSERT to afunix code that dev_node is always set up the way we expect

The calling code only calls tun_afunix_exec_child if is_tun_afunix is true, which checks that the path is having unix: as prefix.

But since adding an ASSERT here to ensure that it is really the case does not cost us anything, just add the ASSERT.

Found-By Zeropath
Change-Id Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1320
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33934.html

---
M src/openvpn/tun_afunix.c

1 file changed, 2 insertions(+), 0 deletions(-)
src/openvpn/tun_afunix.c +2 -0
index 124db6d..42bcd0d 100644
@@ -53,6 +53,8 @@
     const char *msgprefix = "ERROR: failure executing process for tun:";
     struct argv argv = argv_new();
 
+    /* we should always called with a proper unix: dev node string */
+    ASSERT(dev_node && strncmp(dev_node, "unix:", strlen("unix:")) == 0);
     /* since we know that dev-node starts with unix: we can just skip that
      * to get the program name */
     const char *program = dev_node + strlen("unix:");

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

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Idbb7bf279eb467fc1d56ab75a50b5eb2c8d0a57e
Gerrit-Change-Number: 1320
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>