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

Re: [Nbd] Problems in negotiating modern handshake



On Tue, May 17, 2011 at 08:48:12AM +0100, Alex Bligh wrote:
> Wouter,
> >>                client->net = net;
> >>                client->modern = TRUE;
> >> -                free(name);
> >> -                return client;
> >> +                break;
> > 
> > You've removed a return statement here. Are you sure that's not the
> > problem?
> 
> Any NULL return causes the SEGV.

Yes, but that would need to be handled in serveconnection() anyway (and
it is now, in git HEAD).

> I don't think you want to return here, or if you have found the
> server, you don't send the flags and the 124 bytes of zeroes (the bit
> marked "common"), etc.

Actually, you do. negotiate() is called once more, in mainloop(),
unconditionally. At that point, negotiate() skips the first block of
'common' code (due to client and client->modern being set), and the
first block of 'modern' code (due to client being set), but continues at
the second block of 'common' code. By not returning at that position,
the 'client' variable in serveloop never gets anything assigned in the
case of the modern socket.

This is perhaps a bit too confusing.

-- 
The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a



Reply to: