From: "cron2 (Code Review)" Date: Tue, 28 Oct 2025 17:46:47 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <49250f4a504153140b611c72d5ceec913e533a0c-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="99ST0qYBHX4="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Warn if push is used without --mode server/--server/--server-bridge List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: flichtenheld , openvpn-devel --99ST0qYBHX4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/12= 88?usp=3Demail ) Change subject: Warn if push is used without --mode server/--server/--serve= r-bridge ...................................................................... Warn if push is used without --mode server/--server/--server-bridge This is not a supported configuration and will often work good enough to get a connection working but will operate more in a weird pre P2P negotiation compatibility way rather than actually negotiating protocol features. While at it, remove an unused macro (PUSH_DEFINED). Change-Id: I82c7c61be07593ecd5bf2f854767dda74ab5170c Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1288 Message-Id: <20251023155614.20642-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33= 856.html Signed-off-by: Gert Doering --- M doc/man-sections/server-options.rst M src/openvpn/options.c M src/openvpn/options.h 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/man-sections/server-options.rst b/doc/man-sections/server-= options.rst index ccc1374..347a251 100644 --- a/doc/man-sections/server-options.rst +++ b/doc/man-sections/server-options.rst @@ -497,6 +497,9 @@ ``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``, ``--rcvbuf``, ``--session-timeout`` + Note: using ``--push`` requires OpenVPN to run in ``--mode server`` (or + using of one of `--server`, `--server-bridge` helper directives). + --push-remove opt Selectively remove all ``--push`` options matching "opt" from the option list for a client. ``opt`` is matched as a substring against the whole diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 65c6b3b..9c02a8c 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -2690,6 +2690,13 @@ MUST_BE_UNDEF(vlan_accept, "vlan-accept"); MUST_BE_UNDEF(vlan_pvid, "vlan-pvid"); MUST_BE_UNDEF(force_key_material_export, "force-key-material-expor= t"); + + if (options->push_list.head) + { + msg(M_WARN, "Note: Using --push without --mode server is an " + "unsupported configuration. Negotiation of OpenVPN= " + "features is expected to fail."); + } } /* diff --git a/src/openvpn/options.h b/src/openvpn/options.h index 009904a..24253af 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -768,16 +768,11 @@ #define OPT_P_DEFAULT (~(OPT_P_INSTANCE | OPT_P_PULL_MODE)) #define PULL_DEFINED(opt) ((opt)->pull) -#define PUSH_DEFINED(opt) ((opt)->push_list) #ifndef PULL_DEFINED #define PULL_DEFINED(opt) (false) #endif -#ifndef PUSH_DEFINED -#define PUSH_DEFINED(opt) (false) -#endif - #ifdef _WIN32 #define ROUTE_OPTION_FLAGS(o) ((o)->route_method & ROUTE_METHOD_MASK) #else -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1288?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I82c7c61be07593ecd5bf2f854767dda74ab5170c Gerrit-Change-Number: 1288 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel --99ST0qYBHX4= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

Warn if push is used without --mode server/--ser=
ver/--server-bridge

This is not a supported configuration and will o= ften work good enough
to get a connection working but will operate more = in a weird pre P2P
negotiation compatibility way rather than actually ne= gotiating
protocol features.

While at it, remove an unused macro = (PUSH_DEFINED).

Change-Id: I82c7c61be07593ecd5bf2f854767dda74ab5170c=
Signed-off-by: Arne Schwabe <arne@...1227...>
Acked-by: Frank = Lichtenheld <frank@...2641...>
Gerrit URL: https://gerrit.openvpn.= net/c/openvpn/+/1288
Message-Id: <20251023155614.20642-1-gert@...1726...= ...>
URL: https://www.mail-archive.com/openvpn-devel@...1483...= e.net/msg33856.html
Signed-off-by: Gert Doering <gert@...1296...><= br>---
M doc/man-sections/server-options.rst
M src/openvpn/options.c<= br>M src/openvpn/options.h
3 files changed, 10 insertions(+), 5 deletion= s(-)

diff --git a/doc/man-sections/server-options.rst b/doc/man-sections/serv=
er-options.rst
index ccc1374..347a251 100644
--- a/doc/man-sections/server-options.rst
+++ b/doc/man-s= ections/server-options.rst
@@ -497,6 +497,9 @@
``--echo``, ``--comp-lzo``, ``--socket-flags``, ``--sndbuf``,=
``--rcvbuf``, ``--session-timeout``
+ Note: using ``--push`` req= uires OpenVPN to run in ``--mode server`` (or
+ using of one of `--server`, `--server-bridge` h= elper directives).
+<= /span>
--push-remove opt
Selectively remove al= l ``--push`` options matching "opt" from the option
list for a client. ``opt`` is matched as a substring against the whol= e

diff --git a/src/openvpn/options.c b/src/openvpn/options.= c
index 65c6b3b..9c02a8c 100644
--- a/src/o= penvpn/options.c
+++ b/src/openvpn/options.c
@@ -2690,6 +2690,13 @@
MUST_BE_UNDEF(vlan_accept= , "vlan-accept");
MUST_BE_UNDEF(vlan_pvi= d, "vlan-pvid");
MUST_BE_UNDEF(force_key= _material_export, "force-key-material-export");
+
+ if (options->push_list.head)
+ {
+ msg(M_WARN, "Note: Using --pu= sh without --mode server is an "
+ "unsupported configuration. = Negotiation of OpenVPN "
+ "features is expected to fail."= );
+ }<= br> }

/*
d= iff --git a/src/openvpn/options.h b/src/openvpn/options.h
i= ndex 009904a..24253af 100644
--- a/src/openvpn/options.h

+++ b/src/openvpn/options.h
@@ -768,16 +768,1= 1 @@
#define OPT_P_DEFAULT (~(OPT_P_INSTANCE | OPT_P_PULL_= MODE))

#define PULL_DEFINED(opt) ((opt)-= >pull)
-#define PUSH= _DEFINED(opt) ((opt)->push_list)

#ifn= def PULL_DEFINED
#define PULL_DEFINED(opt) (false)<= br> #endif

-#ifndef PUSH_DEFINED
-#define PUSH_DEFINED(opt) (false)
-#endif
-
#ifdef _WIN32
#define ROUTE_OPT= ION_FLAGS(o) ((o)->route_method & ROUTE_METHOD_MASK)
#else

To view, visit change 1288. To unsu= bscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I82c7c61be07593ecd5bf2f85476= 7dda74ab5170c
Gerrit-Change-Number: 1288
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --99ST0qYBHX4=--