]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
push_util: Make send_push_update static
authorFrank Lichtenheld <frank@lichtenheld.com>
Fri, 17 Oct 2025 20:38:24 +0000 (22:38 +0200)
committerGert Doering <gert@greenie.muc.de>
Fri, 17 Oct 2025 20:46:35 +0000 (22:46 +0200)
Not necessary to make it non-static just for UTs.

Change-Id: I348abec1e2f32301a0368d5f541e67bddf358bbc
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1282
Message-Id: <20251017203830.23807-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59248152/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
CMakeLists.txt
src/openvpn/push.h
src/openvpn/push_util.c
tests/unit_tests/openvpn/Makefile.am
tests/unit_tests/openvpn/test_push_update_msg.c

index b773dcbc9b3a62051033cf752f44601eb6fc5f5f..23fb4a517f50cf77bb8d280665d1875123a8cdec 100644 (file)
@@ -889,7 +889,6 @@ if (BUILD_TESTING)
     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
index 19a029a415439f7a6823aa164fa87d38a6a6b12c..09565b8332c2bd593134e238c01f840f2997b379 100644 (file)
@@ -140,23 +140,6 @@ void send_push_reply_auth_token(struct tls_multi *multi);
 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);
index 0e86ad301cbad9c0dee9691f1fc5eeffc6878491..0eddcae53667098b6223930e260d7009b85cbdd8 100644 (file)
@@ -239,7 +239,21 @@ support_push_update(struct multi_instance *mi)
     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))
index 17aa0cebef25c6e1f0b27311844aaae21b9792cb..997703a876fc96dee67ac5f7134744f0cf2687a1 100644 (file)
@@ -356,7 +356,6 @@ push_update_msg_testdriver_SOURCES = test_push_update_msg.c \
        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
index 7fadb696ad8ba9530c0d113d0f184f8e78ee91e9..516e94cb35520bb3415c69af005bc8631a738790 100644 (file)
@@ -10,6 +10,8 @@
 #include "options_util.h"
 #include "multi.h"
 
+#include "push_util.c"
+
 /* mocks */
 
 void