From: "stipa (Code Review)" Date: Mon, 13 Jan 2025 09:20:05 +0000 References: Reply-To: lstipakov@...277..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="iXfvCIGgieE="; charset=UTF-8 Subject: [Openvpn-devel] [S] 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 --iXfvCIGgieE= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/856?usp=3Demail to review the following change. 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, 24 insertions(+), 24 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/856/1 diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index d1b2c8c..196174c 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -2441,6 +2441,30 @@ 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; + + /* 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; + } + /* * For routed tunnels, set up internal route to endpoint * plus add all iroute routes. @@ -2488,30 +2512,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: 1 Gerrit-Owner: stipa Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --iXfvCIGgieE= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

stipa would like plaisthos and flichtenheld to review t= his change.

Vi= ew Change

multi.c: add iroutes after dco peer is added

This does= n't matter for Linux and FreeBSD but matters
for dco-win, where irou= te subnet is mapped to a peer
context, which means that peer has to be c= reated before
iroute is added.

Change-Id: I1cac0f036504c87205a3c9= 7589a94a662cf79b99
Signed-off-by: Lev Stipakov <lev@...515...>
= ---
M src/openvpn/multi.c
1 file changed, 24 insertions(+), 24 deleti= ons(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/chang=
es/56/856/1
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c<=
/span>
index d1b2c8c..196174c 100644
--- a/src/ope= nvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -= 2441,6 +2441,30 @@
ifconfig_constraint_network= , ifconfig_constraint_netmask);
}

+ /* set our client&= #39;s VPN endpoint for status reporting purposes */
+ mi->reporting_addr =3D mi->cont= ext.c2.push_ifconfig_local;
+ mi->reporting_addr_ipv6 =3D mi->context.c2.push_ifconfig_= ipv6_local;
+<= br>+ /* set context-level au= thentication 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->cont= ext))
+ {+ mi->context.c2.tl= s_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 protocol options
+ * and DCO initial setup has not failed */
+ else if (!multi_client_generate_tls_k= eys(&mi->context))
+ {
+ = mi->context.c2.tls_multi->multi_state =3D CAS_FAILED;
+ }

+
/*
* = For routed tunnels, set up internal route to endpoint
= * plus add all iroute routes.
@@ -2488,30 +2512,6 @@
multi_instance_string(mi, false, &gc));<= br> }

- /* set our client's VPN endpoint for status reporting p= urposes */
- mi->= reporting_addr =3D mi->context.c2.push_ifconfig_local;
- mi->reporting_addr_ipv6 =3D mi-&= gt;context.c2.push_ifconfig_ipv6_local;
-
- = /* set context-level authentication flag */
- mi->context.c2.tls_multi->multi_state =3D = CAS_CONNECT_DONE;
-
- /* authentication com= plete, calculate dynamic client specific options */
- if (!multi_client_set_protocol_options(= &mi->context))
-= {
- mi->c= ontext.c2.tls_multi->multi_state =3D CAS_FAILED;
- }
- /* only continue if setting protocol options worked */<= /span>
- 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 only if s= etting protocol options
- * and DCO initial setup has not failed */
- else if (!multi_client_generate_tls_keys(&am= p;mi->context))
- = {
- mi->cont= ext.c2.tls_multi->multi_state =3D CAS_FAILED;
- }
-
/* send push reply if ready */
<= span> 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: 1
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--iXfvCIGgieE=--