]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Client will now try to reconnect if no push reply received
authorJames Yonan <james@openvpn.net>
Sun, 20 Mar 2011 19:43:06 +0000 (19:43 +0000)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Tue, 26 Apr 2011 20:29:11 +0000 (22:29 +0200)
within handshake-window seconds.

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@7066 e7ae566f-a301-0410-adde-c780ea21d3b5

common.h
forward.c
openvpn.h
push.c

index 5548f7c1a69e6fdc960f25f4cb27371ba5ea5653..0ca7323435eeed6eda4584a258ea0594f5c31658 100644 (file)
--- a/common.h
+++ b/common.h
@@ -86,6 +86,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.
index 65b8f0c8c3d45d7e46fe0613eb09c4aad4f2413c..7212db4338232ed2404deec5f25a1b3be42e7d99 100644 (file)
--- 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 */
index 47c9734b39133b11b342f28a3a562309c0f28f4e..0ee439cad21b0ff57e609b3b31c39a84c4851b64 100644 (file)
--- 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 2e8aa55f2a4f18ff3ee734fe4bb74ce0cfc8c427..ece312187d1cf6632cd880e6c39280929440ec0a 100644 (file)
--- 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