Commit 8cec832e authored by Konstantin Artyushkin's avatar Konstantin Artyushkin

**packet.c:**

- Replace ppol() by nx_proxy_ppoll() - Transfer nx_set_socket_options() to ssh_packet_set_interactive() **clientloop.c:** - Replace ppol() by nx_proxy_ppoll() - Transfer bypass server_alive_check() при nx_switch_internal == 1 - Transfer nx_close_proxy_connection() on signal and completion
parent 380d8e79
...@@ -114,6 +114,10 @@ ...@@ -114,6 +114,10 @@
#include "msg.h" #include "msg.h"
#include "ssherr.h" #include "ssherr.h"
#include "hostfile.h" #include "hostfile.h"
#include "proxy.h"
extern int NxModeEnabled;
extern int nx_switch_internal;
/* Permitted RSA signature algorithms for UpdateHostkeys proofs */ /* Permitted RSA signature algorithms for UpdateHostkeys proofs */
#define HOSTKEY_PROOF_RSA_ALGS "rsa-sha2-512,rsa-sha2-256" #define HOSTKEY_PROOF_RSA_ALGS "rsa-sha2-512,rsa-sha2-256"
...@@ -729,7 +733,7 @@ client_wait_until_can_do_something(struct ssh *ssh, struct pollfd **pfdp, ...@@ -729,7 +733,7 @@ client_wait_until_can_do_something(struct ssh *ssh, struct pollfd **pfdp,
ssh_packet_get_rekey_timeout(ssh)); ssh_packet_get_rekey_timeout(ssh));
} }
ret = ppoll(*pfdp, *npfd_activep, ptimeout_get_tsp(&timeout), sigsetp); ret = nx_proxy_ppoll(*pfdp, *npfd_activep, ptimeout_get_tsp(&timeout), sigsetp);
if (ret == -1) { if (ret == -1) {
/* /*
...@@ -750,7 +754,7 @@ client_wait_until_can_do_something(struct ssh *ssh, struct pollfd **pfdp, ...@@ -750,7 +754,7 @@ client_wait_until_can_do_something(struct ssh *ssh, struct pollfd **pfdp,
*conn_out_readyp = (*pfdp)[1].revents != 0; *conn_out_readyp = (*pfdp)[1].revents != 0;
if (options.server_alive_interval > 0 && !*conn_in_readyp && if (options.server_alive_interval > 0 && !*conn_in_readyp &&
monotime() >= server_alive_time) { monotime() >= server_alive_time && !nx_switch_internal) {
/* /*
* ServerAlive check is needed. We can't rely on the poll * ServerAlive check is needed. We can't rely on the poll
* timing out since traffic on the client side such as port * timing out since traffic on the client side such as port
...@@ -1661,6 +1665,7 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg, ...@@ -1661,6 +1665,7 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg,
if (received_signal) { if (received_signal) {
verbose("Killed by signal %d.", (int) received_signal); verbose("Killed by signal %d.", (int) received_signal);
nx_close_proxy_connection();
cleanup_exit(255); cleanup_exit(255);
} }
...@@ -2872,6 +2877,7 @@ cleanup_exit(int i) ...@@ -2872,6 +2877,7 @@ cleanup_exit(int i)
leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE);
if (options.control_path != NULL && muxserver_sock != -1) if (options.control_path != NULL && muxserver_sock != -1)
unlink(options.control_path); unlink(options.control_path);
nx_close_proxy_connection();
ssh_kill_proxy_command(); ssh_kill_proxy_command();
_exit(i); _exit(i);
} }
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
#include "packet.h" #include "packet.h"
#include "ssherr.h" #include "ssherr.h"
#include "sshbuf.h" #include "sshbuf.h"
#include "proxy.h"
#ifdef PACKET_DEBUG #ifdef PACKET_DEBUG
#define DBG(x) x #define DBG(x) x
...@@ -1376,7 +1377,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p) ...@@ -1376,7 +1377,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
ms_to_timespec(&timespec, ms_remain); ms_to_timespec(&timespec, ms_remain);
monotime_tv(&start); monotime_tv(&start);
} }
if ((r = ppoll(&pfd, 1, timespecp, NULL)) >= 0) if ((r = nx_proxy_ppoll(&pfd, 1, timespecp, NULL)) >= 0)
break; break;
if (errno != EAGAIN && errno != EINTR && if (errno != EAGAIN && errno != EINTR &&
errno != EWOULDBLOCK) { errno != EWOULDBLOCK) {
...@@ -2055,7 +2056,7 @@ ssh_packet_write_wait(struct ssh *ssh) ...@@ -2055,7 +2056,7 @@ ssh_packet_write_wait(struct ssh *ssh)
ms_to_timespec(&timespec, ms_remain); ms_to_timespec(&timespec, ms_remain);
monotime_tv(&start); monotime_tv(&start);
} }
if ((ret = ppoll(&pfd, 1, timespecp, NULL)) >= 0) if ((ret = nx_proxy_ppoll(&pfd, 1, timespecp, NULL)) >= 0)
break; break;
if (errno != EAGAIN && errno != EINTR && if (errno != EAGAIN && errno != EINTR &&
errno != EWOULDBLOCK) errno != EWOULDBLOCK)
...@@ -2133,6 +2134,7 @@ ssh_packet_set_interactive(struct ssh *ssh, int interactive, int qos_interactive ...@@ -2133,6 +2134,7 @@ ssh_packet_set_interactive(struct ssh *ssh, int interactive, int qos_interactive
if (!ssh_packet_connection_is_on_socket(ssh)) if (!ssh_packet_connection_is_on_socket(ssh))
return; return;
set_nodelay(state->connection_in); set_nodelay(state->connection_in);
nx_set_socket_options(state->connection_in, 0);
ssh_packet_set_tos(ssh, interactive ? qos_interactive : qos_bulk); ssh_packet_set_tos(ssh, interactive ? qos_interactive : qos_bulk);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment