NetworkBlockDevice / nbd

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

-g option is missing #101

Closed RenaKunisaki closed 5 years ago

RenaKunisaki commented 5 years ago
# nbd-client -N export1 192.168.1.246 /dev/nbd0
Negotiation: ..Error: Read failed: Connection reset by peer
Error: E: server does not support NBD_OPT_GO and dropped connection after sending NBD_OPT_EXPORT_NAME. Try -g.
Exiting.

# nbd-client -g -N export1 192.168.1.246 /dev/nbd0
nbd-client: unrecognized option '-g'
E: option eaten by 42 mice

# nbd-client --help
nbd-client version 3.19
Usage: nbd-client -name|-N name host [port] nbd_device
    [-block-size|-b block size] [-timeout|-t timeout] [-swap|-s] [-sdp|-S]
    [-persist|-p] [-nofork|-n] [-systemd-mark|-m] [-nonetlink|-L]
Or   : nbd-client -u (with same arguments as above)
Or   : nbd-client nbdX
Or   : nbd-client -d nbd_device
Or   : nbd-client -c nbd_device
Or   : nbd-client -h|--help
Or   : nbd-client -l|--list host
Or   : nbd-client -V|--version
All commands that connect to a host also take:
    [-F|-certfile certfile] [-K|-keyfile keyfile]
    [-A|-cacertfile cacertfile] [-H|-tlshostname hostname] [-x|-enable-tls]
Default value for blocksize is 512
Allowed values for blocksize are 512,1024,2048,4096
Note, that kernel 2.4.2 and older ones do not work correctly with
blocksizes other than 1024 without patches
Default value for port is 10809. Note that port must always be numeric
Bug reports and general discussion should go to nbd@other.debian.org

The manual does mention -g option, but it doesn't seem to actually exist?

eddyg commented 5 years ago

This occurs when HAVE_NETLINK is enabled. Notice that g is missing from the first *short_opts declaration but is present in the second:

https://github.com/NetworkBlockDevice/nbd/blob/cdb0bc57f3faefd7a5562d57ad57cd990781c415/nbd-client.c#L935-L939

I think using the long option -no-optgo can be used as a work-around.

yoe commented 5 years ago

@eddyg Thanks! I had wanted to look into this in somewhat more detail, but other things kept popping up, so it never happened.

This seems fairly straightforward, so just fixed it.