From: Arne Schwabe Date: Wed, 17 Mar 2021 16:00:38 +0000 (+0100) Subject: Restore also ping related options on a reconnect X-Git-Tag: v2.5.2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0e844c892d6f67977bf8e9162cbc43a3f64ba46;p=thirdparty%2Fopenvpn.git Restore also ping related options on a reconnect This fixes the issue that if a client reconnects the next connection entries inherits the keepalive settings that were pushed or set by the previous entry. Since UDP+PULL entries have an implicit 120s timeout, this timeout also got applied to a TCP session after an UDP entry. Patch v2: rebase on master Reported-By: Jan Just Keijser Signed-off-by: Arne Schwabe Acked-by: Antonio Quartulli Message-Id: <20210317160038.25828-3-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21675.html Signed-off-by: Gert Doering (cherry picked from commit 5a2ed714d14acb2312d27fe40e300be96d970c27) --- diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 620785bef..6fcbd4dd1 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3597,6 +3597,11 @@ pre_pull_save(struct options *o) o->pre_pull->client_nat = clone_client_nat_option_list(o->client_nat, &o->gc); o->pre_pull->client_nat_defined = true; } + + /* Ping related options should be reset to the config values on reconnect */ + o->pre_pull->ping_rec_timeout = o->ping_rec_timeout; + o->pre_pull->ping_rec_timeout_action = o->ping_rec_timeout_action; + o->pre_pull->ping_send_timeout = o->ping_send_timeout; } } @@ -3643,6 +3648,10 @@ pre_pull_restore(struct options *o, struct gc_arena *gc) } o->foreign_option_index = pp->foreign_option_index; + + o->ping_rec_timeout = pp->ping_rec_timeout; + o->ping_rec_timeout_action = pp->ping_rec_timeout_action; + o->ping_send_timeout = pp->ping_send_timeout; } o->push_continuation = 0; diff --git a/src/openvpn/options.h b/src/openvpn/options.h index 877e93962..79dbea849 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -75,6 +75,10 @@ struct options_pre_pull bool client_nat_defined; struct client_nat_option_list *client_nat; + int ping_send_timeout; + int ping_rec_timeout; + int ping_rec_timeout_action; + int foreign_option_index; };