[Openvpn-devel,v1] push: Make prepare_push_reply return void

Message ID 20260406072617.27790-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] push: Make prepare_push_reply return void | expand

Commit Message

Gert Doering April 6, 2026, 7:26 a.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

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

While here also make it static.

Identified by cppcheck.

Change-Id: Ied966413948cf3c935a8a1eb91172ef7a6948bdd
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
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 <gert@greenie.muc.de>

Comments

Gert Doering April 6, 2026, 10:30 a.m. UTC | #1
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 <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1616
     Message-Id: <20260406072617.27790-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36514.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/push.c b/src/openvpn/push.c
index 835c433..564ce86 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/push.c
@@ -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;