Protocol ambiguity: want_reply vs CHANNEL_CLOSE

Simon Tatham <[email protected]>
Newsgroups gmane.ietf.secsh
Message-ID <[email protected]>
I think this list still reaches a reasonable number of SSH
implementors. I'd like to see if we can get a consensus on the
following problem.

Suppose two SSH implementations have a channel open between them.
Party A sends an SSH_MSG_CHANNEL_REQUEST of some kind, with the
want_reply flag set. Party B, meanwhile, independently decides to
initiate shutdown of the channel, and sends SSH_MSG_CHANNEL_CLOSE.
These two messages cross in the network, so that B receives the
channel request after it's already sent a close message for that
channel.

Should B send a reply?

I think you can argue it either way from the spec. RFC 4254 section
5.4 says that channel requests must be replied to if they have
want_reply set, and doesn't make any exception for channels in the
middle of closing, which supports the answer 'yes'. Then again,
section 5.3 says that after a party has both sent and received CLOSE,
the channel is defunct and its number can be reused, which supports
the answer 'no' (because, if B does reply, what if that reply crosses
with A's responding close message? Then B's reply would arrive at A
after A has both sent and received CLOSE).

So I think this is a genuine ambiguity in the RFC. Moreover, I've
observed SSH servers disagreeing on whether to reply, which makes it
fiddly to implement a policy at the request-sending end that handles
both kinds of server.

Would anyone like to state an opinion on what ought to happen about
this? I can think of two reasonably sensible options:

 (a) Issue a clarifying RFC that resolves the ambiguity by designating
     one or other behaviour as correct, and consider implementations
     doing the other thing to have a bug requiring a fix.

 (b) Issue an RFC specifying a protocol extension that allows an
     implementation to advertise which interpretation it will follow
     (since either behaviour is easy to cope with if you know which
     one you're talking to). I suppose we'd still have to decide on
     the default answer in the absence of such an advertisement.

Cheers,
Simon
-- 
Simon Tatham         "The distinction between the enlightened and the
<[email protected]>    terminally confused is only apparent to the latter."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.