From: "cron2 (Code Review)" Date: Sun, 2 Feb 2025 09:49:17 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277..., a@...2181... Message-ID: <00b9a432e2dde534781867b8a59aa51e87380c23-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="GnzfMuRSHdQ="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: multi.c: add iroutes after dco peer is added List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stipa Cc: plaisthos , flichtenheld , openvpn-devel --GnzfMuRSHdQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/85= 6?usp=3Demail ) Change subject: multi.c: add iroutes after dco peer is added ...................................................................... multi.c: add iroutes after dco peer is added This doesn't matter for Linux and FreeBSD but matters for dco-win, where iroute subnet is mapped to a peer context, which means that peer has to be created before iroute is added. Change-Id: I1cac0f036504c87205a3c97589a94a662cf79b99 Signed-off-by: Lev Stipakov Acked-by: Gert Doering Message-Id: <20250201121102.27395-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 780.html Signed-off-by: Gert Doering --- M src/openvpn/multi.c 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index b0e1941..96fa6cd 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -2442,6 +2442,35 @@ ifconfig_constraint_network, ifconfig_constraint_netmask); } + /* set our client's VPN endpoint for status reporting purposes */ + mi->reporting_addr =3D mi->context.c2.push_ifconfig_local; + mi->reporting_addr_ipv6 =3D mi->context.c2.push_ifconfig_ipv6_local; + + /* set context-level authentication flag */ + mi->context.c2.tls_multi->multi_state =3D CAS_CONNECT_DONE; + + /* Since dco-win maintains iroute routing table (subnet -> peer), + * peer must be added before iroutes. For other platforms it doesn't m= atter. */ + + /* authentication complete, calculate dynamic client specific options = */ + if (!multi_client_set_protocol_options(&mi->context)) + { + mi->context.c2.tls_multi->multi_state =3D CAS_FAILED; + } + /* only continue if setting protocol options worked */ + else if (!multi_client_setup_dco_initial(m, mi, &gc)) + { + mi->context.c2.tls_multi->multi_state =3D CAS_FAILED; + } + /* Generate data channel keys only if setting protocol options + * and DCO initial setup has not failed */ + else if (!multi_client_generate_tls_keys(&mi->context)) + { + mi->context.c2.tls_multi->multi_state =3D CAS_FAILED; + } + + /* dco peer has been added, it is now safe for Windows to add iroutes = */ + /* * For routed tunnels, set up internal route to endpoint * plus add all iroute routes. @@ -2489,30 +2518,6 @@ multi_instance_string(mi, false, &gc)); } - /* set our client's VPN endpoint for status reporting purposes */ - mi->reporting_addr =3D mi->context.c2.push_ifconfig_local; - mi->reporting_addr_ipv6 =3D mi->context.c2.push_ifconfig_ipv6_local; - - /* set context-level authentication flag */ - mi->context.c2.tls_multi->multi_state =3D CAS_CONNECT_DONE; - - /* authentication complete, calculate dynamic client specific options = */ - if (!multi_client_set_protocol_options(&mi->context)) - { - mi->context.c2.tls_multi->multi_state =3D CAS_FAILED; - } - /* only continue if setting protocol options worked */ - else if (!multi_client_setup_dco_initial(m, mi, &gc)) - { - mi->context.c2.tls_multi->multi_state =3D CAS_FAILED; - } - /* Generate data channel keys only if setting protocol options - * and DCO initial setup has not failed */ - else if (!multi_client_generate_tls_keys(&mi->context)) - { - mi->context.c2.tls_multi->multi_state =3D CAS_FAILED; - } - /* send push reply if ready */ if (mi->context.c2.push_request_received) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/856?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I1cac0f036504c87205a3c97589a94a662cf79b99 Gerrit-Change-Number: 856 Gerrit-PatchSet: 8 Gerrit-Owner: stipa Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --GnzfMuRSHdQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

multi.c: add iroutes after dco peer is added
This doesn't matter for Linux and FreeBSD but matters
for dco-= win, where iroute subnet is mapped to a peer
context, which means that p= eer has to be created before
iroute is added.

Change-Id: I1cac0f0= 36504c87205a3c97589a94a662cf79b99
Signed-off-by: Lev Stipakov <lev@...1186...= .515...>
Acked-by: Gert Doering <gert@...1296...>
Message-Id= : <20250201121102.27395-1-gert@...1296...>
URL: https://www.mail-a= rchive.com/openvpn-devel@lists.sourceforge.net/msg30780.html
Signed-off-= by: Gert Doering <gert@...1296...>
---
M src/openvpn/multi.c1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
i= ndex b0e1941..96fa6cd 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -2442,6 +2442,35 @= @
ifconfig_constraint_network, ifconfig_constr= aint_netmask);
}

+ /* set our client's VPN endpoin= t for status reporting purposes */
+ mi->reporting_addr =3D mi->context.c2.push_ifconfi= g_local;
+ mi->= reporting_addr_ipv6 =3D mi->context.c2.push_ifconfig_ipv6_local;<= br>+
+ /* set context-level authentication flag *= /
+ mi->context= .c2.tls_multi->multi_state =3D CAS_CONNECT_DONE;
+
+ /* Since dco-win maintains iroute routing table (subnet = -> peer),
+ * = peer must be added before iroutes. For other platforms it doesn't matte= r. */
+
+ /* authentication complete, c= alculate dynamic client specific options */

+ if (!multi_client_set_protocol_options(&mi-= >context))
+ {<= /span>
+ mi->conte= xt.c2.tls_multi->multi_state =3D CAS_FAILED;
+ }
+ /* only continue if setting protocol options worked */
+ else if (!multi_cl= ient_setup_dco_initial(m, mi, &gc))
+ {
+ mi->context.c2.tls_multi->multi_state =3D CAS_FAILED;
+ }
+ /* Generate data channel keys o= nly if setting protocol options

+ * and DCO initial setup has not failed */
+ else if (!multi_client_generate_= tls_keys(&mi->context))
+ {
+ = mi->context.c2.tls_multi->multi_state =3D CAS_FAILED;
= + }
+
+ /* dco peer has been added, it is now safe for Windows to a= dd iroutes */
+
/*
* For routed tunnels, set up inter= nal route to endpoint
* plus add all iroute routes.
@@ -2489,30 +2518,6 @@
multi_in= stance_string(mi, false, &gc));
}
=
- /* set our clien= t's VPN endpoint for status reporting purposes */
- mi->reporting_addr =3D mi->contex= t.c2.push_ifconfig_local;
- mi->reporting_addr_ipv6 =3D mi->context.c2.push_ifconfig_ipv6= _local;
-
- /* set context-level authentica= tion flag */

- mi-&g= t;context.c2.tls_multi->multi_state =3D CAS_CONNECT_DONE;
-

- /* authentication complete, calculate dynamic client = specific options */
- = if (!multi_client_set_protocol_options(&mi->context))
- {

- mi->context.c2.tls_multi->multi_stat= e =3D CAS_FAILED;
- = }
- /* only continue= if setting protocol options worked */
- else if (!multi_client_setup_dco_initial(m, mi, &g= c))
- {
- mi->context.c2.tls_mult= i->multi_state =3D CAS_FAILED;

- }
- = /* Generate data channel keys only if setting protocol options
- * and DCO initial setup has n= ot failed */
- else = if (!multi_client_generate_tls_keys(&mi->context))
- {
- mi->context.c2.tls_multi->multi_state =3D= CAS_FAILED;
- }

-
/* = send push reply if ready */
if (mi->context.c2.push= _request_received)
{

=

To view, visit change 856. To unsubscribe, or for help writing mail filters,= visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1cac0f036504c87205a3c97589a= 94a662cf79b99
Gerrit-Change-Number: 856
Gerrit-PatchSet: 8
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--GnzfMuRSHdQ=--