[Openvpn-devel] Set o->use_peer_id flag for p2p mode

Message ID 20220524091916.145-1-lstipakov@gmail.com
State Accepted
Headers show
Series
  • [Openvpn-devel] Set o->use_peer_id flag for p2p mode
Related show

Commit Message

Lev Stipakov May 24, 2022, 9:19 a.m.
From: Lev Stipakov <lev@openvpn.net>

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.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
---
 src/openvpn/init.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Antonio Quartulli June 22, 2022, 9:16 a.m. | #1
Hi,

On 24/05/2022 11:19, Lev Stipakov wrote:
> From: Lev Stipakov <lev@openvpn.net>
> 
> 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.
> 
> Signed-off-by: Lev Stipakov <lev@openvpn.net>

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.

Acked-by: Antonio Quartulli <a@unstable.cc>
Gert Doering June 23, 2022, 1:34 p.m. | #2
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 <lev@openvpn.net>
     Acked-by: Antonio Quartulli <a@unstable.cc>
     Message-Id: <20220524091916.145-1-lstipakov@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24430.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index b0c62a85..bf01d3d6 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -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,