Skip to content

Move sending SSH_MSG_KEXINIT to Session.cs from key exchange procedure #839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Renci.SshNet/Security/KeyExchange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public virtual void Start(Session session, KeyExchangeInitMessage message)
{
Session = session;

SendMessage(session.ClientInitMessage);

// Determine encryption algorithm
var clientEncryptionAlgorithmName = (from b in session.ConnectionInfo.Encryptions.Keys
from a in message.EncryptionAlgorithmsClientToServer
Expand Down
4 changes: 4 additions & 0 deletions src/Renci.SshNet/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ public void Connect()
// Start incoming request listener
ThreadAbstraction.ExecuteThread(() => MessageListener());

// Send SSH_MSG_KEXINIT. There is no need to await SSH_MSG_KEXINIT from the server
// Cisco switches can await SSH_MSG_KEXINIT from the client for no reason before sending it
SendMessage(ClientInitMessage);

// Wait for key exchange to be completed
WaitOnHandle(_keyExchangeCompletedWaitHandle);

Expand Down