Subject: tcpip-forwarding port binding

From: Wei Dai <[email-masked]>
Date: Tue, 6 Feb 2001 00:35:58 -0800

I think we need a way for a client to request that the server find an
unused port to bind to, for the purpose of TCP/IP forwarding, and also a
way for the server to report back which port it actually bound. How about
adding some language such as the following to section 5.1 of the
Connection Protocol:

If any port is acceptable, 'want reply' should be TRUE and 'port number to
bind' should be 0. If such a request is successful, the server should
respond with the following message:

byte      SSH_MSG_REQUEST_SUCCESS
uint32    port number assigned

'Port number assigned' specifies the port number that the server assigned
to the listening socket.

Any comments? Is it too late to make this kind of proposal?

Also, why isn't there a way to include an error message in
the default SSH_MSG_REQUEST_FAILURE message? Perhaps we should change it
(in section 2) to: 

byte      SSH_MSG_REQUEST_FAILURE
string    error message (ISO-10646 UTF-8)
string    language tag (as defined in [RFC-1766])

With the protocol the way it is now, there is no way for a user to know
why a TCP/IP forwarding request failed. He can't tell if he should try a
different port, a different address, or give up.