Your message dated Thu, 28 Mar 2013 21:32:52 +0000
with message-id <[email protected]>
and subject line Bug#699374: fixed in nbd 1:3.2-4
has caused the Debian Bug report #699374,
regarding nbd-server reports 'negotiation failed' after 'nbd-client -l', and 
fails on next connection
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
699374: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699374
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: nbd-server
Version: 1:3.2-2
Severity: important
Tags: patch

Dear Maintainer,

When a client requests an export list from the server,
the latter issues the message 'Error: negotiation failed'.
This is rather confusing, as the only 'problem' is (AFAICT)
that the negotiation phase did everything.

On a subsequent attempt to connect a block device, the server
fails altogether:
Client output:
        --------------------
        nasc0:root ~ 216 # /tmp/nbd-client.master -l nass0
        Negotiation: ..
        nasc0-nbd0
        nasc0:root ~ 217 # /tmp/nbd-client.master nass0 -N nasc0-nbd0 /dev/nbd0
        Negotiation: ..size = 856941734MBError: Exported device is too big for 
me. Get 64-bit machine :-(

        Exiting.
        --------------------
Server output:
        --------------------
        nass0:root ~ 135 # /tmp/nbd-server.master -d -C /etc/nbd-server/config
        Error: negotiation failed
        Exiting.
        Error: Read failed: Connection reset by peer
        Exiting.
        --------------------
From a tcpdump, it can be observed that the syslog messages end up
on the client socket, which makes the client choke, naturally. 

I tested this for the latest git version, and the same problem
occurs. I have traced the problem to the fact that negotiate(),
in two locations, closes the socket, and returns NULL , after which
serveloop also closes it, actually closing the syslog socket instead.
The next accept() returns that same filedescriptor, which syslog()
still thinks it owns.

I'm attaching a patch against git revision
902c07e75f12459c55d79f450a0fb9c1e7da02e5, which improves the error
reporting, and fixes the failure for the connect after the LIST.

Note: I added the message 'Session terminated by client', because
the 'ABORT' might also be intended to be used as an irregular
end-of-session (in the future?), besides indicating a regular
end-of-session after a LIST.

Kind regards,

Rogier.

--------------------------------------------
diff --git a/nbd-server.c b/nbd-server.c
index 69ee2a4..e905281 100644
--- a/nbd-server.c
+++ b/nbd-server.c
@@ -1532,13 +1532,18 @@ static CLIENT* handle_export_name(uint32_t opt, int 
net, GArray* servers, uint32
        char* name;
        int i;
 
-       if (read(net, &namelen, sizeof(namelen)) < 0)
+       if (read(net, &namelen, sizeof(namelen)) < 0) {
                err("Negotiation failed/7: %m");
+               return NULL;
+       }
        namelen = ntohl(namelen);
        name = malloc(namelen+1);
        name[namelen]=0;
-       if (read(net, name, namelen) < 0)
+       if (read(net, name, namelen) < 0) {
                err("Negotiation failed/8: %m");
+               free(name);
+               return NULL;
+       }
        for(i=0; i<servers->len; i++) {
                SERVER* serve = &(g_array_index(servers, SERVER, i));
                if(!strcmp(serve->servename, name)) {
@@ -1553,6 +1558,7 @@ static CLIENT* handle_export_name(uint32_t opt, int net, 
GArray* servers, uint32
                        return client;
                }
        }
+       err("Negotiation failed/8a: Requested export not found");
        free(name);
        return NULL;
 }
@@ -1639,7 +1645,7 @@ CLIENT* negotiate(int net, CLIENT *client, GArray* 
servers, int phase) {
                                err_nonfatal("Negotiation failed/5: %m");
                        magic = ntohll(magic);
                        if(magic != opts_magic) {
-                               close(net);
+                               err_nonfatal("Negotiation failed/5a: magic 
mismatch");
                                return NULL;
                        }
                        if (read(net, &opt, sizeof(opt)) < 0)
@@ -1664,7 +1670,7 @@ CLIENT* negotiate(int net, CLIENT *client, GArray* 
servers, int phase) {
                        }
                } while((opt != NBD_OPT_EXPORT_NAME) && (opt != NBD_OPT_ABORT));
                if(opt == NBD_OPT_ABORT) {
-                       close(net);
+                       err_nonfatal("Session terminated by client");
                        return NULL;
                }
        }
@@ -2305,7 +2311,6 @@ void serveloop(GArray* servers) {
                                }
                                client = negotiate(net, NULL, servers, NEG_INIT 
| NEG_MODERN);
                                if(!client) {
-                                       err_nonfatal("negotiation failed");
                                        close(net);
                                        continue;
                                }
--------------------------------------------

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages nbd-server depends on:
ii  adduser                3.113+nmu3
ii  debconf [debconf-2.0]  1.5.46
ii  libc6                  2.13-37
ii  libglib2.0-0           2.33.12+really2.32.4-3
ii  ucf                    3.0025+nmu3

nbd-server recommends no packages.

nbd-server suggests no packages.

-- debconf information excluded

--- End Message ---
--- Begin Message ---
Source: nbd
Source-Version: 1:3.2-4

We believe that the bug you reported is fixed in the latest version of
nbd, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Wouter Verhelst <[email protected]> (supplier of updated nbd package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Thu, 28 Mar 2013 21:58:35 +0100
Source: nbd
Binary: nbd-server nbd-client nbd-client-udeb
Architecture: source amd64
Version: 1:3.2-4
Distribution: unstable
Urgency: low
Maintainer: Wouter Verhelst <[email protected]>
Changed-By: Wouter Verhelst <[email protected]>
Description: 
 nbd-client - Network Block Device protocol - client
 nbd-client-udeb - Network Block Device protocol - client for Debian Installer 
(udeb)
 nbd-server - Network Block Device protocol - server
Closes: 699374
Changes: 
 nbd (1:3.2-4) unstable; urgency=low
 .
   * Unbreak 'nbd-client -l' behaviour; patch by Rogier
     <[email protected]>. Closes: #699374. Why oh why did I forget that
     with the previous upload? Oh well.
Checksums-Sha1: 
 cb856c41b919b7cc1199a7555f9cce6e96c458fe 1892 nbd_3.2-4.dsc
 5414d0d06cd38ed580c4733db7c278171a043f8a 96291 nbd_3.2-4.diff.gz
 cc92bfe2a8214472ecf3a10954fce6fa20edcbd7 74170 nbd-server_3.2-4_amd64.deb
 58e29765a592edad0acfa168f3fc304474ea6161 63270 nbd-client_3.2-4_amd64.deb
 7e85f0f2b4790eb0bfcaf977cd6e234bf2886582 8102 nbd-client-udeb_3.2-4_amd64.udeb
Checksums-Sha256: 
 e5faa8e74f62e001b09b72f2834c5f6f53e431163b3da4ba5d656b6c1ad65bc2 1892 
nbd_3.2-4.dsc
 ceb270c46a8b795f867df2b3530eaea9d0ebcbdf25dbe53fc53199b225d0f9c8 96291 
nbd_3.2-4.diff.gz
 6a894ac8dcf601dc571a1e38bd0dbe10f1134b1b58473e0a0bdb5c34e9cd19e6 74170 
nbd-server_3.2-4_amd64.deb
 a93b283d311fee6e3630bd44c22f776df8514a1081756c9bea47a9b0f1112e26 63270 
nbd-client_3.2-4_amd64.deb
 53bcb1bbbcfdd6850aa5e8b119fe801fc4459fa1442a1653f1323adc3fc08e7a 8102 
nbd-client-udeb_3.2-4_amd64.udeb
Files: 
 4067bb28c811f39a88c180df28f82166 1892 admin optional nbd_3.2-4.dsc
 eb11eb556f26476db764f2eb02d3d131 96291 admin optional nbd_3.2-4.diff.gz
 13be4656925d2cb3b703759fa3816b03 74170 admin optional 
nbd-server_3.2-4_amd64.deb
 3ff2ec286c521b49fb9750c9fad028fd 63270 admin optional 
nbd-client_3.2-4_amd64.deb
 83f2c7fc1acc818440c0a99c19c4ca6f 8102 debian-installer optional 
nbd-client-udeb_3.2-4_amd64.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJRVLTyAAoJEMKUD5Ub3wqdMjEQAOpA/W3wlMWCQkbEoWj8JKPf
WowZqt93SEd5OPtUv3OSoC3D1e08hO7uz8oSiPCCfbpRk3VGqyXWeZ58tP6GTGUb
mun2kwXW1siHpEeUK9NpYB5nx0QweKIa8sHFmqBtSGM1+UD7kc51rqV9hXlmdVlW
pcyjMoIauh5XzRvkym2AP01hFKKteCKNi5V41ZzsDBwR18mCqmn8EBkZWDESisBo
DJyoww4JWCoBlm8YmsNp7eHI+PQ9zO9a41Je00N9m2IOPM6M+IJos40NiBmY5uTm
RinynWIgXfF6w/ZzIK9SqVIzcAsIxod4V9vLmlMbClFN6cHgtMs+LQcrUlmEIxXZ
dfsjTFhXk0lofB1XBWZWWZD+m8ulYYn9bj7Fp1rqTgtd3YS6Nv8i3HzHvpMnE9y4
73IHHaqHFr2miCBOJPI3xwcNvmzyRoMmeySj3UliC7xRBLJe8WD/kIQQ4Jlt3gHL
7wSIz3rJAwTjluKO/6zGnbagEK75g5R2s9agyhcUyreheaC/AIDzBK8PzQS0FJPc
bzY/AAVkiOUzZw8mMkeqar0minweM5U63qEtFnT9cHOl7ugYCRsi7THkTZC0q3eT
QKweVNfOsz3Vecma1EN0d4qbP7HJZLCGmPoPxRvOnaLtXWfNzX8BIoOIk6vLzl02
TDcAKBwd+fIbLIpuBXq0
=jB+x
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to