Skip to contentSkip to conversation

Artificial delays during connection setup

Openvpn-devel Jiri Horky 3 participants 4 messages Apr 29, 2016

lore
Share & tools
lore

Jiri Horky

author
#0 lore raw

Hi list,

I was wondering why the connection setup on Linux with openvpn 2.3.10 takes about 2.5s even on local network and dig deeper in the code. It seems there are two places where an artificial delay of 1s is added.

First one is waiting before checking the connection status is checked in src/openvpn/init.c

1108 if (!deferred)
1109 {
1110 /* initialize connection establishment timer */
1111 event_timeout_init (&c->c2.wait_for_connect, 1, now);
1112

And the second one is waiting before sending push_request in src/openvpn/forward.c:

 218         /* send push request in 1 sec */
 219         event_timeout_init (&c->c2.push_request_interval, 1, now);
 220         reset_coarse_timers (c);

221 }

Is there any good reason why the latency is added there? I've tried to get rid of it and I am able to connect in less than 300ms on a server 30ms away from me (on Linux).

Regards
Jiri Horky

#1 lore raw

Am 29.04.16 um 19:51 schrieb Jiri Horky:

Quoted 6 lines

Hi list,

I was wondering why the connection setup on Linux with openvpn 2.3.10 takes about 2.5s even on local network and dig deeper in the code. It seems there are two places where an artificial delay of 1s is added.

Quoted 8 lines

First one is waiting before checking the connection status is checked in src/openvpn/init.c

1108 if (!deferred)
1109 {
1110 /* initialize connection establishment timer */
1111 event_timeout_init (&c->c2.wait_for_connect, 1, now);
1112

I think nobody knows anymore why there is this timeout and without proper testing/codereview just removing it might be a bit dangerous.

Quoted 4 lines

And the second one is waiting before sending push_request in src/openvpn/forward.c:

Quoted 8 lines
 218         /* send push request in 1 sec */
 219         event_timeout_init (&c->c2.push_request_interval, 1, now);
 220         reset_coarse_timers (c);

221 }

Is there any good reason why the latency is added there? I've tried to get rid of it and I am able to connect in less than 300ms on a server 30ms away from me (on Linux).

That has already been removed in master (Commit:
afb93fac803fbab7406d3b2dff6d1f39365bca74)

Arne

author
#2 lore raw

Thanks for the quick response.

Quoted 10 lines · Arne Schwabe

Am 29.04.16 um 19:51 schrieb Jiri Horky:

Quoted 9 lines

Hi list,

I was wondering why the connection setup on Linux with openvpn 2.3.10 takes about 2.5s even on local network and dig deeper in the code. It seems there are two places where an artificial delay of 1s is added.

First one is waiting before checking the connection status is checked in src/openvpn/init.c

Quoted 7 lines
Quoted 5 lines

1108 if (!deferred)
1109 {
1110 /* initialize connection establishment timer */
1111 event_timeout_init (&c->c2.wait_for_connect, 1, now);
1112

I think nobody knows anymore why there is this timeout and without proper testing/codereview just removing it might be a bit dangerous.

At least on Linux, I checked that the client was doing completely nothing during this wait (no syscall, nor other activity). On Windows/Android, we need to check more.

Jiri Horky

#3 lore raw
Quoted 18 lines · Jiri Horky

Thanks for the quick response.

Quoted 15 lines · Arne Schwabe

Am 29.04.16 um 19:51 schrieb Jiri Horky:

Quoted 14 lines

Hi list,

I was wondering why the connection setup on Linux with openvpn 2.3.10 takes about 2.5s even on local network and dig deeper in the code. It seems there are two places where an artificial delay of 1s is added.

First one is waiting before checking the connection status is checked in src/openvpn/init.c

1108 if (!deferred)
1109 {
1110 /* initialize connection establishment timer */
1111 event_timeout_init (&c->c2.wait_for_connect, 1, now);
1112

Quoted 5 lines
Quoted 2 lines

I think nobody knows anymore why there is this timeout and without proper testing/codereview just removing it might be a bit dangerous.

At least on Linux, I checked that the client was doing completely nothing during this wait (no syscall, nor other activity). On Windows/Android, we need to check more.

It will also be needed to verify this from a server perspective as well. I see that do_init_timers() are also called via do_deferred_options() via multi_connection_established() via multi_process_post() - from a very quick 30 seconds look at the code looks to be used on both client and server.

Signature · 3 lines
kind regards,

David Sommerseth