[PATCH] Added option 'RetryDelay'
Stephen Frost
sfrost at snowman.net
Sat Dec 30 00:35:38 EST 2000
* Stephen Frost (sfrost at snowman.net) wrote:
> Being rather aggrevated when testing at the enforced 1 second
> delay between each connection attempt and the useless 1 second delay
> done after all connection attempts have failed I wrote a patch to make
> the number of seconds delayed between each connection attempt
> configurable.
Here is my patch again, this time against openssh-SNAP-20001229.
I'd hope to see this patch or something similar put in place. It does
not change default behaviour in any way but adds an option for those of
us who want it. :)
Stephen
-------------- next part --------------
diff -u --recursive openssh-clean/readconf.c openssh/readconf.c
--- openssh-clean/readconf.c Thu Dec 28 11:40:05 2000
+++ openssh/readconf.c Fri Dec 29 06:51:55 2000
@@ -98,7 +98,7 @@
#endif
oIdentityFile, oHostName, oPort, oCipher, oRemoteForward, oLocalForward,
oUser, oHost, oEscapeChar, oRhostsRSAAuthentication, oProxyCommand,
- oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts,
+ oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, oRetryDelay,
oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression,
oCompressionLevel, oKeepAlives, oNumberOfPasswordPrompts, oTISAuthentication,
oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol,
@@ -154,6 +154,7 @@
{ "globalknownhostsfile2", oGlobalKnownHostsFile2 },
{ "userknownhostsfile2", oUserKnownHostsFile2 },
{ "connectionattempts", oConnectionAttempts },
+ { "retrydelay", oRetryDelay },
{ "batchmode", oBatchMode },
{ "checkhostip", oCheckHostIP },
{ "stricthostkeychecking", oStrictHostKeyChecking },
@@ -475,6 +476,10 @@
intptr = &options->connection_attempts;
goto parse_int;
+ case oRetryDelay:
+ intptr = &options->retry_delay;
+ goto parse_int;
+
case oCipher:
intptr = &options->cipher;
arg = strdelim(&s);
@@ -688,6 +693,7 @@
options->compression_level = -1;
options->port = -1;
options->connection_attempts = -1;
+ options->retry_delay = -1;
options->number_of_password_prompts = -1;
options->cipher = -1;
options->ciphers = NULL;
@@ -771,6 +777,8 @@
options->port = 0; /* Filled in ssh_connect. */
if (options->connection_attempts == -1)
options->connection_attempts = 4;
+ if (options->retry_delay == -1)
+ options->retry_delay = 1;
if (options->number_of_password_prompts == -1)
options->number_of_password_prompts = 3;
/* Selected in ssh_login(). */
diff -u --recursive openssh-clean/readconf.h openssh/readconf.h
--- openssh-clean/readconf.h Thu Dec 28 11:40:05 2000
+++ openssh/readconf.h Fri Dec 29 06:51:55 2000
@@ -61,8 +61,10 @@
LogLevel log_level; /* Level for logging. */
int port; /* Port to connect. */
- int connection_attempts; /* Max attempts (seconds) before
+ int connection_attempts; /* Max connection attempts before
* giving up */
+ int retry_delay; /* Number of seconds to delay between each
+ * connection attempt */
int number_of_password_prompts; /* Max number of password
* prompts. */
int cipher; /* Cipher to use. */
diff -u --recursive openssh-clean/ssh.0 openssh/ssh.0
--- openssh-clean/ssh.0 Thu Dec 28 12:30:15 2000
+++ openssh/ssh.0 Fri Dec 29 06:51:55 2000
@@ -538,6 +538,10 @@
additional forwardings can be given on the command line. Only
the superuser can forward privileged ports.
+ RetryDelay
+ Specifies the number of seconds to delay between each connection
+ attempt.
+
RhostsAuthentication
Specifies whether to try rhosts based authentication. Note that
this declaration only affects the client side and has no effect
diff -u --recursive openssh-clean/ssh.1 openssh/ssh.1
--- openssh-clean/ssh.1 Thu Dec 28 11:40:05 2000
+++ openssh/ssh.1 Fri Dec 29 06:51:55 2000
@@ -878,6 +878,10 @@
Multiple forwardings may be specified, and additional
forwardings can be given on the command line.
Only the superuser can forward privileged ports.
+.It Cm RetryDelay
+Specifies the number of seconds to delay before attempting to
+reconnect after a failed ConnectionAttempt
+The argument must be an integer.
.It Cm RhostsAuthentication
Specifies whether to try rhosts based authentication.
Note that this
diff -u --recursive openssh-clean/ssh.c openssh/ssh.c
--- openssh-clean/ssh.c Thu Dec 28 11:40:05 2000
+++ openssh/ssh.c Fri Dec 29 06:55:26 2000
@@ -607,7 +607,7 @@
/* Open a connection to the remote host. */
ok = ssh_connect(host, &hostaddr, options.port,
- options.connection_attempts,
+ options.connection_attempts, options.retry_delay,
original_effective_uid != 0 || !options.use_privileged_port,
original_real_uid,
options.proxy_command);
diff -u --recursive openssh-clean/ssh.h openssh/ssh.h
--- openssh-clean/ssh.h Thu Dec 21 20:44:00 2000
+++ openssh/ssh.h Fri Dec 29 06:51:55 2000
@@ -323,11 +323,12 @@
* privileges if anonymous is false. Connection_attempts specifies the
* maximum number of tries, one per second. This returns true on success,
* and zero on failure. If the connection is successful, this calls
- * packet_set_connection for the connection.
+ * packet_set_connection for the connection. Retry_delay specifies the seconds
+ * to wait between connection attempts.
*/
int
ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
- u_short port, int connection_attempts,
+ u_short port, int connection_attempts, int retry_delay,
int anonymous, uid_t original_real_uid,
const char *proxy_command);
diff -u --recursive openssh-clean/sshconnect.c openssh/sshconnect.c
--- openssh-clean/sshconnect.c Thu Dec 28 11:40:06 2000
+++ openssh/sshconnect.c Fri Dec 29 06:51:55 2000
@@ -176,14 +176,14 @@
* If port is 0, the default port will be used. If anonymous is zero,
* a privileged port will be allocated to make the connection.
* This requires super-user privileges if anonymous is false.
- * Connection_attempts specifies the maximum number of tries (one per
- * second). If proxy_command is non-NULL, it specifies the command (with %h
- * and %p substituted for host and port, respectively) to use to contact
- * the daemon.
+ * Connection_attempts specifies the maximum number of tries. Retry_delay
+ * specifies the seconds to delay between attempts. If proxy_command is
+ * non-NULL, it specifies the command (with %h * and %p substituted for
+ * host and port, respectively) to use to contact the daemon.
*/
int
ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
- u_short port, int connection_attempts,
+ u_short port, int connection_attempts, int retry_delay,
int anonymous, uid_t original_real_uid,
const char *proxy_command)
{
@@ -280,7 +280,7 @@
break; /* Successful connection. */
/* Sleep a moment before retrying. */
- sleep(1);
+ sleep(retry_delay);
}
freeaddrinfo(aitop);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20001229/6205cfff/attachment.bin
More information about the openssh-unix-dev
mailing list