NetworkBlockDevice / nbd

Network Block Device
GNU General Public License v2.0
459 stars 119 forks source link

Unspecified behavior: NBD_OPT_EXPORT_NAME in fixed newstyle negotiation? #109

Closed ralt closed 4 years ago

ralt commented 4 years ago

Hi,

Sorry if I missed this part, but it seems that this is an unspecified behavior there, what is the server supposed to do if fixed-newstyle negotiation was negotiated, but the client offers the NBD_OPT_EXPORT_NAME option?

Is the server supposed to:

yoe commented 4 years ago

Hi,

On Sun, Aug 16, 2020 at 02:35:47AM -0700, Florian Margaine wrote:

Sorry if I missed this part, but it seems that this is an unspecified behavior there, what is the server supposed to do if fixed-newstyle negotiation was negotiated, but the client offers the NBD_OPT_EXPORT_NAME option?

It should just handle the connection.

NBD_OPT_EXPORT_NAME is the only supported option if fixed newstyle was not negotiated, but NBD_OPT_GO is way (way) newer than fixed newstyle. There are a lot of implementations out there that support fixed newstyle but that do not support NBD_OPT_GO yet.

In other words, if you support NBD_OPT_GO that's great, but it's not a requirement of fixed newstyle.

-- To the thief who stole my anti-depressants: I hope you're happy

-- seen somewhere on the Internet on a photo of a billboard

ralt commented 4 years ago

Thank you! Should the specification be updated to mention that newstyle (and not fixed newstyle) should be used for this option, even though the handshake is in fixed newstyle mode?

That said, you're raising a question for me: what is supported in nbd-client at the moment? I saw that structured replies (and so meta context) and NBD_OPT_GO aren't supported, what about NBD_OPT_INFO? What about the transmission flags? I'm currently implementing a custom server but would like to avoid implementing features that aren't supported. Is there a resource that I missed explaining this?

Cheers

PS: feel free to close this issue, given that the original question is answered.

yoe commented 4 years ago

Thank you! Should the specification be updated to mention that newstyle (and not fixed newstyle) should be used for this option, even though the handshake is in fixed newstyle mode?

Maybe? Patches welcome ;-)

That said, you're raising a question for me: what is supported in nbd-client at the moment? I saw that structured replies (and so meta context) and NBD_OPT_GO aren't supported,

NBD_OPT_GO is supported by nbd-server and used by nbd-client since at least 3.16.2 (but possibly longer than that).

You're right that structured replies are not supported, but this is because the kernel doesn't support them. However, structured replies and meta contexts are supported by the QEMU nbd implementation (both client and server).

what about NBD_OPT_INFO? What about the transmission flags? I'm currently implementing a custom server but would like to avoid implementing features that aren't supported. Is there a resource that I missed explaining this?

The "proto.md" document contains a "Baseline" and "Maximum interoperability" section at the very end explaining what you should implement if you desire compatibility with current implementations, and/or features that are expected.