This is a documentation only patch to the new handshake protocol, but
changes the protocol in completely back compatible manner.

Under the current handshake protocol, it is impliedly necessary for the
server to understand every option presented by the client, as there is
no way for the server to skip options it does not understand (as the
length field is not always part of the option).

My proposal is to include the length field as a 32 bit unsigned length
in the same way that it currently forms the first 4 octets of the
NBD_OPT_EXPORT_NAME. So the length field has technically moved out
of the option data and into the option header (obviously there is
no code change required). This will allow servers to skip options
presented by clients that the server does not understand.

-- 
Alex Bligh

Signed-off-by: Alex Bligh <[email protected]>

diff --git a/doc/proto.txt b/doc/proto.txt
index aa247af..fe5e819 100644
--- a/doc/proto.txt
+++ b/doc/proto.txt
@@ -107,14 +107,17 @@ The generic format of setting an option is as follows:
 C: 0x49484156454F5054 (note same new-style handshake's magic number)
 C: 32 bits denoting the chosen option (NBD_OPT_EXPORT_NAME is the only
    possible value currently)
+C: unsigned 32 bit length of option data
 C: (any data needed for the chosen option)
 S: (any response as needed and defined by the chosen option; currently
    this does not happen).

+The presence of the option length in every option allows the server
+to skip any options presented by the client that it does not
+understand.
+
 The data needed for the NBD_OPT_EXPORT_NAME option is:

-C: unsigned 32 bit length (denotes the length of the name used, not
-   including any terminating NUL byte)
 C: name of the export (character string of length as specified,
    not terminated by any NUL bytes or similar)



------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Nbd-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nbd-general

Reply via email to