Start TLS after connection established without waiting.
PATCH 1/1 Start TLS after connection established without waiting.
There is a ~1s delay between establishing connection with remote server and starting TLS handshake.
This change removes delay and improves connection time.
--- src/openvpn/forward.c | 61 +++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 29 deletions(-)
src/openvpn/forward.c +32 -29
@@ -433,28 +433,6 @@ check_connection_established_dowork(struct context *c) {if (CONNECTION_ESTABLISHED (c)) { -#if P2MP -/* if --pull was specified, send a push request to server */ -if (c->c2.tls_multi && c->options.pull) - { -#ifdef ENABLE_MANAGEMENT -if (management) - { -management_set_state (management, -OPENVPN_STATE_GET_CONFIG , -NULL , -NULL , -NULL , -NULL , -NULL ); - } -#endif -/* fire up push request right away (already 1s delayed) */ -event_timeout_init (&c->c2.push_request_interval,0 , now); -reset_coarse_timers (c); - } - else -#endif /* if P2MP */ {do_up (c, false,0 ); }
@@ -1943,17 +1921,34 @@ pre_select(struct context *c) } }#endif - -/* check coarse timers? */ -check_coarse_timers (c); -if (c->sig->signal_received) - { -return ; - } + +bool pre_connection_state =CONNECTION_ESTABLISHED (c);/* Does TLS need service? */ check_tls (c); +bool post_connection_state =CONNECTION_ESTABLISHED (c); + +if (!pre_connection_state && post_connection_state){ + +if (c->c2.tls_multi && c->options.pull) + { +#ifdef ENABLE_MANAGEMENT +if (management) + { +management_set_state (management, +OPENVPN_STATE_GET_CONFIG , +NULL , +NULL , +NULL , +NULL , +NULL ); + } +#endif +check_push_request_dowork (c); + } + } +/* In certain cases, TLS errors will require a restart */ check_tls_errors (c);if (c->sig->signal_received)
@@ -1961,6 +1956,14 @@ pre_select(struct context *c)return ; } +/* check coarse timers */ +check_coarse_timers (c); +if (c->sig->signal_received) + { +return ; + } + +/* check for incoming configuration info on the control channel */ check_incoming_control_channel (c);
--
2.9.3 (Apple Git-75)
Hi,
this patch has been mangled by your e-mail client.
Could you please re-send it using git send-email?
Thanks a lot
Quoted 107 lines · Daniel Kaldor
There is a ~1s delay between establishing connection with remote server and starting TLS handshake.
This change removes delay and improves connection time.--- src/openvpn/forward.c | 61 +++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 29 deletions(-)src/openvpn/forward.c +32
-30@@ -433,28 +433,6 @@ check_connection_established_dowork(struct context *c) {if (CONNECTION_ESTABLISHED (c)) { -#if P2MP -/* if --pull was specified, send a push request to server */ -if (c->c2.tls_multi && c->options.pull) - { -#ifdef ENABLE_MANAGEMENT -if (management) - { -management_set_state (management, -OPENVPN_STATE_GET_CONFIG , -NULL , -NULL , -NULL , -NULL , -NULL ); - } -#endif -/* fire up push request right away (already 1s delayed) */ -event_timeout_init (&c->c2.push_request_interval,0 , now); -reset_coarse_timers (c); - } - else -#endif /* if P2MP */ {do_up (c, false,0 ); }@@ -1943,17 +1921,34 @@ pre_select(struct context *c) } }#endif - -/* check coarse timers? */ -check_coarse_timers (c); -if (c->sig->signal_received) - { -return ; - } + +bool pre_connection_state =CONNECTION_ESTABLISHED (c);/* Does TLS need service? */ check_tls (c); +bool post_connection_state =CONNECTION_ESTABLISHED (c); + +if (!pre_connection_state && post_connection_state){ + +if (c->c2.tls_multi && c->options.pull) + { +#ifdef ENABLE_MANAGEMENT +if (management) + { +management_set_state (management, +OPENVPN_STATE_GET_CONFIG , +NULL , +NULL , +NULL , +NULL , +NULL ); + } +#endif +check_push_request_dowork (c); + } + } +/* In certain cases, TLS errors will require a restart */ check_tls_errors (c);if (c->sig->signal_received)@@ -1961,6 +1956,14 @@ pre_select(struct context *c)return ; } +/* check coarse timers */ +check_coarse_timers (c); +if (c->sig->signal_received) + { +return ; + } + +/* check for incoming configuration info on the control channel */ check_incoming_control_channel (c); --2.9.3 (Apple Git-75)
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Signature · 1 line
Antonio Quartulli
Hi,
Quoted 3 lines · Antonio Quartulli
this patch has been mangled by your e-mail client.
Could you please re-send it using git send-email?
That seems to have been a false positive on your side... git applies this patch just fine, so at least here it arrived without mangling (= nothing wrong on the sender side).
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Hi,
Quoted 11 lines · Gert Doering
Hi,
Quoted 3 lines · Antonio Quartulli
this patch has been mangled by your e-mail client.
Could you please re-send it using git send-email?
That seems to have been a false positive on your side... git applies this patch just fine, so at least here it arrived without mangling (= nothing wrong on the sender side).
ops, sorry then. It probably was my local parser (used to highlight diffs) that failed.
Cheers,
Signature · 1 line
Antonio Quartulli
A message that is not in the archive (sent off-list or not yet received): [email protected]...
Hi,
Quoted 3 lines · Steffan Karger
While this sounds like something we'd like to have (i.e, feature-ACK), this doesn't really explain why this change resolves the issue, nor why this is the right fix.
As a bit of background why I assume this will fix "things" - we have a few places in the connection sequence where we do something, and when it's finished, set up a coarse timer to "go on with the next step" - which always means "1 second delay" because that's how the coarse timers work.
I've dug into this a bit when figuring out commit afb93fac803fbab7 - which helped a bit (this was setting up an "in 1 second" coarse timer, which always got an extra second due to scheduling), but I'm sure there is more room for improvement.
OTOH this is all tricky code, with client and server and tcp and udp all intermixed.
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...