Skip to contentSkip to conversation

Change in openvpn[master]: Preserve socket protocol during float processing

Openvpn-devel In review ralf_lici (Code Review) 2 participants 6 messages Jun 17, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1750145305000.I0e17d9aea32eab7f44ed95037f077ae6dec52053@...2715...

#1 lore raw

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/+/1063?usp=email

to review the following change.

Change subject: Preserve socket protocol during float processing
......................................................................

Preserve socket protocol during float processing

During a float operation, we remove the old mroute object corresponding to the current multi instance from the hash table and insert a new one. With the introduction of the multi-socket feature, the mroute structure gained a proto field, which must also be set in the new instance, otherwise, hash table lookups will fail.

This commit ensures that the proto field is propagated from the original to the new mroute object during float processing.

Change-Id I0e17d9aea32eab7f44ed95037f077ae6dec52053

---
M src/openvpn/multi.c

1 file changed, 6 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1063/1

src/openvpn/multi.c +6 -0
index 169af43..a760e07 100644
@@ -3217,6 +3217,12 @@
     struct hash *hash = m->hash;
     struct gc_arena gc = gc_new();
 
+    if (mi->real.type & MR_WITH_PROTO)
+    {
+        real.type |= MR_WITH_PROTO;
+        real.proto = sock->info.proto;
+    }
+
     if (!mroute_extract_openvpn_sockaddr(&real, &m->top.c2.from.dest, true))
     {
         goto done;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1063?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0e17d9aea32eab7f44ed95037f077ae6dec52053
Gerrit-Change-Number: 1063
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, ralf_lici.

its_Giaan has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1063?usp=email )

Change subject: Preserve socket protocol during float processing
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1063?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0e17d9aea32eab7f44ed95037f077ae6dec52053
Gerrit-Change-Number: 1063
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: its_Giaan <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ralf_lici <[email protected]...>
Gerrit-Comment-Date: Tue, 17 Jun 2025 07:55:47 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 Preserve socket protocol during float processing

In reply to a message not in the archive

From: Ralf Lici <[email protected]...>

During a float operation, we remove the old mroute object corresponding to the current multi instance from the hash table and insert a new one. With the introduction of the multi-socket feature, the mroute structure gained a proto field, which must also be set in the new instance, otherwise, hash table lookups will fail.

This commit ensures that the proto field is propagated from the original to the new mroute object during float processing.

Change-Id I0e17d9aea32eab7f44ed95037f077ae6dec52053

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1063
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gianmarco De Gregori <[email protected]...>

src/openvpn/multi.c +6 -0
index 169af43..a760e07 100644
@@ -3217,6 +3217,12 @@
     struct hash *hash = m->hash;
     struct gc_arena gc = gc_new();
 
+    if (mi->real.type & MR_WITH_PROTO)
+    {
+        real.type |= MR_WITH_PROTO;
+        real.proto = sock->info.proto;
+    }
+
     if (!mroute_extract_openvpn_sockaddr(&real, &m->top.c2.from.dest, true))
     {
         goto done;
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: Preserve socket protocol during float processing

Explanation is very reasonable - good catch, "just adding a field to the mroute" was far less trivial than the original patch made us assume.

Since it has an +2 from Giaan I have not further tested it, just stared a bit at the change and it makes sense. The server test framework does not currently test floating, which is unfortunately and I really need to address this (but it's somewhat tricky to get right with the t_client framework).

mail-archive.com is not cooperating (it seems to categorize all the patches I relay from gerrit to the list as "spam" - the mails from gerrit itself are there but the patch I sent is not...?) - so I recorded the gerrit URL and the initial patch submission URL instead.

Your patch has been applied to the master branch.

commit db9632f7f976a5e0b810d76173a38f76879d99c0

Author: Ralf Lici
Date:   Tue Jun 17 10:41:28 2025 +0200
     Preserve socket protocol during float processing

     Signed-off-by: Ralf Lici <[email protected]...>
     Acked-by: Gianmarco De Gregori <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg31902.html
     URL: https://gerrit.openvpn.net/c/openvpn/+/1063
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1063?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by its_Giaan

Change subject: Preserve socket protocol during float processing
......................................................................

Preserve socket protocol during float processing

During a float operation, we remove the old mroute object corresponding to the current multi instance from the hash table and insert a new one. With the introduction of the multi-socket feature, the mroute structure gained a proto field, which must also be set in the new instance, otherwise, hash table lookups will fail.

This commit ensures that the proto field is propagated from the original to the new mroute object during float processing.

Change-Id I0e17d9aea32eab7f44ed95037f077ae6dec52053

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31902.html
URL: https://gerrit.openvpn.net/c/openvpn/+/1063

---
M src/openvpn/multi.c

1 file changed, 6 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/63/1063/2

src/openvpn/multi.c +6 -0
index 169af43..a760e07 100644
@@ -3217,6 +3217,12 @@
     struct hash *hash = m->hash;
     struct gc_arena gc = gc_new();
 
+    if (mi->real.type & MR_WITH_PROTO)
+    {
+        real.type |= MR_WITH_PROTO;
+        real.proto = sock->info.proto;
+    }
+
     if (!mroute_extract_openvpn_sockaddr(&real, &m->top.c2.from.dest, true))
     {
         goto done;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1063?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0e17d9aea32eab7f44ed95037f077ae6dec52053
Gerrit-Change-Number: 1063
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: its_Giaan <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1063?usp=email )

Change subject: Preserve socket protocol during float processing
......................................................................

Preserve socket protocol during float processing

During a float operation, we remove the old mroute object corresponding to the current multi instance from the hash table and insert a new one. With the introduction of the multi-socket feature, the mroute structure gained a proto field, which must also be set in the new instance, otherwise, hash table lookups will fail.

This commit ensures that the proto field is propagated from the original to the new mroute object during float processing.

Change-Id I0e17d9aea32eab7f44ed95037f077ae6dec52053

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31902.html
URL: https://gerrit.openvpn.net/c/openvpn/+/1063

---
M src/openvpn/multi.c

1 file changed, 6 insertions(+), 0 deletions(-)
src/openvpn/multi.c +6 -0
index 169af43..a760e07 100644
@@ -3217,6 +3217,12 @@
     struct hash *hash = m->hash;
     struct gc_arena gc = gc_new();
 
+    if (mi->real.type & MR_WITH_PROTO)
+    {
+        real.type |= MR_WITH_PROTO;
+        real.proto = sock->info.proto;
+    }
+
     if (!mroute_extract_openvpn_sockaddr(&real, &m->top.c2.from.dest, true))
     {
         goto done;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1063?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0e17d9aea32eab7f44ed95037f077ae6dec52053
Gerrit-Change-Number: 1063
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: its_Giaan <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged