Bugzilla – Attachment 3419 Details for
Bug 2265
ServerAlive{Interval,CountMax} ignored if using an active -R or -L tunnel
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Make ServerAlive behave correctly during client port forward activity
ssh-serveralive.patch (text/plain), 3.01 KB, created by
Darren Tucker
on 2020-06-26 15:41:11 AEST
(
hide
)
Description:
Make ServerAlive behave correctly during client port forward activity
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2020-06-26 15:41:11 AEST
Size:
3.01 KB
patch
obsolete
>Index: clientloop.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/clientloop.c,v >retrieving revision 1.344 >diff -u -p -r1.344 clientloop.c >--- clientloop.c 24 Apr 2020 02:19:40 -0000 1.344 >+++ clientloop.c 26 Jun 2020 05:31:30 -0000 >@@ -155,6 +155,7 @@ static int connection_out; /* Connection > static int need_rekeying; /* Set to non-zero if rekeying is requested. */ > static int session_closed; /* In SSH2: login session closed. */ > static u_int x11_refuse_time; /* If >0, refuse x11 opens after this time. */ >+static time_t server_alive_time; /* Time to do server_alive_check */ > > static void client_init_dispatch(struct ssh *ssh); > int session_ident = -1; >@@ -488,7 +489,7 @@ client_wait_until_can_do_something(struc > { > struct timeval tv, *tvp; > int timeout_secs; >- time_t minwait_secs = 0, server_alive_time = 0, now = monotime(); >+ time_t minwait_secs = 0, now = monotime(); > int r, ret; > > /* Add any selections by the channel mechanism. */ >@@ -517,10 +518,8 @@ client_wait_until_can_do_something(struc > */ > > timeout_secs = INT_MAX; /* we use INT_MAX to mean no timeout */ >- if (options.server_alive_interval > 0) { >- timeout_secs = options.server_alive_interval; >- server_alive_time = now + options.server_alive_interval; >- } >+ if (options.server_alive_interval > 0) >+ timeout_secs = MAXIMUM(server_alive_time - now, 0); > if (options.rekey_interval > 0 && !rekeying) > timeout_secs = MINIMUM(timeout_secs, > ssh_packet_get_rekey_timeout(ssh)); >@@ -558,13 +557,18 @@ client_wait_until_can_do_something(struc > "select: %s\r\n", strerror(errno))) != 0) > fatal("%s: buffer error: %s", __func__, ssh_err(r)); > quit_pending = 1; >- } else if (ret == 0) { >+ } else { > /* >- * Timeout. Could have been either keepalive or rekeying. >- * Keepalive we check here, rekeying is checked in clientloop. >+ * See if ServerAlive check is needed. We can't rely on the >+ * select timing out since traffic on the client side such >+ * as port forwards can keep waking it up. > */ >- if (server_alive_time != 0 && server_alive_time <= monotime()) >+ if (options.server_alive_interval > 0 && >+ !FD_ISSET(connection_in, *readsetp) && >+ (now = monotime()) >= server_alive_time) { >+ server_alive_time = now + options.server_alive_interval; > server_alive_check(ssh); >+ } > } > > } >@@ -606,6 +610,9 @@ client_process_net_input(struct ssh *ssh > * the packet subsystem. > */ > if (FD_ISSET(connection_in, readset)) { >+ if (options.server_alive_interval > 0) >+ server_alive_time = monotime() + >+ options.server_alive_interval; > /* Read as much as possible. */ > len = read(connection_in, buf, sizeof(buf)); > if (len == 0) { >@@ -1305,6 +1312,9 @@ client_loop(struct ssh *ssh, int have_pt > channel_register_cleanup(ssh, session_ident, > client_channel_closed, 0); > } >+ >+ if (options.server_alive_interval > 0) >+ server_alive_time = monotime() + options.server_alive_interval; > > /* Main loop of the client for the interactive session mode. */ > while (!quit_pending) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2265
:
3417
|
3419
|
3420
|
3421