Skip to contentSkip to conversation

Change in openvpn[master]: push: Make prepare_push_reply return void

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Apr 5 – Apr 6 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.1775421558000.Ied966413948cf3c935a8a1eb91172ef7a6948bdd@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

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

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

to review the following change.

Change subject: push: Make prepare_push_reply return void
......................................................................

push: Make prepare_push_reply return void

It returned a constant value so it didn't actually mean anything.

While here also make it static.

Identified by cppcheck.

Change-Id Ied966413948cf3c935a8a1eb91172ef7a6948bdd

---
M src/openvpn/push.c

1 file changed, 3 insertions(+), 6 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/16/1616/1

src/openvpn/push.c +3 -6
index 835c433..564ce86 100644
@@ -631,10 +631,8 @@
  * @param c             context structure storing data for VPN tunnel
  * @param gc            gc arena for allocating push options
  * @param push_list     push list to where options are added
- *
- * @return true on success, false on failure.
  */
-bool
+static void
 prepare_push_reply(struct context *c, struct gc_arena *gc, struct push_list *push_list)
 {
     struct tls_multi *tls_multi = c->c2.tls_multi;
@@ -734,8 +732,6 @@
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
         }
     }
-
-    return true;
 }
 
 static bool
@@ -1011,7 +1007,8 @@
             struct push_list push_list = { 0 };
             struct gc_arena gc = gc_new();
 
-            if (prepare_push_reply(c, &gc, &push_list) && send_push_reply(c, &push_list))
+            prepare_push_reply(c, &gc, &push_list);
+            if (send_push_reply(c, &push_list))
             {
                 ret = PUSH_MSG_REQUEST;
                 c->c2.sent_push_reply_expiry = now + 30;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1616?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: Ied966413948cf3c935a8a1eb91172ef7a6948bdd
Gerrit-Change-Number: 1616
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

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

Attention is currently required from: flichtenheld, plaisthos.

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

Change subject: push: Make prepare_push_reply return void
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1616?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: Ied966413948cf3c935a8a1eb91172ef7a6948bdd
Gerrit-Change-Number: 1616
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 06 Apr 2026 07:25:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 push: Make prepare_push_reply return void

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

It returned a constant value so it didn't actually mean anything.

While here also make it static.

Identified by cppcheck.

Change-Id Ied966413948cf3c935a8a1eb91172ef7a6948bdd

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

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

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

src/openvpn/push.c +3 -6
index 835c433..564ce86 100644
@@ -631,10 +631,8 @@
  * @param c             context structure storing data for VPN tunnel
  * @param gc            gc arena for allocating push options
  * @param push_list     push list to where options are added
- *
- * @return true on success, false on failure.
  */
-bool
+static void
 prepare_push_reply(struct context *c, struct gc_arena *gc, struct push_list *push_list)
 {
     struct tls_multi *tls_multi = c->c2.tls_multi;
@@ -734,8 +732,6 @@
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
         }
     }
-
-    return true;
 }
 
 static bool
@@ -1011,7 +1007,8 @@
             struct push_list push_list = { 0 };
             struct gc_arena gc = gc_new();
 
-            if (prepare_push_reply(c, &gc, &push_list) && send_push_reply(c, &push_list))
+            prepare_push_reply(c, &gc, &push_list);
+            if (send_push_reply(c, &push_list))
             {
                 ret = PUSH_MSG_REQUEST;
                 c->c2.sent_push_reply_expiry = now + 30;
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: push: Make prepare_push_reply return void

Interesting find. I guess someone in some distant past assumed that we might see failure modes for prepare_push_reply()...

stare-at-code says "this must be fine", but as it affects server code, I subjected it to the t_server testbed which does excercise PUSH quite a bit :-) - and everything still works.

Your patch has been applied to the master branch.

commit 5d7068fa181edd472cb55889bd8fdfe246ecede4

Author: Frank Lichtenheld
Date:   Mon Apr 6 09:26:11 2026 +0200
     push: Make prepare_push_reply return void

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1616
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg36514.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

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

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

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

Change subject: push: Make prepare_push_reply return void
......................................................................

push: Make prepare_push_reply return void

It returned a constant value so it didn't actually mean anything.

While here also make it static.

Identified by cppcheck.

Change-Id Ied966413948cf3c935a8a1eb91172ef7a6948bdd

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

---
M src/openvpn/push.c

1 file changed, 3 insertions(+), 6 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/16/1616/2

src/openvpn/push.c +3 -6
index 835c433..564ce86 100644
@@ -631,10 +631,8 @@
  * @param c             context structure storing data for VPN tunnel
  * @param gc            gc arena for allocating push options
  * @param push_list     push list to where options are added
- *
- * @return true on success, false on failure.
  */
-bool
+static void
 prepare_push_reply(struct context *c, struct gc_arena *gc, struct push_list *push_list)
 {
     struct tls_multi *tls_multi = c->c2.tls_multi;
@@ -734,8 +732,6 @@
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
         }
     }
-
-    return true;
 }
 
 static bool
@@ -1011,7 +1007,8 @@
             struct push_list push_list = { 0 };
             struct gc_arena gc = gc_new();
 
-            if (prepare_push_reply(c, &gc, &push_list) && send_push_reply(c, &push_list))
+            prepare_push_reply(c, &gc, &push_list);
+            if (send_push_reply(c, &push_list))
             {
                 ret = PUSH_MSG_REQUEST;
                 c->c2.sent_push_reply_expiry = now + 30;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1616?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: Ied966413948cf3c935a8a1eb91172ef7a6948bdd
Gerrit-Change-Number: 1616
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

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

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

Change subject: push: Make prepare_push_reply return void
......................................................................

push: Make prepare_push_reply return void

It returned a constant value so it didn't actually mean anything.

While here also make it static.

Identified by cppcheck.

Change-Id Ied966413948cf3c935a8a1eb91172ef7a6948bdd

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

---
M src/openvpn/push.c

1 file changed, 3 insertions(+), 6 deletions(-)
src/openvpn/push.c +3 -6
index 835c433..564ce86 100644
@@ -631,10 +631,8 @@
  * @param c             context structure storing data for VPN tunnel
  * @param gc            gc arena for allocating push options
  * @param push_list     push list to where options are added
- *
- * @return true on success, false on failure.
  */
-bool
+static void
 prepare_push_reply(struct context *c, struct gc_arena *gc, struct push_list *push_list)
 {
     struct tls_multi *tls_multi = c->c2.tls_multi;
@@ -734,8 +732,6 @@
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
         }
     }
-
-    return true;
 }
 
 static bool
@@ -1011,7 +1007,8 @@
             struct push_list push_list = { 0 };
             struct gc_arena gc = gc_new();
 
-            if (prepare_push_reply(c, &gc, &push_list) && send_push_reply(c, &push_list))
+            prepare_push_reply(c, &gc, &push_list);
+            if (send_push_reply(c, &push_list))
             {
                 ret = PUSH_MSG_REQUEST;
                 c->c2.sent_push_reply_expiry = now + 30;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1616?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: Ied966413948cf3c935a8a1eb91172ef7a6948bdd
Gerrit-Change-Number: 1616
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>