From: "stipa (Code Review)" Date: Tue, 14 Jan 2025 12:45:33 +0000 In-Reply-To: References: Reply-To: lstipakov@...277..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., a@...2181... Message-ID: <011b250e5360d43b83e517ea5e4610cc7747f265-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="FWyGSs6b1U0="; 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: plaisthos , flichtenheld Cc: openvpn-devel --FWyGSs6b1U0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, ordex, stipa. Hello flichtenheld, ordex, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/856?usp=3Demail to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review+1 by ordex 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 --- M src/openvpn/multi.c 1 file changed, 29 insertions(+), 24 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/856/2 diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index d1b2c8c..82fcf17 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -2441,6 +2441,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. @@ -2488,30 +2517,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: 2 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-Attention: ordex Gerrit-Attention: stipa Gerrit-MessageType: newpatchset --FWyGSs6b1U0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, ordex, stipa.

stipa uploaded patch set #2 to this change.

View Change

The following approvals got outdated and were removed: Code-Review+1 by ordex

multi.c: add iroutes after dco peer is added

= This doesn't matter for Linux and FreeBSD but matters
for dco-win, w= here iroute subnet is mapped to a peer
context, which means that peer ha= s to be created before
iroute is added.

Change-Id: I1cac0f036504c= 87205a3c97589a94a662cf79b99
Signed-off-by: Lev Stipakov <lev@...1699...= .>
---
M src/openvpn/multi.c
1 file changed, 29 insertions(+), = 24 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn r=
efs/changes/56/856/2
diff --git a/src/openvpn/multi.c b/src/openvpn=
/multi.c
index d1b2c8c..82fcf17 100644
--- = a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
<= span>@@ -2441,6 +2441,35 @@
ifconfig_constrain= t_network, ifconfig_constraint_netmask);
}
<= span>
+ /* set ou= r client's VPN endpoint for status reporting purposes */
+ mi->reporting_addr =3D mi-&= gt;context.c2.push_ifconfig_local;
+ mi->reporting_addr_ipv6 =3D mi->context.c2.push_if= config_ipv6_local;
+<= /span>
+ /* set context-l= evel authentication flag */
+ mi->context.c2.tls_multi->multi_state =3D CAS_CONNECT_DON= E;
+
+ /* Since dco-win maintains irout= e routing table (subnet -> peer),
+ * peer must be added before iroutes. For other platfo= rms it doesn't matter. */
+
+ /* au= thentication complete, calculate dynamic client specific options */<= br>+ if (!multi_client_set_p= rotocol_options(&mi->context))
+ {
+ mi->context.c2.tls_multi->multi_state =3D CAS_FAILED;
+ }
+ /* only continue if setting proto= col options worked */
+ else if (!multi_client_setup_dco_initial(m, mi, &gc))
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

+ mi->context.c2.tls_multi->multi= _state =3D CAS_FAILED;
+ /* Gene= rate data channel keys only if setting protocol options
+ * and DCO initial setup has not fa= iled */
+ 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 ro= uted tunnels, set up internal route to endpoint
* plu= s add all iroute routes.
@@ -2488,30 +2517,6 @@
<= span> multi_instance_string(mi, false, &gc));

}

- /* set our client's VPN endpoint for status reporting purpose= s */
- mi->report= ing_addr =3D mi->context.c2.push_ifconfig_local;
- mi->reporting_addr_ipv6 =3D mi->c= ontext.c2.push_ifconfig_ipv6_local;
-
- /* = set context-level authentication flag */
- mi->context.c2.tls_multi->multi_state =3D CAS_= CONNECT_DONE;
-<= br>- /* authentication complet= e, calculate dynamic client specific options */
- if (!multi_client_set_protocol_options(&m= i->context))
- {<= /span>
- mi->context= .c2.tls_multi->multi_state =3D CAS_FAILED;
- }
- /* only continue if setting protocol options worked */- else if (!multi_client_set= up_dco_initial(m, mi, &gc))
- {
- = mi->context.c2.tls_multi->multi_state =3D CAS_FAILED;
- }

- /* Generate data channel keys only if setting p= rotocol options
- *= and DCO initial setup has not failed */
- else if (!multi_client_generate_tls_keys(&mi->= ;context))
- {
- mi->context.c2.t= ls_multi->multi_state =3D CAS_FAILED;
- }
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: 2
Gerrit-Owner: stipa <lstipakov@...277...>= ;
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-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: ordex <a@...2181...> <= /div>
Gerrit-Attention: stipa <lstipakov@...1663...= .>
Gerrit-MessageType: newpatchset
--FWyGSs6b1U0=--