From patchwork Fri Oct 17 20:38:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4515 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:7d42:b0:72f:f16c:e055 with SMTP id fr2csp4743379mab; Fri, 17 Oct 2025 13:38:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWKTdKn1th09qLZNsJ0bteM8YEkoU1HH0tXqZGsviLobTTHBK2oJwx91MydcUsGlmkX5Dnt5cEVwIw=@openvpn.net X-Google-Smtp-Source: AGHT+IEeSIj+mPwJ3yZwjRQS6wGafxr7sJQyiyTeYPCxRJwkona13ulmM0mN0YoovVck4V91gFIl X-Received: by 2002:a05:6808:18a3:b0:441:8260:d097 with SMTP id 5614622812f47-443a1974e3emr2366745b6e.11.1760733522319; Fri, 17 Oct 2025 13:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1760733522; cv=none; d=google.com; s=arc-20240605; b=PwSiJU51h1CATNmSoKDrsaF7tdInMTp3vjfi9sPcffJLDBhkf6nyN/CXVhjBjBUtlz MsrHwDHchJUI7/6FOYIQS+7zhvPb/uqyEHjBMJI2m0T9LqKF1H85wzD5poxPCDpvQf0D AyAyDUG5WThvC16O1s7QKxoedNEzvecmLtLZhMzrxAG35ELhLYRsrgMgudtjsUuprzgB RyG++GkE8JnptlHrVW5X/Db7neBZCTu5bMnQAlz0yJXCC2ETZiINqMPo1+wbxkLzrIGc 4u3rqH+wUWAMzbMwJjMaGeEzBDKIVVnt9Vbm3VoXh5oR2u99ZHh+K16nyzUwTPkWSt6W anVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=RzsSPOiZaX5vke+37ZassEL6Llh/WZQPE+GvoNz+OME=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=lXU3odwb5SASIrHUhU4UIjJtKDAgRCvZipsSvxrg1cRiuNHZQcwJbsD0mlsLvxG2kb eGW5RBXajd0zWMlZW8zXg/6KXSpJBJk/GVRt+tVUp3+EtAeofCSyEfQfe+MyFRs7ZNOG 1i8IUsCauhTBT4ViE8Zp4tSXoQp2mEvtnPxpadnj90ylAGsYAkKIlethR9KAZBylMWqc oY3AamiYyEy5b8kE23WkO/6Sz74aFN2CdZYxkY4EWY9/eYwpNUbBlfZJSW3N2bIgitSb QgJ2HwXVe4lXWwIkNkQf/h10D9F3phvfLcbEJlwbC9+iAoRkQRiu9RPKWj9Y0eBeceGD /HcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=hWYl2Evx; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=XnerS69l; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=I3MK55Fh; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 5614622812f47-443df524b7fsi110757b6e.312.2025.10.17.13.38.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Oct 2025 13:38:42 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=hWYl2Evx; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=XnerS69l; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=I3MK55Fh; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RzsSPOiZaX5vke+37ZassEL6Llh/WZQPE+GvoNz+OME=; b=hWYl2EvxGyYScYyjsZPvAESzt9 jkQhE8Kc1fALyhlljelQ/ZSGws35lUwgMCS8PuU1U4mxoe0JcDTG17jGv3P7YN7O2aMJ6cMBd7L4Q DRtMJehMZOKDmk1guL2H7qXfcplg+9GLGct3gN1igbBfVcKosJPYU5kCtyJNBS8LadI0=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1v9rDk-0007mq-4x; Fri, 17 Oct 2025 20:38:40 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1v9rDi-0007mi-VB for openvpn-devel@lists.sourceforge.net; Fri, 17 Oct 2025 20:38:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0Zq1rRHGkfOp5EQcF32Hwg4XG+emCNdVLygOeC4a1Y4=; b=XnerS69lQVPoj1JOinaFoRxk8w 6yHMsO2MKKwGbre2BQh244/PYWc+bzcEwp39P6z7wMsqWJhaqEd9GzZXg6hbn5xWsAzB7VWHhOE0/ dRC+N+nMaxkGIGX/qRCR3CAgx7zHjnyy86FZbiQI7VB6nFzn8jlTlbTf0noqKZViTsvA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0Zq1rRHGkfOp5EQcF32Hwg4XG+emCNdVLygOeC4a1Y4=; b=I3MK55Fh8P9ydy5OVzqjS46E9o 7Gqc5oUWktuX14suEGK7Lnmu6k8AUehof0oHGnYB0qMbEoUuD7SYeT8SQ7Rx/mq4MSRSaTGTzLhoS MlMfMrzxOheXpBTzrBBk7LGT8rWEze8rrJ3XsobjvhZwibuV3WFb8UPOvvcSU4wUESGM=; Received: from [193.149.48.134] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1v9rDh-0005ku-Ho for openvpn-devel@lists.sourceforge.net; Fri, 17 Oct 2025 20:38:38 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 59HKcVH2023832 for ; Fri, 17 Oct 2025 22:38:31 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 59HKcUli023831 for openvpn-devel@lists.sourceforge.net; Fri, 17 Oct 2025 22:38:30 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 17 Oct 2025 22:38:24 +0200 Message-ID: <20251017203830.23807-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld 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/open [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1v9rDh-0005ku-Ho Subject: [Openvpn-devel] [PATCH v1] push_util: Make send_push_update static X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1846262913793185344?= X-GMAIL-MSGID: =?utf-8?q?1846262913793185344?= From: Frank Lichtenheld 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 --- 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 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 6b3275e..fa72732 100644 --- a/src/openvpn/push.h +++ b/src/openvpn/push.h @@ -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); diff --git a/src/openvpn/push_util.c b/src/openvpn/push_util.c index 25c6ebe..06b4c8b 100644 --- a/src/openvpn/push_util.c +++ b/src/openvpn/push_util.c @@ -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)) diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/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_tests/openvpn/test_push_update_msg.c index 60596ed..91b60ba 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