From: "cron2 (Code Review)" Date: Fri, 17 Oct 2025 20:48:30 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <42d5385adda62b6314a2dcdb60cc73f88f576b6a-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="ePWZD+f2bx8="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: push_util: Make send_push_update static List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --ePWZD+f2bx8= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1282?usp=3Demail ) 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 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1282 Message-Id: <20251017203830.23807-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59248152/ Signed-off-by: Gert Doering --- 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index b773dcb..23fb4a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/openvpn/push.h b/src/openvpn/push.h index 19a029a..09565b8 100644 --- a/src/openvpn/push.h +++ b/src/openvpn/push.h @@ -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 =3D=3D UPT_BROADCAST`, - * a `mroute_addr *` if `type =3D=3D UPT_BY_ADDR`, - * a `char *` if `type =3D=3D UPT_BY_CN`, - * an `unsigned long *` if `type =3D=3D 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, b= y 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); diff --git a/src/openvpn/push_util.c b/src/openvpn/push_util.c index 0e86ad3..0eddcae 100644 --- a/src/openvpn/push_util.c +++ b/src/openvpn/push_util.c @@ -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 =3D=3D UPT_BROADCAST`, + * a `mroute_addr *` if `type =3D=3D UPT_BY_ADDR`, + * a `char *` if `type =3D=3D UPT_BY_CN`, + * an `unsigned long *` if `type =3D=3D 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, b= y 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 retu= rn < 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)) diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvp= n/Makefile.am index 17aa0ce..997703a 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -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 diff --git a/tests/unit_tests/openvpn/test_push_update_msg.c b/tests/unit_t= ests/openvpn/test_push_update_msg.c index 7fadb69..516e94c 100644 --- a/tests/unit_tests/openvpn/test_push_update_msg.c +++ b/tests/unit_tests/openvpn/test_push_update_msg.c @@ -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=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I348abec1e2f32301a0368d5f541e67bddf358bbc Gerrit-Change-Number: 1282 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --ePWZD+f2bx8= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #2 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by cron2

push_util: Make send_push_update st=
atic

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

Change= -Id: I348abec1e2f32301a0368d5f541e67bddf358bbc
Signed-off-by: Frank Lich= tenheld <frank@...2641...>
Acked-by: Gert Doering <gert@...1726...= ...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1282
Messa= ge-Id: <20251017203830.23807-1-gert@...1296...>
URL: https://sourc= eforge.net/p/openvpn/mailman/message/59248152/
Signed-off-by: Gert Doeri= ng <gert@...1296...>
---
M CMakeLists.txt
M src/openvpn/push= .h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.amM tests/unit_tests/openvpn/test_push_update_msg.c
5 files changed, 17 = insertions(+), 20 deletions(-)

git pull ssh://ge=
rrit.openvpn.net:29418/openvpn refs/changes/82/1282/2
diff --git a/=
CMakeLists.txt b/CMakeLists.txt
index b773dcb..23fb4a5 1006= 44
--- a/CMakeLists.txt
+++ b/CMakeLists.tx= t
@@ -889,7 +889,6 @@
target_sources(t= est_push_update_msg PRIVATE
tests/unit_tests/openv= pn/mock_msg.c
tests/unit_tests/openvpn/mock_get_ra= ndom.c
- src/ope= nvpn/push_util.c
src/openvpn/options_util.c=
src/openvpn/otime.c
src/openvpn= /list.c
diff --git a/src/openvpn/push.h b/src/openvpn/push.= h
index 19a029a..09565b8 100644
--- a/src/o= penvpn/push.h
+++ b/src/openvpn/push.h
@@ -= 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).
<= span style=3D"color: hsl(0, 100%, 40%);">- *
- * @param m the multi_context, contains all the clie= nts connected to this server.
- * @param target the target to which to send the message. It should= be:
- * `NULL` if `typ= e =3D=3D UPT_BROADCAST`,
- * a `char *` if `type =3D=3D UPT_BY_CN`,
- * an `unsigned long *`= if `type =3D=3D 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.
<= span style=3D"color: hsl(0, 100%, 40%);">- * @return the number of clients = to which the message was sent.
- */
-int
-send_push_update(struct mul= ti_context *m, const void *target, const char *msg, const push_update_type = type, const int push_bundle_size);
-
bool management_callback_send_push_update_br= oadcast(void *arg, const char *options);

= bool management_callback_send_push_update_by_cid(void *arg, unsigned long = cid, const char *options);
diff --git a/src/openvpn/push_ut= il.c b/src/openvpn/push_util.c
index 0e86ad3..0eddcae 10064= 4
--- a/src/openvpn/push_util.c
+++ b/src/o= penvpn/push_util.c
@@ -239,7 +239,21 @@
= return true;
}

-int
+/**
+= * @brief A function to send a PUSH_UPDATE control message from server to c= lient(s).
+ *<= br>+ * @param m the multi_conte= xt, contains all the clients connected to this server.
+ * @param target the target to which to = send the message. It should be:
+ * `NULL` if `type =3D=3D UPT_BROADCAST`,
+ * a `mroute_addr *` if `type =3D=3D UPT_= BY_ADDR`,
+ * a `char= *` if `type =3D=3D UPT_BY_CN`,
+ * an `unsigned long *` if `type =3D=3D UPT_BY_CID`.
= + * @param msg a string contain= ing the options to send.
+ * @param type the way to address the message (broadcast, by cid, by c= n, 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. Mig= ht return < 0 in case of error.
+ */
+s= tatic 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))
diff --git a/tests/unit_tests/openvpn/Ma= kefile.am b/tests/unit_tests/openvpn/Makefile.am
index 17aa= 0ce..997703a 100644
--- a/tests/unit_tests/openvpn/Makefile= .am
+++ b/tests/unit_tests/openvpn/Makefile.am
@@ -356,7 +356,6 @@

mock_get_random.c \
$(top_srcdir)/src/openvpn/buffer.c \
$(top_srcdir)/s= rc/openvpn/platform.c \
- $(top_srcdir)/src/openvpn/push_util.c \
$(top_srcdir)/= src/openvpn/options_util.c \
$(top_srcdir)/src/openvpn/ot= ime.c \
$(top_srcdir)/src/openvpn/list.c
= diff --git a/tests/unit_tests/openvpn/test_push_update_msg.c b/tests/unit_t= ests/openvpn/test_push_update_msg.c
index 7fadb69..516e94c = 100644
--- a/tests/unit_tests/openvpn/test_push_update_msg.= c
+++ b/tests/unit_tests/openvpn/test_push_update_msg.c

@@ -10,6 +10,8 @@
#include "options_util= .h"
#include "multi.h"

+#include "push_ut= il.c"
+ /* mocks */

void

To view, visit change 1282. To unsubscribe, or for help w= riting mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I348abec1e2f32301a0368d5f541= e67bddf358bbc
Gerrit-Change-Number: 1282
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --ePWZD+f2bx8=--