[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: libssh 0.8.4 with Cisco router
[Thread Prev] | [Thread Next]
- Subject: RE: libssh 0.8.4 with Cisco router
- From: Meng Hourk Tan <mtan@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 24 Oct 2018 08:52:12 +0000
- To: Andreas Schneider <asn@xxxxxxxxxxxxxx>, "libssh@xxxxxxxxxx" <libssh@xxxxxxxxxx>
- Cc: "jijo7thomas@xxxxxxxxx" <jijo7thomas@xxxxxxxxx>
Hi Andreas, Here's the patch compliant to your coding style. And I'm glad it helped you Jijo. Regards, Meng ________________________________ De : Andreas Schneider <asn@xxxxxxxxxxxxxx> Envoyé : mercredi 24 octobre 2018 08:51 À : libssh@xxxxxxxxxx Cc : Meng Hourk Tan; jijo7thomas@xxxxxxxxx Objet : Re: libssh 0.8.4 with Cisco router On Tuesday, 23 October 2018 18:09:25 CEST Meng Hourk Tan wrote: > Hello, Hello Meng, > I had the same issue with some Cisco router: > > Some Cisco IOS do not send kex if they send the banner last (libssh as a > client sent it first). > > In this situation, both libssh client and Cisco IOS server hang. > > Libssh client should send kex init as soon as banners are exchanged. Thanks you very much for your patch. Could you please change the patch to follow our coding style: + if (ssh_set_client_kex(session) < 0) { + goto error; + } should for example use a helper variable for easier debugging: rc = ssh_set_client_kex(session); if (rc != SSH_OK) { goto error; } Thanks, Andreas -- Andreas Schneider asn@xxxxxxxxxxxxxx GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
From c12bb4c2c1d3e2a7ac03ab7400c6be023f21df12 Mon Sep 17 00:00:00 2001 From: Meng Tan <mtan@xxxxxxxxxx> Date: Wed, 24 Oct 2018 10:43:17 +0200 Subject: [PATCH] client: Send KEX as soon as banners are exchanged Signed-off-by: Meng Tan <mtan@xxxxxxxxxx> --- src/client.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/client.c b/src/client.c index 859a86c6..d4b7ee57 100644 --- a/src/client.c +++ b/src/client.c @@ -411,6 +411,14 @@ static void ssh_client_connection_callback(ssh_session session) ssh_packet_set_default_callbacks(session); session->session_state = SSH_SESSION_STATE_INITIAL_KEX; + rc = ssh_set_client_kex(session); + if (rc != SSH_OK) { + goto error; + } + rc = ssh_send_kex(session, 0); + if (rc < 0) { + goto error; + } set_status(session, 0.5f); break; @@ -420,14 +428,19 @@ static void ssh_client_connection_callback(ssh_session session) case SSH_SESSION_STATE_KEXINIT_RECEIVED: set_status(session,0.6f); ssh_list_kex(&session->next_crypto->server_kex); - if (ssh_set_client_kex(session) < 0) { - goto error; + if (session->next_crypto->client_kex.methods[0] == NULL) { + /* in rekeying state if next_crypto client_kex is empty */ + rc = ssh_set_client_kex(session); + if (rc != SSH_OK) { + goto error; + } + rc = ssh_send_kex(session, 0); + if (rc < 0) { + goto error; + } } if (ssh_kex_select_methods(session) == SSH_ERROR) goto error; - if (ssh_send_kex(session, 0) < 0) { - goto error; - } set_status(session,0.8f); session->session_state=SSH_SESSION_STATE_DH; if (dh_handshake(session) == SSH_ERROR) { -- 2.11.0
libssh 0.8.4 with Cisco router | jijo thomas <jijo7thomas@xxxxxxxxx> |
RE: libssh 0.8.4 with Cisco router | Meng Hourk Tan <mtan@xxxxxxxxxx> |
Re: libssh 0.8.4 with Cisco router | Andreas Schneider <asn@xxxxxxxxxxxxxx> |