From: "ralf_lici (Code Review)" Date: Tue, 7 Jan 2025 11:41:00 +0000 In-Reply-To: References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., gert@...1296... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="6kSTiL+bsCY="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix float support in P2P topology List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: cron2 , openvpn-devel --6kSTiL+bsCY= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, flichtenheld, plaisthos. Hello flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/844?usp=3Demail to look at the new patch set (#3). Change subject: Fix float support in P2P topology ...................................................................... Fix float support in P2P topology Fix the handling of floating operations in P2P topology, where new UDP endpoints were previously ignored. When floating occurs, this update processes the new endpoints and updates the address if the `--float` option is specified or `--remote` is omitted. Since the same code path is used for clients in MP topology, this change also enables processing of server floating operations from the client perspective. Change-Id: I806757a8c6f9a589665624f176391b5f7b87f581 Signed-off-by: Ralf Lici --- M src/openvpn/forward.c 1 file changed, 25 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/844/3 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 2c72001..76df59d5 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1227,10 +1227,34 @@ { perf_push(PERF_PROC_IN_LINK); + bool floated =3D false; struct link_socket_info *lsi =3D &sock->info; const uint8_t *orig_buf =3D c->c2.buf.data; + const struct link_socket_actual *incoming =3D &c->c2.from; + struct link_socket_actual *remote =3D c->c2.to_link_addr; =20 - process_incoming_link_part1(c, lsi, false); + if (remote && incoming->dest.addr.sa.sa_family !=3D AF_UNSPEC) + { + floated =3D !link_socket_actual_match(incoming, remote); + } + + process_incoming_link_part1(c, lsi, floated); + if (floated && c->c2.buf.len > 0) + { + struct gc_arena gc =3D gc_new(); + + msg(D_LOW, "peer floated from %s to %s", + print_link_socket_actual(remote, &gc), + print_link_socket_actual(incoming, &gc)); + + link_socket_set_outgoing_addr(lsi, &c->c2.from, NULL, c->c2.es); + if (TLS_MODE(c)) + { + tls_update_remote_addr(c->c2.tls_multi, incoming); + } + + gc_free(&gc); + } process_incoming_link_part2(c, lsi, orig_buf); perf_pop(); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/844?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: I806757a8c6f9a589665624f176391b5f7b87f581 Gerrit-Change-Number: 844 Gerrit-PatchSet: 3 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-MessageType: newpatchset --6kSTiL+bsCY= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: cron2, flichtenheld, plaisthos. <= /p>

ralf_lici uploaded patch set #3 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/844?usp=3Demail">View Chang= e

Fix float support in P2P topology

Fix the handling of floating= operations in P2P topology, where new UDP
endpoints were previously ign= ored. When floating occurs, this update
processes the new endpoints and = updates the address if the `--float`
option is specified or `--remote` i= s omitted.

Since the same code path is used for clients in MP topolo= gy, this change
also enables processing of server floating operations fr= om the client
perspective.

Change-Id: I806757a8c6f9a589665624f176= 391b5f7b87f581
Signed-off-by: Ralf Lici <ralf@...2726...>
---M src/openvpn/forward.c
1 file changed, 25 insertions(+), 1 deletion(-= )

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44=
/844/3
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 2c72001..76df59d5 100644
--- a/src/ope= nvpn/forward.c
+++ b/src/openvpn/forward.c
= @@ -1227,10 +1227,34 @@
{
perf_push(P= ERF_PROC_IN_LINK);

+ bool floated =3D false;
struct li= nk_socket_info *lsi =3D &sock->info;
const uint= 8_t *orig_buf =3D c->c2.buf.data;
+ const struct link_socket_actual *incoming =3D &c-&= gt;c2.from;
+ stru= ct link_socket_actual *remote =3D c->c2.to_link_addr;
<= /span>
- process_incoming_l= ink_part1(c, lsi, false);
+ if (remote && incoming->dest.addr.sa.sa_family !=3D AF= _UNSPEC)
+ {
+ floated =3D !link= _socket_actual_match(incoming, remote);
+ }
+
+ process_i= ncoming_link_part1(c, lsi, floated);
+ if (floated && c->c2.buf.len > 0)=
+ {
+ struct gc_arena gc =3D gc_new();=
+
+ msg(D_LOW, "peer floated = from %s to %s",
= + print_link_socket_actual(remote, &gc),
+ print_link_socket_actual(in= coming, &gc));
+<= /span>
+ link_socket_= set_outgoing_addr(lsi, &c->c2.from, NULL, c->c2.es);
+ if (TLS_MODE(c))
<= br>+ {
+ tls_update_remote_addr(c-= >c2.tls_multi, incoming);
+ }
+<= /span>
+ gc_free(&= ;gc);
+ } process_incoming_link_part2(c, lsi, orig_buf);

perf_pop();

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I806757a8c6f9a589665624f1763= 91b5f7b87f581
Gerrit-Change-Number: 844
Gerrit-PatchSet: 3
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: cron2 <gert@...1296...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: cron2 <gert@...1296...>= ;
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newpatchset
--6kSTiL+bsCY=--