@@ -929,6 +929,13 @@ use this command:
remote SKIP
+Starting OpenVPN version 2.6 (management version > 3), skip
+multiple remotes using:
+
+ remote SKIP n
+
+where n > 0 is the number of remotes to skip.
+
COMMAND -- proxy (OpenVPN 2.3 or higher)
--------------------------------------------
@@ -348,6 +348,7 @@ management_callback_remote_cmd(void *arg, const char **p)
{
flags = CE_MAN_QUERY_REMOTE_SKIP;
ret = true;
+ c->options.ce_advance_count = (p[2]) ? atoi(p[2]) : 1;
}
else if (!strcmp(p[1], "MOD") && p[2] && p[3])
{
@@ -520,18 +521,28 @@ next_connection_entry(struct context *c)
c->c1.link_socket_addr.remote_list;
}
+ int advance_count = 1;
+
+ /* If previous connection entry was skipped by management client
+ * with a count to advance by, apply it.
+ */
+ if (c->options.ce_advance_count > 0)
+ {
+ advance_count = c->options.ce_advance_count;
+ }
+
/*
* Increase the number of connection attempts
* If this is connect-retry-max * size(l)
* OpenVPN will quit
*/
- c->options.unsuccessful_attempts++;
+ c->options.unsuccessful_attempts += advance_count;
+ l->current += advance_count;
- if (++l->current >= l->len)
+ if (l->current >= l->len)
{
-
- l->current = 0;
+ l->current %= l->len;
if (++n_cycles >= 2)
{
msg(M_FATAL, "No usable connection profiles are present");
@@ -540,6 +551,7 @@ next_connection_entry(struct context *c)
}
}
+ c->options.ce_advance_count = 1;
ce = l->array[l->current];
if (ce->flags & CE_DISABLED)
@@ -253,6 +253,8 @@ struct options
bool no_advance;
/* Counts the number of unsuccessful connection attempts */
unsigned int unsuccessful_attempts;
+ /* count of connection entries to advance by when no_advance is not set */
+ int ce_advance_count;
#if ENABLE_MANAGEMENT
struct http_proxy_options *http_proxy_override;