Hello community,

here is the log from the commit of package nbd for openSUSE:Factory checked in 
at 2015-04-21 10:51:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nbd (Old)
 and      /work/SRC/openSUSE:Factory/.nbd.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "nbd"

Changes:
--------
--- /work/SRC/openSUSE:Factory/nbd/nbd.changes  2015-03-18 13:04:41.000000000 
+0100
+++ /work/SRC/openSUSE:Factory/.nbd.new/nbd.changes     2015-04-21 
10:51:50.000000000 +0200
@@ -1,0 +2,7 @@
+Fri Apr 17 13:27:19 UTC 2015 - [email protected]
+
+- Update to 3.10
+  * There really is only one change since 3.9: drop of the 
+    "oldstyle" support from nbd-server and nbd-client.
+
+-------------------------------------------------------------------

Old:
----
  nbd-3.9.tar.xz

New:
----
  nbd-3.10.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ nbd.spec ++++++
--- /var/tmp/diff_new_pack.VbY2js/_old  2015-04-21 10:51:51.000000000 +0200
+++ /var/tmp/diff_new_pack.VbY2js/_new  2015-04-21 10:51:51.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           nbd
-Version:        3.9
+Version:        3.10
 Release:        0
 Summary:        Network Block Device Server and Client Utilities
 License:        GPL-2.0+

++++++ nbd-3.9.tar.xz -> nbd-3.10.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/configure new/nbd-3.10/configure
--- old/nbd-3.9/configure       2015-03-01 22:06:55.000000000 +0100
+++ new/nbd-3.10/configure      2015-03-11 18:32:38.000000000 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for nbd 3.9.
+# Generated by GNU Autoconf 2.69 for nbd 3.10.
 #
 # Report bugs to <[email protected]>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='nbd'
 PACKAGE_TARNAME='nbd'
-PACKAGE_VERSION='3.9'
-PACKAGE_STRING='nbd 3.9'
+PACKAGE_VERSION='3.10'
+PACKAGE_STRING='nbd 3.10'
 PACKAGE_BUGREPORT='[email protected]'
 PACKAGE_URL=''
 
@@ -1335,7 +1335,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures nbd 3.9 to adapt to many kinds of systems.
+\`configure' configures nbd 3.10 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1405,7 +1405,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of nbd 3.9:";;
+     short | recursive ) echo "Configuration of nbd 3.10:";;
    esac
   cat <<\_ACEOF
 
@@ -1529,7 +1529,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-nbd configure 3.9
+nbd configure 3.10
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2238,7 +2238,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by nbd $as_me 3.9, which was
+It was created by nbd $as_me 3.10, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3101,7 +3101,7 @@
 
 # Define the identity of the package.
  PACKAGE='nbd'
- VERSION='3.9'
+ VERSION='3.10'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14431,7 +14431,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by nbd $as_me 3.9, which was
+This file was extended by nbd $as_me 3.10, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -14497,7 +14497,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-nbd config.status 3.9
+nbd config.status 3.10
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/configure.ac new/nbd-3.10/configure.ac
--- old/nbd-3.9/configure.ac    2015-03-01 22:01:28.000000000 +0100
+++ new/nbd-3.10/configure.ac   2015-03-11 18:31:55.000000000 +0100
@@ -1,7 +1,7 @@
 dnl Configure script for NBD system
 dnl (c) 1998 Martin Mares <[email protected]>, (c) 2000 Pavel Machek <[email protected]>,
 dnl (c) 2003-2006 Wouter Verhelst <[email protected]>
-AC_INIT([nbd],[3.9],[[email protected]])
+AC_INIT([nbd],[3.10],[[email protected]])
 AM_INIT_AUTOMAKE(foreign dist-xz serial-tests)
 AM_MAINTAINER_MODE([enable])
 LT_INIT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/man/nbd-server.5.in.sgml 
new/nbd-3.10/man/nbd-server.5.in.sgml
--- old/nbd-3.9/man/nbd-server.5.in.sgml        2015-03-01 22:06:32.000000000 
+0100
+++ new/nbd-3.10/man/nbd-server.5.in.sgml       2015-03-17 01:55:44.000000000 
+0100
@@ -186,34 +186,16 @@
            Optional; boolean
          </para>
          <para>
-           If this option is set to true, nbd-server will export all
-           exports on a separate port with the old (pre-2.9.17)
-           handshake protocol. In that case, the 'port' option for
-           individual exports is mandatory.
+           In versions of nbd-server between 2.9.17 and 3.9.1, when this
+           option was set to true, nbd-server would export all exports
+           on a separate port with the old (pre-2.9.17) handshake
+           protocol. In that case, the 'port' option for individual
+           exports was mandatory.
          </para>
          <para>
-           If the option is set to false, the 'port' option for
-           individual exports is optional (and will be ignored if
-           specified). The server will only export devices on the
-           standard port.
-         </para>
-         <para>
-           For upgrades from pre-2.9.17 versions of nbd, it may be
-           appropriate to enable the oldstyle parameter until all
-           clients have been converted to using name-based exports.
-         </para>
-         <para>
-           Note that exports specified on the command line will
-           always use the old handshake protocol and will not allow
-           name-based exports.
-         </para>
-         <para>
-           Also note that even if this parameter is set to true, all
-           exports will also be made available using the new handshake
-           protocol; it is not possible to switch that off. The reason
-           for this is that the old style protocol will eventually be
-           deprecated, and this option is only available to allow for
-           smooth upgrades.
+           Since version 3.10 of nbd-server, however, this option is no
+           longer supported, and any attempt to use it will result in
+           nbd-server exiting with an appropriate error message.
          </para>
        </listitem>
       </varlistentry>
@@ -505,32 +487,6 @@
          </para>
        </listitem>
       </varlistentry>
-      <varlistentry>
-       <term><option>port</option></term>
-       <listitem>
-         <para>Required if 'oldstyle' global parameter is set; integer.</para>
-         <para>
-           The port on which this export is to be served using the
-           old-style handshake protocol.
-         </para>
-         <para>
-           This parameter only makes sense when the 'oldstyle'
-           parameter is set to true in the 'generic' section. If that
-           parameter is not set, but this parameter is found in an
-           export section, then nbd-server will issue a warning upon
-           startup but should otherwise continue to function correctly.
-         </para>
-         <para>
-           It is not possible to combine multiple exports on the same
-           port using the old style handshake. Please use the new style
-           handshake for that purpose.
-         </para>
-         <para>
-           When specified on the command line, this should be the
-           first argument.
-         </para>
-       </listitem>
-      </varlistentry>
       <varlistentry>
        <term><option>postrun</option></term>
        <listitem>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/man/nbd-server.5.sh.in 
new/nbd-3.10/man/nbd-server.5.sh.in
--- old/nbd-3.9/man/nbd-server.5.sh.in  2015-03-01 22:07:01.000000000 +0100
+++ new/nbd-3.10/man/nbd-server.5.sh.in 2015-03-17 01:56:11.000000000 +0100
@@ -111,30 +111,15 @@
 \fBoldstyle\fR
 Optional; boolean
 
-If this option is set to true, nbd-server will export all
-exports on a separate port with the old (pre-2.9.17)
-handshake protocol. In that case, the 'port' option for
-individual exports is mandatory.
-
-If the option is set to false, the 'port' option for
-individual exports is optional (and will be ignored if
-specified). The server will only export devices on the
-standard port.
-
-For upgrades from pre-2.9.17 versions of nbd, it may be
-appropriate to enable the oldstyle parameter until all
-clients have been converted to using name-based exports.
-
-Note that exports specified on the command line will
-always use the old handshake protocol and will not allow
-name-based exports.
-
-Also note that even if this parameter is set to true, all
-exports will also be made available using the new handshake
-protocol; it is not possible to switch that off. The reason
-for this is that the old style protocol will eventually be
-deprecated, and this option is only available to allow for
-smooth upgrades.
+In versions of nbd-server between 2.9.17 and 3.9.1, when this
+option was set to true, nbd-server would export all exports
+on a separate port with the old (pre-2.9.17) handshake
+protocol. In that case, the 'port' option for individual
+exports was mandatory.
+
+Since version 3.10 of nbd-server, however, this option is no
+longer supported, and any attempt to use it will result in
+nbd-server exiting with an appropriate error message.
 .TP
 \fBport\fR
 Optional; string
@@ -342,25 +327,6 @@
 deprecated. You can however specify a custom config file with the \fB-C\fR 
option.
 The \fBfilesize\fR option \fBmust\fR be specified when using this feature!
 .TP
-\fBport\fR
-Required if 'oldstyle' global parameter is set; integer.
-
-The port on which this export is to be served using the
-old-style handshake protocol.
-
-This parameter only makes sense when the 'oldstyle'
-parameter is set to true in the 'generic' section. If that
-parameter is not set, but this parameter is found in an
-export section, then nbd-server will issue a warning upon
-startup but should otherwise continue to function correctly.
-
-It is not possible to combine multiple exports on the same
-port using the old style handshake. Please use the new style
-handshake for that purpose.
-
-When specified on the command line, this should be the
-first argument.
-.TP
 \fBpostrun\fR
 Optional; string
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/nbd-client.c new/nbd-3.10/nbd-client.c
--- old/nbd-3.9/nbd-client.c    2015-03-01 21:05:46.000000000 +0100
+++ new/nbd-3.10/nbd-client.c   2015-03-17 02:20:25.000000000 +0100
@@ -260,10 +260,13 @@
                err("Failed writing length");
 }
 
-void negotiate(int sock, u64 *rsize64, u32 *flags, char* name, uint32_t 
needed_flags, uint32_t client_flags, uint32_t do_opts) {
+void negotiate(int sock, u64 *rsize64, uint16_t *flags, char* name, uint32_t 
needed_flags, uint32_t client_flags, uint32_t do_opts) {
        u64 magic, size64;
        uint16_t tmp;
+       uint16_t global_flags;
        char buf[256] = "\0\0\0\0\0\0\0\0\0";
+       uint32_t opt;
+       uint32_t namesize;
 
        printf("Negotiation: ");
        if (read(sock, buf, 8) < 0)
@@ -276,63 +279,50 @@
        if (read(sock, &magic, sizeof(magic)) < 0)
                err("Failed/2: %m");
        magic = ntohll(magic);
-       if(name) {
-               uint32_t opt;
-               uint32_t namesize;
-
-               if (magic != opts_magic) {
-                       if(magic == cliserv_magic) {
-                               err("It looks like you're trying to connect to 
an oldstyle server with a named export. This won't work.");
-                       }
-               }
-               printf(".");
-               if(read(sock, &tmp, sizeof(uint16_t)) < 0) {
-                       err("Failed reading flags: %m");
-               }
-               *flags = ((u32)ntohs(tmp));
-               if((needed_flags & *flags) != needed_flags) {
-                       /* There's currently really only one reason why this
-                        * check could possibly fail, but we may need to change
-                        * this error message in the future... */
-                       fprintf(stderr, "\nE: Server does not support listing 
exports\n");
-                       exit(EXIT_FAILURE);
-               }
-
-               if (*flags & NBD_FLAG_NO_ZEROES) {
-                       client_flags |= NBD_FLAG_C_NO_ZEROES;
-               }
-               client_flags = htonl(client_flags);
-               if (write(sock, &client_flags, sizeof(client_flags)) < 0)
-                       err("Failed/2.1: %m");
-
-               if(do_opts & NBDC_DO_LIST) {
-                       ask_list(sock);
-                       exit(EXIT_SUCCESS);
+       if (magic != opts_magic) {
+               if(magic == cliserv_magic) {
+                       err("It looks like you're trying to connect to an 
oldstyle server. This is no longer supported since nbd 3.10.");
                }
+       }
+       printf(".");
+       if(read(sock, &tmp, sizeof(uint16_t)) < 0) {
+               err("Failed reading flags: %m");
+       }
+       global_flags = ntohs(tmp);
+       if((needed_flags & global_flags) != needed_flags) {
+               /* There's currently really only one reason why this
+                * check could possibly fail, but we may need to change
+                * this error message in the future... */
+               fprintf(stderr, "\nE: Server does not support listing 
exports\n");
+               exit(EXIT_FAILURE);
+       }
 
-               /* Write the export name that we're after */
-               magic = htonll(opts_magic);
-               if (write(sock, &magic, sizeof(magic)) < 0)
-                       err("Failed/2.2: %m");
-
-               opt = ntohl(NBD_OPT_EXPORT_NAME);
-               if (write(sock, &opt, sizeof(opt)) < 0)
-                       err("Failed/2.3: %m");
-               namesize = (u32)strlen(name);
-               namesize = ntohl(namesize);
-               if (write(sock, &namesize, sizeof(namesize)) < 0)
-                       err("Failed/2.4: %m");
-               if (write(sock, name, strlen(name)) < 0)
-                       err("Failed/2.4: %m");
-       } else {
-               if (magic != cliserv_magic) {
-                       if(magic != opts_magic)
-                               err("Not enough cliserv_magic");
-                       else
-                               err("It looks like you're trying to connect to 
a newstyle server with the oldstyle protocol. Try the -N option.");
-               }
-               printf(".");
+       if (global_flags & NBD_FLAG_NO_ZEROES) {
+               client_flags |= NBD_FLAG_C_NO_ZEROES;
        }
+       client_flags = htonl(client_flags);
+       if (write(sock, &client_flags, sizeof(client_flags)) < 0)
+               err("Failed/2.1: %m");
+
+       if(do_opts & NBDC_DO_LIST) {
+               ask_list(sock);
+               exit(EXIT_SUCCESS);
+       }
+
+       /* Write the export name that we're after */
+       magic = htonll(opts_magic);
+       if (write(sock, &magic, sizeof(magic)) < 0)
+               err("Failed/2.2: %m");
+
+       opt = ntohl(NBD_OPT_EXPORT_NAME);
+       if (write(sock, &opt, sizeof(opt)) < 0)
+               err("Failed/2.3: %m");
+       namesize = (u32)strlen(name);
+       namesize = ntohl(namesize);
+       if (write(sock, &namesize, sizeof(namesize)) < 0)
+               err("Failed/2.4: %m");
+       if (write(sock, name, strlen(name)) < 0)
+               err("Failed/2.4: %m");
 
        if (read(sock, &size64, sizeof(size64)) <= 0) {
                if (!errno)
@@ -347,17 +337,11 @@
        } else
                printf("size = %luMB", (unsigned long)(size64>>20));
 
-       if(!name) {
-               if (read(sock, flags, sizeof(*flags)) < 0)
-                       err("Failed/4: %m\n");
-               *flags = ntohl(*flags);
-       } else {
-               if(read(sock, &tmp, sizeof(tmp)) < 0)
-                       err("Failed/4: %m\n");
-               *flags |= (uint32_t)ntohs(tmp);
-       }
+       if(read(sock, &tmp, sizeof(tmp)) < 0)
+               err("Failed/4: %m\n");
+       *flags = (uint32_t)ntohs(tmp);
 
-       if (!(*flags & NBD_FLAG_NO_ZEROES)) {
+       if (!(global_flags & NBD_FLAG_NO_ZEROES)) {
                if (read(sock, &buf, 124) < 0)
                        err("Failed/5: %m\n");
        }
@@ -436,8 +420,7 @@
        } else {
                fprintf(stderr, "nbd-client version %s\n", PACKAGE_VERSION);
        }
-       fprintf(stderr, "Usage: nbd-client host port nbd_device [-block-size|-b 
block size] [-timeout|-t timeout] [-swap|-s] [-sdp|-S] [-persist|-p] 
[-nofork|-n] [-systemd-mark|-m]\n");
-       fprintf(stderr, "Or   : 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]\n");
+       fprintf(stderr, "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]\n");
        fprintf(stderr, "Or   : nbd-client -d nbd_device\n");
        fprintf(stderr, "Or   : nbd-client -c nbd_device\n");
        fprintf(stderr, "Or   : nbd-client -h|--help\n");
@@ -475,12 +458,12 @@
        int sdp=0;
        int G_GNUC_UNUSED nofork=0; // if -dNOFORK
        u64 size64;
-       u32 flags;
+       uint16_t flags = 0;
        int c;
        int nonspecial=0;
        int b_unix=0;
        char* name=NULL;
-       uint32_t needed_flags=0;
+       uint16_t needed_flags=0;
        uint32_t cflags=NBD_FLAG_C_FIXED_NEWSTYLE;
        uint32_t opts=0;
        sigset_t block, old;
@@ -531,7 +514,7 @@
                                case 1:
                                        // port
                                        if(!strtol(optarg, NULL, 0)) {
-                                               // not parseable as a number, 
assume it's the device and we have a name
+                                               // not parseable as a number, 
assume it's the device
                                                nbddev = optarg;
                                                nonspecial++;
                                        } else {
@@ -605,7 +588,7 @@
     err("swap option unsupported on Android because mlockall is unsupported.");
 #endif
 
-       if((!port && !name) || !hostname || !nbddev) {
+       if(!hostname || ((!name || !nbddev) && !(opts & NBDC_DO_LIST))) {
                usage("not enough information specified");
                exit(EXIT_FAILURE);
        }
@@ -685,7 +668,7 @@
                        } else {
                                if(cont) {
                                        u64 new_size;
-                                       u32 new_flags;
+                                       uint16_t new_flags;
 
                                        close(sock); close(nbd);
                                        for (;;) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/nbd-server.c new/nbd-3.10/nbd-server.c
--- old/nbd-3.9/nbd-server.c    2015-03-01 22:46:06.000000000 +0100
+++ new/nbd-3.10/nbd-server.c   2015-03-16 18:51:04.000000000 +0100
@@ -156,6 +156,7 @@
 /** Global flags: */
 #define F_OLDSTYLE 1     /**< Allow oldstyle (port-based) exports */
 #define F_LIST 2         /**< Allow clients to list the exports on a server */
+#define F_NO_ZEROES 4    /**< Do not send zeros to client */
 GHashTable *children;
 char pidfname[256]; /**< name of our PID file */
 char pidftemplate[256]; /**< template to be used for the filename of the PID 
file */
@@ -678,18 +679,6 @@
        return retval;
 }
 
-static bool want_oldstyle(struct generic_conf gct, struct generic_conf* gc) {
-       if(gct.flags & F_OLDSTYLE) {
-               return true;
-       }
-       if(gc == NULL) {
-               return false;
-       }
-       if(gc->flags & F_OLDSTYLE) {
-               return true;
-       }
-       return false;
-}
 /**
  * Parse the config file.
  *
@@ -719,7 +708,6 @@
        gchar *virtstyle=NULL;
        PARAM lp[] = {
                { "exportname", TRUE,   PARAM_STRING,   &(s.exportname),        
0 },
-               { "port",       TRUE,   PARAM_INT,      &(s.port),              
0 },
                { "authfile",   FALSE,  PARAM_STRING,   &(s.authname),          
0 },
                { "filesize",   FALSE,  PARAM_OFFT,     &(s.expected_size),     
0 },
                { "virtstyle",  FALSE,  PARAM_STRING,   &(virtstyle),           
0 },
@@ -747,7 +735,7 @@
        PARAM gp[] = {
                { "user",       FALSE, PARAM_STRING,    &(genconftmp.user),     
  0 },
                { "group",      FALSE, PARAM_STRING,    &(genconftmp.group),    
  0 },
-               { "oldstyle",   FALSE, PARAM_BOOL,      &(genconftmp.flags),    
  F_OLDSTYLE },
+               { "oldstyle",   FALSE, PARAM_BOOL,      &(genconftmp.flags),    
  F_OLDSTYLE }, // only left here so we can issue an appropriate error message 
when the option is used
                { "listenaddr", FALSE, PARAM_STRING,    
&(genconftmp.modernaddr), 0 },
                { "port",       FALSE, PARAM_STRING,    
&(genconftmp.modernport), 0 },
                { "includedir", FALSE, PARAM_STRING,    &cfdir,                 
  0 },
@@ -802,9 +790,6 @@
                if(i==1 || !expect_generic) {
                        p=lp;
                        p_size=lp_size;
-                       if(!want_oldstyle(genconftmp, genconf)) {
-                               lp[1].required = FALSE;
-                       }
                } 
                for(j=0;j<p_size;j++) {
                        assert(p[j].target != NULL);
@@ -894,9 +879,10 @@
                } else {
                        s.virtstyle=VIRT_IPLIT;
                }
-               if(s.port && !want_oldstyle(genconftmp, genconf)) {
-                       g_warning("A port was specified, but oldstyle exports 
were not requested. This may not do what you expect.");
-                       g_warning("Please read 'man 5 nbd-server' and search 
for oldstyle for more info");
+               if(genconftmp.flags & F_OLDSTYLE) {
+                       g_message("Since 3.10, the oldstyle protocol is no 
longer supported. Please migrate to the newstyle protocol.");
+                       g_message("Exiting.");
+                       return NULL;
                }
                /* Don't need to free this, it's not our string */
                virtstyle=NULL;
@@ -1483,88 +1469,69 @@
  *
  * @param client The client we're negotiating with.
  **/
-CLIENT* negotiate(int net, CLIENT *client, GArray* servers, int phase) {
-       char zeros[128];
-       uint64_t size_host;
+CLIENT* negotiate(int net, GArray* servers) {
        uint32_t flags = NBD_FLAG_HAS_FLAGS;
-       uint16_t smallflags = 0;
+       uint16_t smallflags = NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES;
        uint64_t magic;
        uint32_t cflags = 0;
+       uint32_t opt;
 
-       memset(zeros, '\0', sizeof(zeros));
-       assert(((phase & NEG_INIT) && (phase & NEG_MODERN)) || client);
-       if(phase & NEG_MODERN) {
-               smallflags |= NBD_FLAG_FIXED_NEWSTYLE | NBD_FLAG_NO_ZEROES;
-       }
-       if(phase & NEG_INIT) {
-               /* common */
-               if (write(net, INIT_PASSWD, 8) < 0) {
-                       err_nonfatal("Negotiation failed/1: %m");
-                       if(client)
-                               exit(EXIT_FAILURE);
-               }
-               if(phase & NEG_MODERN) {
-                       /* modern */
-                       magic = htonll(opts_magic);
-               } else {
-                       /* oldstyle */
-                       magic = htonll(cliserv_magic);
-               }
-               if (write(net, &magic, sizeof(magic)) < 0) {
-                       err_nonfatal("Negotiation failed/2: %m");
-                       if(phase & NEG_OLD)
-                               exit(EXIT_FAILURE);
-               }
-       }
-       if ((phase & NEG_MODERN) && (phase & NEG_INIT)) {
-               /* modern */
-               uint32_t opt;
-
-               if(!servers)
-                       err("programmer error");
-               smallflags = htons(smallflags);
-               if (write(net, &smallflags, sizeof(uint16_t)) < 0)
-                       err_nonfatal("Negotiation failed/3: %m");
-               if (read(net, &cflags, sizeof(cflags)) < 0)
-                       err_nonfatal("Negotiation failed/4: %m");
-               cflags = htonl(cflags);
-               do {
-                       if (read(net, &magic, sizeof(magic)) < 0)
-                               err_nonfatal("Negotiation failed/5: %m");
-                       magic = ntohll(magic);
-                       if(magic != opts_magic) {
-                               err_nonfatal("Negotiation failed/5a: magic 
mismatch");
-                               return NULL;
-                       }
-                       if (read(net, &opt, sizeof(opt)) < 0)
-                               err_nonfatal("Negotiation failed/6: %m");
-                       opt = ntohl(opt);
-                       switch(opt) {
-                       case NBD_OPT_EXPORT_NAME:
-                               // NBD_OPT_EXPORT_NAME must be the last
-                               // selected option, so return from here
-                               // if that is chosen.
-                               return handle_export_name(opt, net, servers, 
cflags);
-                               break;
-                       case NBD_OPT_LIST:
-                               handle_list(opt, net, servers, cflags);
-                               break;
-                       case NBD_OPT_ABORT:
-                               // handled below
-                               break;
-                       default:
-                               send_reply(opt, net, NBD_REP_ERR_UNSUP, 0, 
NULL);
-                               break;
-                       }
-               } while((opt != NBD_OPT_EXPORT_NAME) && (opt != NBD_OPT_ABORT));
-               if(opt == NBD_OPT_ABORT) {
-                       err_nonfatal("Session terminated by client");
+       assert(servers != NULL);
+       if (write(net, INIT_PASSWD, 8) < 0)
+               err_nonfatal("Negotiation failed/1: %m");
+       magic = htonll(opts_magic);
+       if (write(net, &magic, sizeof(magic)) < 0)
+               err_nonfatal("Negotiation failed/2: %m");
+
+       smallflags = htons(smallflags);
+       if (write(net, &smallflags, sizeof(uint16_t)) < 0)
+               err_nonfatal("Negotiation failed/3: %m");
+       if (read(net, &cflags, sizeof(cflags)) < 0)
+               err_nonfatal("Negotiation failed/4: %m");
+       cflags = htonl(cflags);
+       if (cflags & NBD_FLAG_C_NO_ZEROES) {
+               glob_flags |= F_NO_ZEROES;
+       }
+       do {
+               if (read(net, &magic, sizeof(magic)) < 0)
+                       err_nonfatal("Negotiation failed/5: %m");
+               magic = ntohll(magic);
+               if(magic != opts_magic) {
+                       err_nonfatal("Negotiation failed/5a: magic mismatch");
                        return NULL;
                }
+               if (read(net, &opt, sizeof(opt)) < 0)
+                       err_nonfatal("Negotiation failed/6: %m");
+               opt = ntohl(opt);
+               switch(opt) {
+               case NBD_OPT_EXPORT_NAME:
+                       // NBD_OPT_EXPORT_NAME must be the last
+                       // selected option, so return from here
+                       // if that is chosen.
+                       return handle_export_name(opt, net, servers, cflags);
+                       break;
+               case NBD_OPT_LIST:
+                       handle_list(opt, net, servers, cflags);
+                       break;
+               case NBD_OPT_ABORT:
+                       // handled below
+                       break;
+               default:
+                       send_reply(opt, net, NBD_REP_ERR_UNSUP, 0, NULL);
+                       break;
+               }
+       } while((opt != NBD_OPT_EXPORT_NAME) && (opt != NBD_OPT_ABORT));
+       if(opt == NBD_OPT_ABORT) {
+               err_nonfatal("Session terminated by client");
+               return NULL;
        }
-       /* common */
-       size_host = htonll((u64)(client->exportsize));
-       if (write(net, &size_host, 8) < 0)
+}
+
+void send_export_info(CLIENT* client) {
+       uint64_t size_host = htonll((u64)(client->exportsize));
+       uint16_t flags = 0;
+
+       if (write(client->net, &size_host, 8) < 0)
                err("Negotiation failed/9: %m");
        if (client->server->flags & F_READONLY)
                flags |= NBD_FLAG_READ_ONLY;
@@ -1576,24 +1543,14 @@
                flags |= NBD_FLAG_ROTATIONAL;
        if (client->server->flags & F_TRIM)
                flags |= NBD_FLAG_SEND_TRIM;
-       if (phase & NEG_OLD) {
-               /* oldstyle */
-               flags = htonl(flags);
-               if (write(client->net, &flags, 4) < 0)
-                       err("Negotiation failed/10: %m");
-       } else {
-               /* modern */
-               smallflags = (uint16_t)(flags & ~((uint16_t)0));
-               smallflags = htons(smallflags);
-               if (write(client->net, &smallflags, sizeof(smallflags)) < 0) {
-                       err("Negotiation failed/11: %m");
-               }
-       }
-       /* common */
-       if (!(cflags & NBD_FLAG_C_NO_ZEROES)) {
+       flags = htons(flags);
+       if (write(client->net, &flags, sizeof(flags)) < 0)
+               err("Negotiation failed/11: %m");
+       if (!(glob_flags & F_NO_ZEROES)) {
+               char zeros[128];
+               memset(zeros, '\0', sizeof(zeros));
                if (write(client->net, zeros, 124) < 0)
                        err("Negotiation failed/12: %m");
-               return NULL;
        }
 }
 
@@ -1619,7 +1576,7 @@
 #ifdef DODBG
        int i = 0;
 #endif
-       negotiate(client->net, client, NULL, client->modern ? NEG_MODERN : 
(NEG_OLD | NEG_INIT));
+       send_export_info(client);
        DEBUG("Entering request loop!\n");
        reply.magic = htonl(NBD_REPLY_MAGIC);
        reply.error = 0;
@@ -2038,26 +1995,32 @@
                        msg(LOG_DEBUG, "virtstyle cidr %d", 
client->server->cidrlen);
                        memcpy(&netaddr, &(client->clientaddr), addrinlen);
                        int addrbits;
-                       assert((ai->ai_family == AF_INET) || (ai->ai_family == 
AF_INET6));
-                       if(ai->ai_family == AF_INET) {
-                               addrbits = 32;
-                       } else if(ai->ai_family == AF_INET6) {
-                               addrbits = 128;
-                       }
-                       uint8_t* addrptr = (uint8_t*)(((struct 
sockaddr*)&netaddr)->sa_data);
-                       for(int i = 0; i < addrbits; i+=8) {
-                               int masklen = client->server->cidrlen - i;
-                               masklen = masklen > 0 ? masklen : 0;
-                               uint8_t mask = getmaskbyte(masklen);
-                               *addrptr &= mask;
-                               addrptr++;
-                       }
-                       getnameinfo((struct sockaddr *) &netaddr, addrinlen,
-                                                       netname, sizeof 
(netname), NULL, 0, NI_NUMERICHOST);
-                       tmp=g_strdup_printf("%s/%s", netname, peername);
+                       if(addr->sa_family == AF_UNIX) {
+                               tmp = g_strdup(peername);
+                       } else {
+                               assert((ai->ai_family == AF_INET) || 
(ai->ai_family == AF_INET6));
+                               if(ai->ai_family == AF_INET) {
+                                       addrbits = 32;
+                               } else if(ai->ai_family == AF_INET6) {
+                                       addrbits = 128;
+                               }
+                               uint8_t* addrptr = (uint8_t*)(((struct 
sockaddr*)&netaddr)->sa_data);
+                               for(int i = 0; i < addrbits; i+=8) {
+                                       int masklen = client->server->cidrlen - 
i;
+                                       masklen = masklen > 0 ? masklen : 0;
+                                       uint8_t mask = getmaskbyte(masklen);
+                                       *addrptr &= mask;
+                                       addrptr++;
+                               }
+                               getnameinfo((struct sockaddr *) &netaddr, 
addrinlen,
+                                                               netname, sizeof 
(netname), NULL, 0, NI_NUMERICHOST);
+                               tmp=g_strdup_printf("%s/%s", netname, peername);
+                       }
 
-                       if(tmp != NULL)
-                         
client->exportname=g_strdup_printf(client->server->exportname, tmp);
+                       if(tmp != NULL) {
+                               
client->exportname=g_strdup_printf(client->server->exportname, tmp);
+                               g_free(tmp);
+                       }
 
                        break;
        }
@@ -2151,7 +2114,7 @@
                 /* Child just continues. */
         }
 
-        client = negotiate(net, NULL, servers, NEG_INIT | NEG_MODERN);
+        client = negotiate(net, servers);
         if (!client) {
                 msg(LOG_ERR, "Modern initial negotiation failed");
                 goto handler_err;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/tests/run/Makefile.am 
new/nbd-3.10/tests/run/Makefile.am
--- old/nbd-3.9/tests/run/Makefile.am   2015-03-01 22:28:30.000000000 +0100
+++ new/nbd-3.10/tests/run/Makefile.am  2015-03-11 18:31:52.000000000 +0100
@@ -1,12 +1,11 @@
 TESTS_ENVIRONMENT=$(srcdir)/simple_test
-TESTS = cmd cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig list 
rowrite tree rotree unix #integrityhuge
+TESTS = cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig list 
rowrite tree rotree unix #integrityhuge
 check_PROGRAMS = nbd-tester-client
 nbd_tester_client_SOURCES = nbd-tester-client.c $(top_srcdir)/cliserv.h 
$(top_srcdir)/netdb-compat.h $(top_srcdir)/cliserv.c
 nbd_tester_client_CFLAGS = @CFLAGS@ @GLIB_CFLAGS@
 nbd_tester_client_CPPFLAGS = -I$(top_srcdir)
 nbd_tester_client_LDADD = @GLIB_LIBS@
 EXTRA_DIST = integrity-test.tr integrityhuge-test.tr simple_test
-cmd:
 cfg1:
 cfgmulti:
 cfgnew:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/tests/run/Makefile.in 
new/nbd-3.10/tests/run/Makefile.in
--- old/nbd-3.9/tests/run/Makefile.in   2015-03-01 22:28:32.000000000 +0100
+++ new/nbd-3.10/tests/run/Makefile.in  2015-03-11 18:31:54.000000000 +0100
@@ -312,7 +312,7 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 TESTS_ENVIRONMENT = $(srcdir)/simple_test
-TESTS = cmd cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig list 
rowrite tree rotree unix #integrityhuge
+TESTS = cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig list 
rowrite tree rotree unix #integrityhuge
 nbd_tester_client_SOURCES = nbd-tester-client.c $(top_srcdir)/cliserv.h 
$(top_srcdir)/netdb-compat.h $(top_srcdir)/cliserv.c
 nbd_tester_client_CFLAGS = @CFLAGS@ @GLIB_CFLAGS@
 nbd_tester_client_CPPFLAGS = -I$(top_srcdir)
@@ -728,7 +728,6 @@
        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
        tags tags-am uninstall uninstall-am
 
-cmd:
 cfg1:
 cfgmulti:
 cfgnew:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbd-3.9/tests/run/simple_test 
new/nbd-3.10/tests/run/simple_test
--- old/nbd-3.9/tests/run/simple_test   2015-03-02 18:41:41.000000000 +0100
+++ new/nbd-3.10/tests/run/simple_test  2015-03-11 18:31:54.000000000 +0100
@@ -41,39 +41,32 @@
 echo $1
 
 case $1 in
-       */cmd)
-               # Test with export specified on command line
-               ../../nbd-server -C /dev/null -p ${pidfile} 11111 $tmpnam &
-               # -p only works if nbd-server wasn't compiled with -DNOFORK or
-               # -DNODAEMON, which I sometimes do for testing and debugging.
-               PID=$!
-               sleep 1
-               ./nbd-tester-client 127.0.0.1 11111
-               retval=$?
-       ;;
        */cfgsize)
                # Test oversized requests
-               ../../nbd-server -C /dev/null -p ${pidfile} 11112 $tmpnam &
+               cat > ${conffile} <<EOF
+[generic]
+[export]
+       exportname = $tmpnam
+EOF
+               ../../nbd-server -C ${conffile} -p ${pidfile} &
                # -p only works if nbd-server wasn't compiled with -DNOFORK or
                # -DNODAEMON, which I sometimes do for testing and debugging.
                PID=$!
                sleep 1
-               ./nbd-tester-client -o 127.0.0.1 11112
+               ./nbd-tester-client -o 127.0.0.1 -N export
                retval=$?
        ;;
        */cfg1)
                # Test with export specified in config file
                cat > ${conffile} <<EOF
 [generic]
-       oldstyle = true
 [export]
        exportname = $tmpnam
-       port = 11113
 EOF
                ../../nbd-server -C ${conffile} -p ${pidfile} &
                PID=$!
                sleep 1
-               ./nbd-tester-client 127.0.0.1 11113
+               ./nbd-tester-client 127.0.0.1 -N export
                retval=$?
        ;;
        */cfgmulti)
@@ -81,22 +74,19 @@
                # testing more options too
                cat >${conffile} <<EOF
 [generic]
-       oldstyle = true
 [export1]
        exportname = $tmpnam
-       port = 11114
        copyonwrite = true
        listenaddr = 127.0.0.1
 [export2]
        exportname = $tmpnam
-       port = 11115
        readonly = true
        listenaddr = 127.0.0.1
 EOF
                ../../nbd-server -C ${conffile} -p ${pidfile} &
                PID=$!
                sleep 1
-               ./nbd-tester-client localhost 11114
+               ./nbd-tester-client localhost -N export1
                retval=$?
                if [ $retval -ne 0 ]
                then
@@ -112,7 +102,7 @@
                        fi
                        exit $retval
                fi
-               ./nbd-tester-client localhost 11115
+               ./nbd-tester-client localhost -N export2
                retval=$?
        ;;
        */cfgnew)

++++++ no-return-nonvoid.patch ++++++
--- /var/tmp/diff_new_pack.VbY2js/_old  2015-04-21 10:51:51.000000000 +0200
+++ /var/tmp/diff_new_pack.VbY2js/_new  2015-04-21 10:51:51.000000000 +0200
@@ -1,12 +1,12 @@
-Index: nbd-3.9/nbd-server.c
+Index: nbd-3.10/nbd-server.c
 ===================================================================
---- nbd-3.9.orig/nbd-server.c
-+++ nbd-3.9/nbd-server.c
-@@ -1595,6 +1595,7 @@ CLIENT* negotiate(int net, CLIENT *clien
-                       err("Negotiation failed/12: %m");
+--- nbd-3.10.orig/nbd-server.c
++++ nbd-3.10/nbd-server.c
+@@ -1525,6 +1525,7 @@ CLIENT* negotiate(int net, GArray* serve
+               err_nonfatal("Session terminated by client");
                return NULL;
        }
 +      return NULL;
  }
  
- /** sending macro. */
+ void send_export_info(CLIENT* client) {


Reply via email to