FS#41823 - [nbd] Error: Server closed connection

Attached to Project: Community Packages
Opened by Yenal (yenal) - Thursday, 04 September 2014, 15:18 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Wednesday, 08 October 2014, 01:49 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

While Arch Linux documentation on nbd is scanty and other docs are mostly out-dated, it was hard for a beginner like me to find out why I couldnt connect to a nbd-server neither with oldstyle nor with newstyle. The pre-packaged config leads to errors if only the export-part is being edited, because nbd running as "nbd-user" seems not working correctly.

nbd-client will report:
Negotiation: ..Error: Server closed connection
Exiting.

nbd-server will report:
Spawned a child process
virststyle ipliteral
Child exited with 1

"ps aux | grep nbd" will report that /usr/bin/nbd-server is running as "nbd" not "root"
(to start nbd-server as root I was trying it manually from command-line similar how it is written as an example in man pages > but this isnt recommended, didnt work for me and gave also errors not starting the nbd-server)

Steps to reproduce:
@SERVER:
------
/etc/nbd-server/config
[generic]
user = nbd
group = nbd
# oldstyle = true
[testfile]
exportname = /path/to/testfile
# port = 12345
------
# systemctl start nbd

@CLIENT:
# modprobe nbd
# nbd-client <Server-IP> /dev/nbd0 -name testfile

same if using oldstyle-config without #'s and: nbd-client <Server-IP> 12345 /dev/nbd0

old- and newstyle is working if nbd-server is started without user and group in config > running as root
..maybe this would work with non-root if the user and group permissions for nbd are tweaked?

Additional info:
pkg-version: nbd 3.8-1
configfile: /etc/nbd-server/config (probably taken from https://github.com/yoe/nbd)
tested on: Arch Linux x86_64
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Wednesday, 08 October 2014, 01:49 GMT
Reason for closing:  Upstream
Comment by Yenal (yenal) - Thursday, 04 September 2014, 15:32 GMT
ps: using authfile in config also isnt working and leads to "Negotiation: ..Error: Server closed connection"

see EXAMPLES: man 5 nbd-server
e.g.:
----
/etc/nbd-server/config:
[generic]
authfile = /etc/nbd-server/allow
[testfile]
exportname = /path/to/testfile
----
/etc/nbd-server/allow:
127.0.0.1
192.168.0.5
192.168.0.0/24
----
will not work, but commenting #authfile in config will
Comment by CDr (cdr_magicti) - Sunday, 14 September 2014, 08:24 GMT
The IP address match algorithm is buggy. Comparison is done with the first 4 bytes of the sa_data of the sockaddr struct of the socket but these bytes in sutrct sockaddr_in are the port (2 bytes) and 2 bytes of the IP address.
Upstream was corrected today, next version should provide working authfiles.

Loading...