[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [RFC] NBD protocol improvement



Le jeudi 18 septembre 2008 à 10:35 +0200, Wouter Verhelst a écrit :
> On Tue, Sep 16, 2008 at 04:56:25PM +0200, Laurent Vivier wrote:
> > Le vendredi 12 septembre 2008 à 08:03 +0200, Wouter Verhelst a écrit :
> > > On Thu, Sep 11, 2008 at 09:17:54PM +0200, Laurent Vivier wrote:
> > > > Le jeudi 11 septembre 2008 à 12:19 -0400, Paul Clements a écrit :
> > > > > Laurent Vivier wrote:
[...]
> > > that there are alternate exports. If the client replies with a flag of
> > > its own, signalling that it knows about those, then it should send a
> > > filename, as below.
> > 
> > Is the protocol already includes this behavior (client returns known
> > flags) ? if yes, where ? I didn't find it. If not, I don't see how to
> > add it without breaking all.
> 
> Ah, you're right. I thought there was one, but I'm mistaken.
> 
> Hmm. The first packet ever sent by an nbd-client after successfully
> negotiating a connection is an nbd_request struct; this starts with a
> magic number. As such, it should be possible to distinguish between this
> magic number and a flags field that gets sent first, provided we make
> sure they never look the same (e.g., by having the first bit be ~(the
> first bit of the magic number).
> 
> That's going to be quite messy, though; you'd need to special-case the
> first (and only the first) packet. Hmm. Perhaps if you make the 'flags'
> field the same size of an nbd_request; then you could read in the entire
> packet, check whether it looks like a request, and then either parse the
> flags or fire of the request handler, depending on whether it does.
> 
> At some point I should probably change the protocol incompatibly :-)

It's why I used a size set to 0 in the negotiation packet to get the
information from the server to the client. Because 0 is not a valid
value for a size, the client knows it has to send a name and the server
knows it has to wait a name.

Regards,
Laurent
-- 
----------------- Laurent.Vivier@...154...  ------------------
  "La perfection est atteinte non quand il ne reste rien à
ajouter mais quand il ne reste rien à enlever." Saint Exupéry




Reply to: