[Openvpn-devel,v3] Make pull_permission_mask return uint64_t

Message ID 20260823145533.25183-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v3] Make pull_permission_mask return uint64_t |

Commit Message

Gert Doering Aug. 23, 2026, 2:55 p.m. UTC
  From: Arne Schwabe <arne@rfc2549.org>

Commit 91fd9614 already changed most of the instances for the
option flag to uint64_t but forgot to also adjust
pull_permission_mask and OPT_P_DEFAULT.

Change-Id: Icd53745b242e0ca2943863d5b274b2a13b4419bd
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1851
---

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

Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
  

Comments

Gert Doering Aug. 23, 2026, 7:21 p.m. UTC | #1
If both BB and Razvan agree that this is the way, I'm happy to go along :-)
(did not test, just glanced over the change - interesting hack on defining
OPT_P_DEFAULT, though)

Your patch has been applied to the master branch.

commit be582b2d2688966335a6485479ce3b2cc4a19320
Author: Arne Schwabe
Date:   Sun Aug 23 16:55:28 2026 +0200

     Make pull_permission_mask return uint64_t

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1851
     Message-Id: <20260823145533.25183-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg38599.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index fa62cdd..66bae34 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -2514,13 +2514,13 @@ 
 /*
  * These are the option categories which will be accepted by pull.
  */
-unsigned int
+uint64_t
 pull_permission_mask(const struct context *c)
 {
-    unsigned int flags = OPT_P_UP | OPT_P_ROUTE_EXTRAS | OPT_P_SOCKBUF | OPT_P_SOCKFLAGS
-                         | OPT_P_SETENV | OPT_P_SHAPER | OPT_P_TIMER | OPT_P_COMP | OPT_P_PERSIST
-                         | OPT_P_MESSAGES | OPT_P_EXPLICIT_NOTIFY | OPT_P_ECHO | OPT_P_PULL_MODE
-                         | OPT_P_PEER_ID | OPT_P_NCP | OPT_P_PUSH_MTU;
+    uint64_t flags = OPT_P_UP | OPT_P_ROUTE_EXTRAS | OPT_P_SOCKBUF | OPT_P_SOCKFLAGS
+                     | OPT_P_SETENV | OPT_P_SHAPER | OPT_P_TIMER | OPT_P_COMP | OPT_P_PERSIST
+                     | OPT_P_MESSAGES | OPT_P_EXPLICIT_NOTIFY | OPT_P_ECHO | OPT_P_PULL_MODE
+                     | OPT_P_PEER_ID | OPT_P_NCP | OPT_P_PUSH_MTU;
 
     if (!c->options.route_nopull)
     {
diff --git a/src/openvpn/init.h b/src/openvpn/init.h
index 9d5050d..ce8f74e 100644
--- a/src/openvpn/init.h
+++ b/src/openvpn/init.h
@@ -89,7 +89,7 @@ 
  */
 bool do_update(struct context *c, uint64_t option_types_found);
 
-unsigned int pull_permission_mask(const struct context *c);
+uint64_t pull_permission_mask(const struct context *c);
 
 const char *format_common_name(struct context *c, struct gc_arena *gc);
 
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index c23d0b3..f472676 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -761,7 +761,7 @@ 
 #define OPT_P_PUSH_MTU        (1u << 30)
 #define OPT_P_ROUTE_TABLE     (1u << 31)
 
-#define OPT_P_DEFAULT (~(OPT_P_INSTANCE | OPT_P_PULL_MODE))
+#define OPT_P_DEFAULT (~(OPT_P_INSTANCE | OPT_P_PULL_MODE | OPT_P_PEER_ID | 0x0ull))
 
 #define PULL_DEFINED(opt) ((opt)->pull)
 
diff --git a/src/openvpn/push_util.c b/src/openvpn/push_util.c
index c927f26..fcc5411 100644
--- a/src/openvpn/push_util.c
+++ b/src/openvpn/push_util.c
@@ -185,7 +185,7 @@ 
          */
         struct buffer tmp_msg = e->buf;
         buf_string_compare_advance(&tmp_msg, push_update_cmd);
-        unsigned int permission_mask = pull_permission_mask(c);
+        uint64_t permission_mask = pull_permission_mask(c);
         if (process_push_update(c, &o, permission_mask, &option_types_found, &tmp_msg, true) == PUSH_MSG_ERROR)
         {
             msg(M_WARN, "Failed to process push update message sent to client ID: %u", c->c2.tls_multi->rx_peer_id);
diff --git a/tests/unit_tests/openvpn/test_push_update_msg.c b/tests/unit_tests/openvpn/test_push_update_msg.c
index 9cb791b..2653749 100644
--- a/tests/unit_tests/openvpn/test_push_update_msg.c
+++ b/tests/unit_tests/openvpn/test_push_update_msg.c
@@ -20,13 +20,13 @@ 
     msg(M_WARN, "Offending option received from server");
 }
 
-unsigned int
+uint64_t
 pull_permission_mask(const struct context *c)
 {
-    unsigned int flags = OPT_P_UP | OPT_P_ROUTE_EXTRAS | OPT_P_SOCKBUF | OPT_P_SOCKFLAGS
-                         | OPT_P_SETENV | OPT_P_SHAPER | OPT_P_TIMER | OPT_P_COMP | OPT_P_PERSIST
-                         | OPT_P_MESSAGES | OPT_P_EXPLICIT_NOTIFY | OPT_P_ECHO | OPT_P_PULL_MODE
-                         | OPT_P_PEER_ID | OPT_P_NCP | OPT_P_PUSH_MTU | OPT_P_ROUTE | OPT_P_DHCPDNS;
+    uint64_t flags = OPT_P_UP | OPT_P_ROUTE_EXTRAS | OPT_P_SOCKBUF | OPT_P_SOCKFLAGS
+                     | OPT_P_SETENV | OPT_P_SHAPER | OPT_P_TIMER | OPT_P_COMP | OPT_P_PERSIST
+                     | OPT_P_MESSAGES | OPT_P_EXPLICIT_NOTIFY | OPT_P_ECHO | OPT_P_PULL_MODE
+                     | OPT_P_PEER_ID | OPT_P_NCP | OPT_P_PUSH_MTU | OPT_P_ROUTE | OPT_P_DHCPDNS;
     return flags;
 }