Browse code

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 <janjust@nikhef.nl>
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
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 <gert@greenie.muc.de>
(cherry picked from commit 5a2ed714d14acb2312d27fe40e300be96d970c27)

Arne Schwabe authored on 2021/03/18 01:00:38
Showing 2 changed files
... ...
@@ -3597,6 +3597,11 @@ pre_pull_save(struct options *o)
3597 3597
             o->pre_pull->client_nat = clone_client_nat_option_list(o->client_nat, &o->gc);
3598 3598
             o->pre_pull->client_nat_defined = true;
3599 3599
         }
3600
+
3601
+        /* Ping related options should be reset to the config values on reconnect */
3602
+        o->pre_pull->ping_rec_timeout = o->ping_rec_timeout;
3603
+        o->pre_pull->ping_rec_timeout_action = o->ping_rec_timeout_action;
3604
+        o->pre_pull->ping_send_timeout = o->ping_send_timeout;
3600 3605
     }
3601 3606
 }
3602 3607
 
... ...
@@ -3643,6 +3648,10 @@ pre_pull_restore(struct options *o, struct gc_arena *gc)
3643 3643
         }
3644 3644
 
3645 3645
         o->foreign_option_index = pp->foreign_option_index;
3646
+
3647
+        o->ping_rec_timeout = pp->ping_rec_timeout;
3648
+        o->ping_rec_timeout_action = pp->ping_rec_timeout_action;
3649
+        o->ping_send_timeout = pp->ping_send_timeout;
3646 3650
     }
3647 3651
 
3648 3652
     o->push_continuation = 0;
... ...
@@ -75,6 +75,10 @@ struct options_pre_pull
75 75
     bool client_nat_defined;
76 76
     struct client_nat_option_list *client_nat;
77 77
 
78
+    int ping_send_timeout;
79
+    int ping_rec_timeout;
80
+    int ping_rec_timeout_action;
81
+
78 82
     int foreign_option_index;
79 83
 };
80 84