aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.h5
-rw-r--r--forward.c4
-rw-r--r--openvpn.h1
-rw-r--r--push.c13
4 files changed, 20 insertions, 3 deletions
diff --git a/common.h b/common.h
index 5548f7c..0ca7323 100644
--- a/common.h
+++ b/common.h
@@ -87,6 +87,11 @@ typedef unsigned long ptr_type;
#define PUSH_BUNDLE_SIZE 1024
/*
+ * In how many seconds does client re-send PUSH_REQUEST if we haven't yet received a reply
+ */
+#define PUSH_REQUEST_INTERVAL 5
+
+/*
* A sort of pseudo-filename for data provided inline within
* the configuration file.
*/
diff --git a/forward.c b/forward.c
index 65b8f0c..7212db4 100644
--- a/forward.c
+++ b/forward.c
@@ -178,8 +178,8 @@ check_push_request_dowork (struct context *c)
{
send_push_request (c);
- /* if no response to first push_request, retry at 5 second intervals */
- event_timeout_modify_wakeup (&c->c2.push_request_interval, 5);
+ /* if no response to first push_request, retry at PUSH_REQUEST_INTERVAL second intervals */
+ event_timeout_modify_wakeup (&c->c2.push_request_interval, PUSH_REQUEST_INTERVAL);
}
#endif /* P2MP */
diff --git a/openvpn.h b/openvpn.h
index 47c9734..0ee439c 100644
--- a/openvpn.h
+++ b/openvpn.h
@@ -431,6 +431,7 @@ struct context_2
#endif
struct event_timeout push_request_interval;
+ int n_sent_push_requests;
bool did_pre_pull_restore;
/* hash of pulled options, so we can compare when options change */
diff --git a/push.c b/push.c
index 2e8aa55..ece3121 100644
--- a/push.c
+++ b/push.c
@@ -189,7 +189,18 @@ incoming_push_message (struct context *c, const struct buffer *buffer)
bool
send_push_request (struct context *c)
{
- return send_control_channel_string (c, "PUSH_REQUEST", D_PUSH);
+ const int max_push_requests = c->options.handshake_window / PUSH_REQUEST_INTERVAL;
+ if (++c->c2.n_sent_push_requests <= max_push_requests)
+ {
+ return send_control_channel_string (c, "PUSH_REQUEST", D_PUSH);
+ }
+ else
+ {
+ msg (D_STREAM_ERRORS, "No reply from server after sending %d push requests", max_push_requests);
+ c->sig->signal_received = SIGUSR1; /* SOFT-SIGUSR1 -- server-pushed connection reset */
+ c->sig->signal_text = "no-push-reply";
+ return false;
+ }
}
#if P2MP_SERVER