Re: version negotiation
Greg Troxel <[email protected]> Wed, 30 Jun 2021 12:00:51 -0400
| Newsgroups | gmane.network.unison.devel |
|---|---|
| Message-ID | <[email protected]> |
Tõivo Leedjärv <[email protected]> writes: > On Wed, Jun 30, 2021 at 1:38 AM Greg Troxel <[email protected]> wrote: >> >> My understanding is that right now, unison simply assumes that the >> remote side speaks the same protocol, and things deteriorate from there >> if it is not true (because of a 2.48/2.51 mismatch). > > Pretty much, but there is a hello string sent by the server which the > client verifies. If there is a 2.48/2.51 mismatch then the connection > is terminated immediately. There is no OCaml version check (just that > it is >= 4.02 something). That may work or fail in mysterious ways. ok. >> #507, as I understand it, causes the server to start off with proto >> version negotation instead, and the server can be configured not to, so >> that old clients can connect. > > Correct. Or, in case of ssh, with the latest commit the client can > actually announce that it supports proto version negotiation and if > not, the server will treat it as an old client. So, the server will default to old unless - invoked over ssh and arg from client that it does version negotitation is passed, or - socket server and same arg is given, which flips the socket server from "compatible with 2.51.x" to "compatible with >= 2.51.5" >> So, I am wondering if instead, we say: >> >> 2.51.5 will simply announce as 2.51.5 > > Right now, only server announces itself. Clients don't. And, right > now, all existing clients expect to receive a _fixed_ hello string > (which is "Unison 2.51 with OCaml >= 4.01.2\n"). fixed but with arbitrary numbers presuambly > Right now, the server announces itself and then immediately starts the > OCaml-dependent protocol. This makes it very difficult for client to > say anything. This, combined with the fixed hello string above, makes > adding any auto-detection rather difficult. That's why the > auto-detection trick over ssh uses command line arguments. I am not quite willing to give up because if we can succeed here it will make a lot of people's lives easier. OTOH it's only socket users we are worrying about, and I think that's unsound :-) So how about: server sends vesrion string server sends first message of existing protocol if client wants to do old (because client is old, or because client sees a version < 2.51.5), client speaks old protocol as it used to if client is new and sees 2.51.5 or higher, then client knows server can do the negotiation protocol. Instead of sending a well-formed old-protocol message, it sends "BEGIN-VERSION-NEGOTIATION\n" or something, perhaps shorter to be shorter than any legit old-proto message. The server can read the bytes into a buffer, and check for 1) valid old-protocol frame and 2) matching the magic token. If magic token, then server sends magic token and starts the negotiation protocol. If valid old-proto frame, it's processed. If client sent BEGIN-VERSION-NEGOTIATION, client discards bytes until it finds the server magic token. _______________________________________________ Unison-hackers mailing list [email protected] https://LISTS.SEAS.UPENN.EDU/mailman/listinfo/unison-hackers
signature.asc
(application/pgp-signature, 194 B)
-----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQS7wyAjWilQwVHG9Vsf2nroCY7WDgUCYNyVMwAKCRAf2nroCY7W DruHAJ4xAiVZEiclllbui4yfXImLGGrcIgCeK0nNReUv7M1bzBv1Wwg1azxmJhQ= =ikB7 -----END PGP SIGNATURE-----