Skip to contentSkip to conversation

Set o->use_peer_id flag for p2p mode

PATCH In review Lev Stipakov 3 participants 3 messages May 24, 2022 – Jun 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set o->use_peer_id flag for p2p mode

From: Lev Stipakov <[email protected]...>

There are two flags to indicate peer-id usage, one is in tls_multi struct and another one is in options.

For P2P mode we don't set this flag in options, which is used in MTU calculation. As a result, automatically calculated MSS value in P2P mode is wrong,

Fix by bring use_peer_id flag in options and tls_multi into sync for P2P.

---
 src/openvpn/init.c | 2 ++
 1 file changed, 2 insertions(+)
src/openvpn/init.c +2 -0
index b0c62a85..bf01d3d6 100644
@@ -2144,6 +2144,8 @@ do_deferred_p2p_ncp(struct context *c)
         return true;
     }
 
+    c->options.use_peer_id = c->c2.tls_multi->use_peer_id;
+
     struct tls_session *session = &c->c2.tls_multi->session[TM_ACTIVE];
 
     const char *ncp_cipher = get_p2p_ncp_cipher(session, c->c2.tls_multi->peer_info,
Signature · 1 line
2.23.0.windows.1
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 5 lines · Lev Stipakov

From: Lev Stipakov <[email protected]...>

There are two flags to indicate peer-id usage, one is in tls_multi struct and another one is in options.

Quoted 8 lines

For P2P mode we don't set this flag in options, which is used in MTU calculation. As a result, automatically calculated MSS value in P2P mode is wrong,

Fix by bring use_peer_id flag in options and tls_multi into sync for P2P.

Does what it says and creates no side effect.
(It's easy to check where o->use_peer_id is used)

Moreover, this patch is needed to ensure the p2p case in dco works as expected.

Signature · 1 line
Antonio Quartulli
#2 lore raw
In reply to Lev Stipakov

This is p2p NCP, which is all new in 2.6(-to-be) - and needed for DCO.

I have not tested this more than "it compiles", but Lev and Antonio have.

Your patch has been applied to the master branch.

commit 0d46c4963ae47581eadd94dbd2190c66086b9ecb

Author: Lev Stipakov
Date:   Tue May 24 12:19:16 2022 +0300
     Set o->use_peer_id flag for p2p mode

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Antonio Quartulli <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24430.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering