Browse code

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
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Message-Id: <20250617084136.10215-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31902.html
URL: https://gerrit.openvpn.net/c/openvpn/+/1063
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Ralf Lici authored on 2025/06/17 17:41:28
Showing 1 changed files
... ...
@@ -3217,6 +3217,12 @@ multi_process_float(struct multi_context *m, struct multi_instance *mi,
3217 3217
     struct hash *hash = m->hash;
3218 3218
     struct gc_arena gc = gc_new();
3219 3219
 
3220
+    if (mi->real.type & MR_WITH_PROTO)
3221
+    {
3222
+        real.type |= MR_WITH_PROTO;
3223
+        real.proto = sock->info.proto;
3224
+    }
3225
+
3220 3226
     if (!mroute_extract_openvpn_sockaddr(&real, &m->top.c2.from.dest, true))
3221 3227
     {
3222 3228
         goto done;