Skip to contentSkip to conversation

Change in openvpn[master]: push_util: Make send_push_update static

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Oct 17, 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.1760698129000.I348abec1e2f32301a0368d5f541e67bddf358bbc@...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/+/1282?usp=email

to review the following change.

Change subject: push_util: Make send_push_update static
......................................................................

push_util: Make send_push_update static

Not necessary to make it non-static just for UTs.

Change-Id I348abec1e2f32301a0368d5f541e67bddf358bbc

---
M CMakeLists.txt
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c

5 files changed, 17 insertions(+), 20 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/82/1282/1

CMakeLists.txt +0 -1
index b773dcb..23fb4a5 100644
@@ -889,7 +889,6 @@
     target_sources(test_push_update_msg PRIVATE
         tests/unit_tests/openvpn/mock_msg.c
         tests/unit_tests/openvpn/mock_get_random.c
-        src/openvpn/push_util.c
         src/openvpn/options_util.c
         src/openvpn/otime.c
         src/openvpn/list.c
src/openvpn/push.h +0 -17
index 6b3275e..fa72732 100644
@@ -139,23 +139,6 @@
 void receive_auth_pending(struct context *c, const struct buffer *buffer);
 
 #ifdef ENABLE_MANAGEMENT
-/**
- * @brief A function to send a PUSH_UPDATE control message from server to client(s).
- *
- * @param m the multi_context, contains all the clients connected to this server.
- * @param target the target to which to send the message. It should be:
- * `NULL` if `type == UPT_BROADCAST`,
- * a `mroute_addr *` if `type == UPT_BY_ADDR`,
- * a `char *` if `type == UPT_BY_CN`,
- * an `unsigned long *` if `type == UPT_BY_CID`.
- * @param msg a string containing the options to send.
- * @param type the way to address the message (broadcast, by cid, by cn, by address).
- * @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
- * @return the number of clients to which the message was sent.
- */
-int
-send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size);
-
 bool management_callback_send_push_update_broadcast(void *arg, const char *options);
 
 bool management_callback_send_push_update_by_cid(void *arg, unsigned long cid, const char *options);
src/openvpn/push_util.c +15 -1
index 25c6ebe..06b4c8b 100644
@@ -204,7 +204,21 @@
     return true;
 }
 
-int
+/**
+ * @brief A function to send a PUSH_UPDATE control message from server to client(s).
+ *
+ * @param m the multi_context, contains all the clients connected to this server.
+ * @param target the target to which to send the message. It should be:
+ * `NULL` if `type == UPT_BROADCAST`,
+ * a `mroute_addr *` if `type == UPT_BY_ADDR`,
+ * a `char *` if `type == UPT_BY_CN`,
+ * an `unsigned long *` if `type == UPT_BY_CID`.
+ * @param msg a string containing the options to send.
+ * @param type the way to address the message (broadcast, by cid, by cn, by address).
+ * @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
+ * @return The number of clients to which the message was sent. Might return < 0 in case of error.
+ */
+static int
 send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size)
 {
     if (dco_enabled(&m->top.options))
tests/unit_tests/openvpn/Makefile.am +0 -1
index 17aa0ce..997703a 100644
@@ -356,7 +356,6 @@
 	mock_get_random.c \
 	$(top_srcdir)/src/openvpn/buffer.c \
 	$(top_srcdir)/src/openvpn/platform.c \
-	$(top_srcdir)/src/openvpn/push_util.c \
 	$(top_srcdir)/src/openvpn/options_util.c \
 	$(top_srcdir)/src/openvpn/otime.c \
 	$(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +2 -0
index 60596ed..91b60ba 100644
@@ -10,6 +10,8 @@
 #include "options_util.h"
 #include "multi.h"
 
+#include "push_util.c"
+
 /* mocks */
 
 void

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1282?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: I348abec1e2f32301a0368d5f541e67bddf358bbc
Gerrit-Change-Number: 1282
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/+/1282?usp=email )

Change subject: push_util: Make send_push_update static
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1282?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: I348abec1e2f32301a0368d5f541e67bddf358bbc
Gerrit-Change-Number: 1282
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: Fri, 17 Oct 2025 20:38:15 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 push_util: Make send_push_update static

In reply to a message not in the archive

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

Not necessary to make it non-static just for UTs.

Change-Id I348abec1e2f32301a0368d5f541e67bddf358bbc

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

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

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

CMakeLists.txt +0 -1
index b773dcb..23fb4a5 100644
@@ -889,7 +889,6 @@
     target_sources(test_push_update_msg PRIVATE
         tests/unit_tests/openvpn/mock_msg.c
         tests/unit_tests/openvpn/mock_get_random.c
-        src/openvpn/push_util.c
         src/openvpn/options_util.c
         src/openvpn/otime.c
         src/openvpn/list.c
src/openvpn/push.h +0 -17
index 6b3275e..fa72732 100644
@@ -139,23 +139,6 @@
 void receive_auth_pending(struct context *c, const struct buffer *buffer);
 
 #ifdef ENABLE_MANAGEMENT
-/**
- * @brief A function to send a PUSH_UPDATE control message from server to client(s).
- *
- * @param m the multi_context, contains all the clients connected to this server.
- * @param target the target to which to send the message. It should be:
- * `NULL` if `type == UPT_BROADCAST`,
- * a `mroute_addr *` if `type == UPT_BY_ADDR`,
- * a `char *` if `type == UPT_BY_CN`,
- * an `unsigned long *` if `type == UPT_BY_CID`.
- * @param msg a string containing the options to send.
- * @param type the way to address the message (broadcast, by cid, by cn, by address).
- * @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
- * @return the number of clients to which the message was sent.
- */
-int
-send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size);
-
 bool management_callback_send_push_update_broadcast(void *arg, const char *options);
 
 bool management_callback_send_push_update_by_cid(void *arg, unsigned long cid, const char *options);
src/openvpn/push_util.c +15 -1
index 25c6ebe..06b4c8b 100644
@@ -204,7 +204,21 @@
     return true;
 }
 
-int
+/**
+ * @brief A function to send a PUSH_UPDATE control message from server to client(s).
+ *
+ * @param m the multi_context, contains all the clients connected to this server.
+ * @param target the target to which to send the message. It should be:
+ * `NULL` if `type == UPT_BROADCAST`,
+ * a `mroute_addr *` if `type == UPT_BY_ADDR`,
+ * a `char *` if `type == UPT_BY_CN`,
+ * an `unsigned long *` if `type == UPT_BY_CID`.
+ * @param msg a string containing the options to send.
+ * @param type the way to address the message (broadcast, by cid, by cn, by address).
+ * @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
+ * @return The number of clients to which the message was sent. Might return < 0 in case of error.
+ */
+static int
 send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size)
 {
     if (dco_enabled(&m->top.options))
tests/unit_tests/openvpn/Makefile.am +0 -1
index 17aa0ce..997703a 100644
@@ -356,7 +356,6 @@
 	mock_get_random.c \
 	$(top_srcdir)/src/openvpn/buffer.c \
 	$(top_srcdir)/src/openvpn/platform.c \
-	$(top_srcdir)/src/openvpn/push_util.c \
 	$(top_srcdir)/src/openvpn/options_util.c \
 	$(top_srcdir)/src/openvpn/otime.c \
 	$(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +2 -0
index 60596ed..91b60ba 100644
@@ -10,6 +10,8 @@
 #include "options_util.h"
 #include "multi.h"
 
+#include "push_util.c"
+
 /* mocks */
 
 void
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: push_util: Make send_push_update static

This one is fairly trivial - "if it compiles and the UT passes". It does.

Your patch has been applied to the master branch.

commit 160e994d7279ef0a632ee60bb2a7e1415662783a

Author: Frank Lichtenheld
Date:   Fri Oct 17 22:38:24 2025 +0200
     push_util: Make send_push_update static

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1282
     Message-Id: <[email protected]...>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59248152/
     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/+/1282?usp=email )

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

Change subject: push_util: Make send_push_update static
......................................................................

push_util: Make send_push_update static

Not necessary to make it non-static just for UTs.

Change-Id I348abec1e2f32301a0368d5f541e67bddf358bbc

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1282
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59248152/

---
M CMakeLists.txt
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c

5 files changed, 17 insertions(+), 20 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/82/1282/2

CMakeLists.txt +0 -1
index b773dcb..23fb4a5 100644
@@ -889,7 +889,6 @@
     target_sources(test_push_update_msg PRIVATE
         tests/unit_tests/openvpn/mock_msg.c
         tests/unit_tests/openvpn/mock_get_random.c
-        src/openvpn/push_util.c
         src/openvpn/options_util.c
         src/openvpn/otime.c
         src/openvpn/list.c
src/openvpn/push.h +0 -17
index 19a029a..09565b8 100644
@@ -140,23 +140,6 @@
 void receive_auth_pending(struct context *c, const struct buffer *buffer);
 
 #ifdef ENABLE_MANAGEMENT
-/**
- * @brief A function to send a PUSH_UPDATE control message from server to client(s).
- *
- * @param m the multi_context, contains all the clients connected to this server.
- * @param target the target to which to send the message. It should be:
- * `NULL` if `type == UPT_BROADCAST`,
- * a `mroute_addr *` if `type == UPT_BY_ADDR`,
- * a `char *` if `type == UPT_BY_CN`,
- * an `unsigned long *` if `type == UPT_BY_CID`.
- * @param msg a string containing the options to send.
- * @param type the way to address the message (broadcast, by cid, by cn, by address).
- * @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
- * @return the number of clients to which the message was sent.
- */
-int
-send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size);
-
 bool management_callback_send_push_update_broadcast(void *arg, const char *options);
 
 bool management_callback_send_push_update_by_cid(void *arg, unsigned long cid, const char *options);
src/openvpn/push_util.c +15 -1
index 0e86ad3..0eddcae 100644
@@ -239,7 +239,21 @@
     return true;
 }
 
-int
+/**
+ * @brief A function to send a PUSH_UPDATE control message from server to client(s).
+ *
+ * @param m the multi_context, contains all the clients connected to this server.
+ * @param target the target to which to send the message. It should be:
+ * `NULL` if `type == UPT_BROADCAST`,
+ * a `mroute_addr *` if `type == UPT_BY_ADDR`,
+ * a `char *` if `type == UPT_BY_CN`,
+ * an `unsigned long *` if `type == UPT_BY_CID`.
+ * @param msg a string containing the options to send.
+ * @param type the way to address the message (broadcast, by cid, by cn, by address).
+ * @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
+ * @return The number of clients to which the message was sent. Might return < 0 in case of error.
+ */
+static int
 send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size)
 {
     if (dco_enabled(&m->top.options))
tests/unit_tests/openvpn/Makefile.am +0 -1
index 17aa0ce..997703a 100644
@@ -356,7 +356,6 @@
 	mock_get_random.c \
 	$(top_srcdir)/src/openvpn/buffer.c \
 	$(top_srcdir)/src/openvpn/platform.c \
-	$(top_srcdir)/src/openvpn/push_util.c \
 	$(top_srcdir)/src/openvpn/options_util.c \
 	$(top_srcdir)/src/openvpn/otime.c \
 	$(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +2 -0
index 7fadb69..516e94c 100644
@@ -10,6 +10,8 @@
 #include "options_util.h"
 #include "multi.h"
 
+#include "push_util.c"
+
 /* mocks */
 
 void

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1282?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: I348abec1e2f32301a0368d5f541e67bddf358bbc
Gerrit-Change-Number: 1282
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/+/1282?usp=email )

Change subject: push_util: Make send_push_update static
......................................................................

push_util: Make send_push_update static

Not necessary to make it non-static just for UTs.

Change-Id I348abec1e2f32301a0368d5f541e67bddf358bbc

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1282
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59248152/

---
M CMakeLists.txt
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c

5 files changed, 17 insertions(+), 20 deletions(-)
CMakeLists.txt +0 -1
index b773dcb..23fb4a5 100644
@@ -889,7 +889,6 @@
     target_sources(test_push_update_msg PRIVATE
         tests/unit_tests/openvpn/mock_msg.c
         tests/unit_tests/openvpn/mock_get_random.c
-        src/openvpn/push_util.c
         src/openvpn/options_util.c
         src/openvpn/otime.c
         src/openvpn/list.c
src/openvpn/push.h +0 -17
index 19a029a..09565b8 100644
@@ -140,23 +140,6 @@
 void receive_auth_pending(struct context *c, const struct buffer *buffer);
 
 #ifdef ENABLE_MANAGEMENT
-/**
- * @brief A function to send a PUSH_UPDATE control message from server to client(s).
- *
- * @param m the multi_context, contains all the clients connected to this server.
- * @param target the target to which to send the message. It should be:
- * `NULL` if `type == UPT_BROADCAST`,
- * a `mroute_addr *` if `type == UPT_BY_ADDR`,
- * a `char *` if `type == UPT_BY_CN`,
- * an `unsigned long *` if `type == UPT_BY_CID`.
- * @param msg a string containing the options to send.
- * @param type the way to address the message (broadcast, by cid, by cn, by address).
- * @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
- * @return the number of clients to which the message was sent.
- */
-int
-send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size);
-
 bool management_callback_send_push_update_broadcast(void *arg, const char *options);
 
 bool management_callback_send_push_update_by_cid(void *arg, unsigned long cid, const char *options);
src/openvpn/push_util.c +15 -1
index 0e86ad3..0eddcae 100644
@@ -239,7 +239,21 @@
     return true;
 }
 
-int
+/**
+ * @brief A function to send a PUSH_UPDATE control message from server to client(s).
+ *
+ * @param m the multi_context, contains all the clients connected to this server.
+ * @param target the target to which to send the message. It should be:
+ * `NULL` if `type == UPT_BROADCAST`,
+ * a `mroute_addr *` if `type == UPT_BY_ADDR`,
+ * a `char *` if `type == UPT_BY_CN`,
+ * an `unsigned long *` if `type == UPT_BY_CID`.
+ * @param msg a string containing the options to send.
+ * @param type the way to address the message (broadcast, by cid, by cn, by address).
+ * @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro.
+ * @return The number of clients to which the message was sent. Might return < 0 in case of error.
+ */
+static int
 send_push_update(struct multi_context *m, const void *target, const char *msg, const push_update_type type, const int push_bundle_size)
 {
     if (dco_enabled(&m->top.options))
tests/unit_tests/openvpn/Makefile.am +0 -1
index 17aa0ce..997703a 100644
@@ -356,7 +356,6 @@
 	mock_get_random.c \
 	$(top_srcdir)/src/openvpn/buffer.c \
 	$(top_srcdir)/src/openvpn/platform.c \
-	$(top_srcdir)/src/openvpn/push_util.c \
 	$(top_srcdir)/src/openvpn/options_util.c \
 	$(top_srcdir)/src/openvpn/otime.c \
 	$(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +2 -0
index 7fadb69..516e94c 100644
@@ -10,6 +10,8 @@
 #include "options_util.h"
 #include "multi.h"
 
+#include "push_util.c"
+
 /* mocks */
 
 void

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