From: "ralf_lici (Code Review)"
Date: Fri, 20 Dec 2024 17:12:38 +0000
References:
Reply-To: ralf@...2726..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, frank@...2641...
Message-ID: <190e4fc84e79b0c54644bfc981daf36b5995a079-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="5JT/kLUiP/4="; 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: openvpn-devel
--5JT/kLUiP/4=
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/+/844?usp=3Demail
to review the following change.
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, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/844/1
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 2c72001..5feffba 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -1227,12 +1227,33 @@
{
perf_push(PERF_PROC_IN_LINK);
+ struct gc_arena gc =3D gc_new();
+ 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;
+ const sa_family_t family =3D incoming->dest.addr.sa.sa_family;
- process_incoming_link_part1(c, lsi, false);
- process_incoming_link_part2(c, lsi, orig_buf);
+ if (remote && (family =3D=3D AF_INET || family =3D=3D AF_INET6))
+ {
+ floated =3D !link_socket_actual_match(incoming, remote);
+ }
+ if (process_incoming_link_part1(c, lsi, floated))
+ {
+ if (floated && c->c2.buf.len > 0)
+ {
+ 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=
);
+ tls_update_remote_addr(c->c2.tls_multi, incoming);
+ }
+ process_incoming_link_part2(c, lsi, orig_buf);
+ }
+
+ gc_free(&gc);
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: 1
Gerrit-Owner: ralf_lici
Gerrit-Reviewer: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
Gerrit-MessageType: newchange
--5JT/kLUiP/4=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
ralf_lici would like plaisthos and flichtenheld to review this change.
Vi=
ew Change
Fix float support in P2P topology Fix the handling of =
floating operations in P2P topology, where new UDP endpoints were previo=
usly ignored. When floating occurs, this update processes the new endpoi=
nts and updates the address if the `--float` option is specified or `--r=
emote` is omitted. Since the same code path is used for clients in M=
P topology, this change also enables processing of server floating opera=
tions from the client perspective. Change-Id: I806757a8c6f9a58966=
5624f176391b5f7b87f581 Signed-off-by: Ralf Lici <ralf@...2726...><=
br>--- M src/openvpn/forward.c 1 file changed, 23 insertions(+), 2 de=
letions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/c=
hanges/44/844/1 diff --git a/src/openvpn/forward.c b/src/openvpn/fo=
rward.c index 2c72001..5feffba 100644 --- a=
/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1227,12 +1227,33 @@ { per=
f_push(PERF_PROC_IN_LINK); + struct gc_arena gc =3D gc_new(); + 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_actu=
al *incoming =3D &c->c2.from;+ struct link_socket_actual *remote =3D c->c2.to_link=
_addr; + const sa_=
family_t family =3D incoming->dest.addr.sa.sa_family; <=
/span>- process_incoming_l=
ink_part1(c, lsi, false); - process_incoming_link_part2(c, lsi, orig_buf); + if (remote && (family =3D=3D=
AF_INET || family =3D=3D AF_INET6)) + { + floated =3D !link_socket_actual_match(incoming, remote); <=
br>+ } + if (process_incomin=
g_link_part1(c, lsi, floated)) + { + =
if (floated && c->c2.buf.len > 0) + { + msg(D_LOW, "peer floated from %s t=
o %s", + =
print_link_socket_actual(remote, &gc), + print_link_socket_actual(inc=
oming, &gc)); + =
link_socket_set_outgoing_addr(lsi, &c->c2.from, NULL, c-&g=
t;c2.es); + =
tls_update_remote_addr(c->c2.tls_multi, incoming); + } + process_incoming_link_part2(c, lsi, orig_=
buf); + } + + gc_free(&gc); perf=
_pop(); }
To view, visit change 844 . To unsubscribe, or for help writing mail filter=
s, visit settings .
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I806757a8c6f9a589665624f1763=
91b5f7b87f581
Gerrit-Change-Number: 844
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <ralf@...2726...>=
;
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
--5JT/kLUiP/4=--