Hello community,

here is the log from the commit of package istgt for openSUSE:Factory checked 
in at 2014-12-21 12:04:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/istgt (Old)
 and      /work/SRC/openSUSE:Factory/.istgt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "istgt"

Changes:
--------
--- /work/SRC/openSUSE:Factory/istgt/istgt.changes      2014-02-04 
19:21:48.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.istgt.new/istgt.changes 2014-12-21 
12:04:10.000000000 +0100
@@ -1,0 +2,39 @@
+Tue Dec 16 00:11:14 UTC 2014 - dd...@suse.com
+
+- Fix paths in sample conf and doc files; (boo#910112).
+
+-------------------------------------------------------------------
+Thu Dec 11 14:18:49 UTC 2014 - dd...@suse.com
+
+- Update to upstream istgt-20141125.tar.gz:
+
+- Japanese -> English ChangeLog.jp via Google Translate:
+  + Change so that it does not warn of key change from the
+    reservation holder
+  + Add -fstack-protector to default
+  + Fixed a problem that deletion of the registration key is not
+    done correctly
+  + Modified to re-set when the reservation key is changed
+  + Changed to link in favor of libmd
+  + Fixed a problem to skip SYNCHRONIZE_CACHE of LEN = 0
+  + Modified to retry without error when you are disconnected during
+    accept
+  + Change backlog to 1 so that it does not create a thread waiting
+  + Add the latency to start after you have created a thread
+
+- Cleanup systemd services file:
+  + Deleted build-use-systemd-init.patch
+  + Added build-specify-systemd-services-file-on-Linux.patch
+  + Removed exec flags from service file; (boo#910111).
+
+- Use BSD md5 library:
+  + Removed md5-add-RFC1321-based-RSA-free-MD5-library.patch and
+    md5-use-in-tree-libmd5-rfc-rather-than-libcrypto.patch
+  + Added md5-add-in-tree-MD5-library.patch and
+    md5-use-in-tree-MD5-rather-than-libcrypto.patch
+
+- Improve usability for non-root users:
+  + Removed fix-installdir.patch
+  + Added etc-use-bindir-instead-of-sbindir-in-init-scripts.patch
+
+-------------------------------------------------------------------

Old:
----
  build-use-systemd-init.patch
  fix-installdir.patch
  istgt-20121028.tar.gz
  md5-add-RFC1321-based-RSA-free-MD5-library.patch
  md5-use-in-tree-libmd5-rfc-rather-than-libcrypto.patch

New:
----
  build-specify-systemd-services-file-on-Linux.patch
  etc-use-bindir-instead-of-sbindir-in-init-scripts.patch
  istgt-20141125.tar.gz
  md5-add-in-tree-MD5-library.patch
  md5-use-in-tree-MD5-rather-than-libcrypto.patch

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

Other differences:
------------------
++++++ istgt.spec ++++++
--- /var/tmp/diff_new_pack.Z20Udv/_old  2014-12-21 12:04:11.000000000 +0100
+++ /var/tmp/diff_new_pack.Z20Udv/_new  2014-12-21 12:04:11.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package istgt
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,9 +17,9 @@
 
 
 Name:           istgt
-Version:        0.10
+Version:        0.20
 Release:        0
-%define upstreamrel 20121028
+%define upstreamrel 20141125
 Summary:        Userspace iSCSI Target
 License:        BSD-2-Clause
 Group:          Productivity/Networking/Other
@@ -38,17 +38,17 @@
 %define systemd_init 1
 %endif
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-Patch1:         fix-installdir.patch
 Patch2:         add-istgtcontrol-manpage.patch
 Patch3:         disk-support-0-len-read-and-write-CBDs.patch
 Patch4:         lu-perform-lba-range-check-before-0-byte-fastpath.patch
 Patch5:         lu-add-sense-data-to-out-of-range-read-and-write-err.patch
 Patch6:         iscsi-cancel-conn-worker-threads-using-the-task_pipe.patch
-Patch7:         md5-add-RFC1321-based-RSA-free-MD5-library.patch
-Patch8:         md5-use-in-tree-libmd5-rfc-rather-than-libcrypto.patch
+Patch7:         md5-add-in-tree-MD5-library.patch
+Patch8:         md5-use-in-tree-MD5-rather-than-libcrypto.patch
 Patch9:         etc-add-systemd-service-file.patch
-Patch10:        build-use-systemd-init.patch
+Patch10:        build-specify-systemd-services-file-on-Linux.patch
 Patch11:        build-regenerate-configure.patch
+Patch12:        etc-use-bindir-instead-of-sbindir-in-init-scripts.patch
 
 %description
 This software (istgt) is the implementation of iSCSI target
@@ -68,8 +68,7 @@
 
 %prep
 %setup -q -n istgt-%{upstreamrel}
-%patch1 -p1
-%patch2 -p1
+%patch2 -p0
 %patch3 -p0
 %patch4 -p0
 %patch5 -p0
@@ -79,19 +78,21 @@
 %patch9 -p0
 %patch10 -p0
 %patch11 -p0
+%patch12 -p0
 
 autoconf
 
 %build
 %if 0%{?systemd_init}
-       %configure --with-unitdir=%{_unitdir}
+       %configure --with-unitdir=%{_unitdir} 
--with-configdir=%{_sysconfdir}/istgt
 %else
-       %configure
+       %configure --with-configdir=%{_sysconfdir}/istgt
 %endif
 make
 
 %install
 make install DESTDIR=$RPM_BUILD_ROOT
+mkdir -p  %{buildroot}/%{_sbindir}
 %if 0%{?systemd_init}
        ln -s ../../%{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name}
 %else
@@ -127,8 +128,8 @@
 
 %files
 %defattr(-,root,root)
-%{_sbindir}/istgt
-%{_sbindir}/istgtcontrol
+%{_bindir}/istgt
+%{_bindir}/istgtcontrol
 %dir %{_sysconfdir}/istgt/
 %config %{_sysconfdir}/istgt/*.conf.sample
 %if 0%{?systemd_init}

++++++ add-istgtcontrol-manpage.patch ++++++
--- /var/tmp/diff_new_pack.Z20Udv/_old  2014-12-21 12:04:11.000000000 +0100
+++ /var/tmp/diff_new_pack.Z20Udv/_new  2014-12-21 12:04:11.000000000 +0100
@@ -1,18 +1,25 @@
-Description: Add istgtcontrol manpage
- Add the manpages for the istgtcontrol.1 command. Modified files:
- .
- * doc/istgtcontrol.1.in - new file
- * doc/Makefile.in - change Makefile to make use of the Makefile
- Forwarded: Yes
- Author: Arno Töll <deb...@toell.net>
- Applied-Upstream: not yet
- Last-Update: 2012-07-26
+From ae6975fdf9721494ca37315956b85fcd38dcf888 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arno=20T=C3=B6ll?= <deb...@toell.net>
+Date: Fri, 20 Jul 2012 13:17:55 +0200
+Subject: [PATCH 01/12] add istgtcontrol manpage
 
-Index: istgt-20120807/doc/Makefile.in
-===================================================================
---- istgt-20120807.orig/doc/Makefile.in
-+++ istgt-20120807/doc/Makefile.in
-@@ -22,8 +22,9 @@ MKDIR_P  = @MKDIR_P@
+Add the manpages for the istgtcontrol.1 command. Modified files:
+* doc/istgtcontrol.1.in - new file
+* doc/Makefile.in - change Makefile to make use of the manpage
+Forwarded: Yes
+Applied-Upstream: not yet
+Last-Update: 2010-10-07
+---
+ doc/Makefile.in       |  22 +++++---
+ doc/istgtcontrol.1.in | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 154 insertions(+), 8 deletions(-)
+ create mode 100644 doc/istgtcontrol.1.in
+
+diff --git doc/Makefile.in doc/Makefile.in
+index 407f234..ad333be 100644
+--- doc/Makefile.in
++++ doc/Makefile.in
+@@ -22,23 +22,25 @@ MKDIR_P  = @MKDIR_P@
  
  source   = 
  header   = 
@@ -23,7 +30,10 @@
  
  DISTDIR = $(top_srcdir)/`cat $(top_srcdir)/distdir`
  DISTFILES = Makefile.in \
-@@ -33,12 +34,12 @@ DISTFILES = Makefile.in \
+       $(header) $(source) \
+       $(document) $(sample)
++DISTFILES += $(MANPAGES)
+ 
  #########################################################################
  
  .PHONY: all install install-doc install-dirs install-doc-dirs
@@ -39,7 +49,7 @@
  
  dist: $(DISTFILES)
        $(MKDIR_P) $(DISTDIR)/$(subdir)
-@@ -48,9 +49,13 @@ dist: $(DISTFILES)
+@@ -48,9 +50,13 @@ dist: $(DISTFILES)
        done
  
  install: install-dirs
@@ -49,14 +59,14 @@
 +      set -e
 +      for file in $(MANPAGES) ; \
 +      do \
-+              $(INSTALL) -m 0644 $$file $(DESTDIR)$(mandir)/man1/ ; \
++              $(INSTALL) -c -m 0644 $$file $(DESTDIR)$(mandir)/man1/ ; \
 +              rm -f $(DESTDIR)$(mandir)/man1/$$file.gz ; \
 +              gzip -9 $(DESTDIR)$(mandir)/man1/$$file ; \
 +      done
  
  install-doc: install-doc-dirs
        $(INSTALL) -m 0644 $(top_srcdir)/README $(DESTDIR)$(datadir)/doc/istgt/
-@@ -66,7 +71,7 @@ install-doc-dirs:
+@@ -66,7 +72,7 @@ install-doc-dirs:
  
  .PHONY: clean distclean depend
  clean:
@@ -65,10 +75,11 @@
        -rm -f a.out *.o *.core
        -rm -f *~
  
-Index: istgt-20120807/doc/istgtcontrol.1.in
-===================================================================
+diff --git doc/istgtcontrol.1.in doc/istgtcontrol.1.in
+new file mode 100644
+index 0000000..e5f843c
 --- /dev/null
-+++ istgt-20120807/doc/istgtcontrol.1.in
++++ doc/istgtcontrol.1.in
 @@ -0,0 +1,140 @@
 +.TH istgtcontrol 1 "Oct 07, 2011" "istgtcontrol"
 +.SH NAME
@@ -210,3 +221,6 @@
 +
 +This manual page was written by Arno Töll (<deb...@toell.net>) for the Debian
 +GNU/kFreeBSD system (but may be used by others).
+-- 
+2.1.2
+

++++++ build-regenerate-configure.patch ++++++
--- /var/tmp/diff_new_pack.Z20Udv/_old  2014-12-21 12:04:11.000000000 +0100
+++ /var/tmp/diff_new_pack.Z20Udv/_new  2014-12-21 12:04:11.000000000 +0100
@@ -1,17 +1,17 @@
-From 74eed2c578d204db68082ae21261569f3a3e134f Mon Sep 17 00:00:00 2001
+From 705f4cf32632ef2ed70be1b50a8ed843416f71ee Mon Sep 17 00:00:00 2001
 From: David Disseldorp <dd...@suse.de>
 Date: Sun, 2 Feb 2014 23:17:46 +0100
-Subject: [PATCH 3/3] build: regenerate configure
+Subject: [PATCH 10/12] build: regenerate configure
 
 ---
  configure | 25 +++++++++++++++++++++++--
  1 file changed, 23 insertions(+), 2 deletions(-)
 
 diff --git configure configure
-index 3423760..35a2203 100755
+index 83d3838..ca61eed 100755
 --- configure
 +++ configure
-@@ -694,6 +694,7 @@ SHELL'
+@@ -693,6 +693,7 @@ SHELL'
  ac_subst_files=''
  ac_user_opts='
  enable_option_checking
@@ -19,7 +19,7 @@
  enable_largefile
  with_configdir
  with_mediadir
-@@ -1335,6 +1336,9 @@ Optional Features:
+@@ -1333,6 +1334,9 @@ Optional Features:
  Optional Packages:
    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
    --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
@@ -29,7 +29,7 @@
    --with-configdir=DIR    (default PREFIX/etc/istgt)
    --with-mediadir=DIR     (default /var/istgt)
    --with-rcdir=DIR        (default PREFIX/etc/rc.d)
-@@ -3307,6 +3311,16 @@ if test "$CC" = "clang" && test "$ac_test_CFLAGS" != 
"set"; then
+@@ -3304,6 +3308,16 @@ if test "$CC" = "clang" && test "$ac_test_CFLAGS" != 
"set"; then
    CFLAGS="-g -O3"
  fi
  
@@ -46,7 +46,7 @@
  # host OS related
  vboxinc="/usr/local/src/virtualbox/*/include"
  vboxlib="/usr/local/lib/virtualbox"
-@@ -3392,10 +3406,17 @@ case "$host_os" in
+@@ -3389,10 +3403,17 @@ case "$host_os" in
            vboxinc=$tmp
        fi
        vboxlib="/usr/lib/virtualbox"
@@ -67,5 +67,5 @@
  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
  
 -- 
-1.8.4.5
+2.1.2
 

++++++ build-specify-systemd-services-file-on-Linux.patch ++++++
>From 136aa0ecf5f2cc27553b468188b68a0e08930bb9 Mon Sep 17 00:00:00 2001
From: David Disseldorp <dd...@suse.de>
Date: Sun, 2 Feb 2014 17:06:08 +0100
Subject: [PATCH 09/12] build: specify systemd services file on Linux

Allow for the specification of a systemd services path at configure time
via the new --with-unitdir=PATH option. When specified, the systemd
services file will be generated and installed under PATH.
---
 configure.in | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git configure.in configure.in
index 52e0af9..c960984 100644
--- configure.in
+++ configure.in
@@ -18,6 +18,13 @@ if test "$CC" = "clang" && test "$ac_test_CFLAGS" != "set"; 
then
   CFLAGS="-g -O3"
 fi
 
+# systemd unit directory
+AC_ARG_WITH([unitdir],
+           [AS_HELP_STRING([--with-unitdir=UNITDIR_PATH],
+           [Generate and install a systemd services file in provided dir])],
+           [],
+           [with_unitdir=no])
+
 # host OS related
 vboxinc="/usr/local/src/virtualbox/*/include"
 vboxlib="/usr/local/lib/virtualbox"
@@ -31,8 +38,13 @@ case "$host_os" in
            vboxinc=$tmp
        fi
        vboxlib="/usr/lib/virtualbox"
-       AC_SUBST([rctemplate], ["istgt_linux.sh.in"])
-       AC_SUBST([rcdir], ['/etc/init.d'])
+       if test "x$with_unitdir" != xno -a -d "$with_unitdir"; then
+               AC_SUBST([rctemplate], ["istgt.service.in"])
+               AC_SUBST([rcdir], [$with_unitdir])
+       else
+               AC_SUBST([rctemplate], ["istgt_linux.sh.in"])
+               AC_SUBST([rcdir], ['/etc/init.d'])
+       fi
        AC_DEFINE([_GNU_SOURCE], 1, [Define if linux host])
        ;;
 *netbsd*)
-- 
2.1.2

++++++ disk-support-0-len-read-and-write-CBDs.patch ++++++
--- /var/tmp/diff_new_pack.Z20Udv/_old  2014-12-21 12:04:11.000000000 +0100
+++ /var/tmp/diff_new_pack.Z20Udv/_new  2014-12-21 12:04:11.000000000 +0100
@@ -1,17 +1,17 @@
-From 4441406e6bfd8de8fedde118bc08346e449c9eb4 Mon Sep 17 00:00:00 2001
+From 107c5c374636951b560d9e00447de2cbb51cbf4d Mon Sep 17 00:00:00 2001
 From: David Disseldorp <dd...@suse.de>
 Date: Tue, 26 Mar 2013 17:51:10 +0100
-Subject: [PATCH 1/7] disk: support 0 len read and write CBDs
+Subject: [PATCH 02/12] disk: support 0 len read and write CBDs
 
 ---
  src/istgt_lu_disk.c | 78 ++++++++++++++++++++++++++++-------------------------
  1 file changed, 42 insertions(+), 36 deletions(-)
 
 diff --git src/istgt_lu_disk.c src/istgt_lu_disk.c
-index bf0e1b4..2850955 100644
+index 78df581..9b58da3 100644
 --- src/istgt_lu_disk.c
 +++ src/istgt_lu_disk.c
-@@ -6077,12 +6077,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6115,12 +6115,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                                }
                        }
  
@@ -24,7 +24,7 @@
                        dpo = BGET8(&cdb[1], 4);
                        fua = BGET8(&cdb[1], 3);
                        fua_nv = BGET8(&cdb[1], 1);
-@@ -6091,6 +6085,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6129,6 +6123,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                        ISTGT_TRACELOG(ISTGT_TRACE_SCSI,
                            "READ_10(lba %"PRIu64", len %u blocks)\n",
                            lba, transfer_len);
@@ -38,7 +38,7 @@
                        rc = istgt_lu_disk_lbread(spec, conn, lu_cmd, lba, 
transfer_len);
                        if (rc < 0) {
                                ISTGT_ERRLOG("lu_disk_lbread() failed\n");
-@@ -6113,12 +6114,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6151,12 +6152,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                                }
                        }
  
@@ -51,7 +51,7 @@
                        dpo = BGET8(&cdb[1], 4);
                        fua = BGET8(&cdb[1], 3);
                        fua_nv = BGET8(&cdb[1], 1);
-@@ -6127,6 +6122,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6165,6 +6160,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                        ISTGT_TRACELOG(ISTGT_TRACE_SCSI,
                            "READ_12(lba %"PRIu64", len %u blocks)\n",
                            lba, transfer_len);
@@ -65,7 +65,7 @@
                        rc = istgt_lu_disk_lbread(spec, conn, lu_cmd, lba, 
transfer_len);
                        if (rc < 0) {
                                ISTGT_ERRLOG("lu_disk_lbread() failed\n");
-@@ -6149,12 +6151,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6187,12 +6189,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                                }
                        }
  
@@ -78,7 +78,7 @@
                        dpo = BGET8(&cdb[1], 4);
                        fua = BGET8(&cdb[1], 3);
                        fua_nv = BGET8(&cdb[1], 1);
-@@ -6163,6 +6159,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6201,6 +6197,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                        ISTGT_TRACELOG(ISTGT_TRACE_SCSI,
                            "READ_16(lba %"PRIu64", len %u blocks)\n",
                            lba, transfer_len);
@@ -92,7 +92,7 @@
                        rc = istgt_lu_disk_lbread(spec, conn, lu_cmd, lba, 
transfer_len);
                        if (rc < 0) {
                                ISTGT_ERRLOG("lu_disk_lbread() failed\n");
-@@ -6220,12 +6223,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6258,12 +6261,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                                }
                        }
  
@@ -105,7 +105,7 @@
                        dpo = BGET8(&cdb[1], 4);
                        fua = BGET8(&cdb[1], 3);
                        fua_nv = BGET8(&cdb[1], 1);
-@@ -6234,6 +6231,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6272,6 +6269,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                        ISTGT_TRACELOG(ISTGT_TRACE_SCSI,
                            "WRITE_10(lba %"PRIu64", len %u blocks)\n",
                            lba, transfer_len);
@@ -119,7 +119,7 @@
                        rc = istgt_lu_disk_lbwrite(spec, conn, lu_cmd, lba, 
transfer_len);
                        if (rc < 0) {
                                ISTGT_ERRLOG("lu_disk_lbwrite() failed\n");
-@@ -6257,12 +6261,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6295,12 +6299,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                                }
                        }
  
@@ -132,7 +132,7 @@
                        dpo = BGET8(&cdb[1], 4);
                        fua = BGET8(&cdb[1], 3);
                        fua_nv = BGET8(&cdb[1], 1);
-@@ -6271,6 +6269,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6309,6 +6307,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                        ISTGT_TRACELOG(ISTGT_TRACE_SCSI,
                            "WRITE_12(lba %"PRIu64", len %u blocks)\n",
                            lba, transfer_len);
@@ -146,7 +146,7 @@
                        rc = istgt_lu_disk_lbwrite(spec, conn, lu_cmd, lba, 
transfer_len);
                        if (rc < 0) {
                                ISTGT_ERRLOG("lu_disk_lbwrite() failed\n");
-@@ -6294,12 +6299,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6332,12 +6337,6 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                                }
                        }
  
@@ -159,7 +159,7 @@
                        dpo = BGET8(&cdb[1], 4);
                        fua = BGET8(&cdb[1], 3);
                        fua_nv = BGET8(&cdb[1], 1);
-@@ -6308,6 +6307,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
+@@ -6346,6 +6345,13 @@ istgt_lu_disk_execute(CONN_Ptr conn, ISTGT_LU_CMD_Ptr 
lu_cmd)
                        ISTGT_TRACELOG(ISTGT_TRACE_SCSI,
                            "WRITE_16(lba %"PRIu64", len %u blocks)\n",
                            lba, transfer_len);
@@ -174,5 +174,5 @@
                        if (rc < 0) {
                                ISTGT_ERRLOG("lu_disk_lbwrite() failed\n");
 -- 
-1.8.1.4
+2.1.2
 

++++++ etc-add-systemd-service-file.patch ++++++
--- /var/tmp/diff_new_pack.Z20Udv/_old  2014-12-21 12:04:11.000000000 +0100
+++ /var/tmp/diff_new_pack.Z20Udv/_new  2014-12-21 12:04:11.000000000 +0100
@@ -1,8 +1,9 @@
-From 0d34781bcaeaf823818a304d7ef973504a119aaf Mon Sep 17 00:00:00 2001
+From 1f136a4453877d4e04e6bbe0bc8672564c857dbe Mon Sep 17 00:00:00 2001
 From: David Disseldorp <dd...@suse.de>
 Date: Sun, 2 Feb 2014 16:48:38 +0100
-Subject: [PATCH 1/3] etc: add systemd service file
+Subject: [PATCH 08/12] etc: add systemd service file
 
+Signed-off-by: David Disseldorp <dd...@suse.de>
 ---
  etc/Makefile.in      | 12 ++++++++----
  etc/istgt.service.in | 14 ++++++++++++++
@@ -10,7 +11,7 @@
  create mode 100644 etc/istgt.service.in
 
 diff --git etc/Makefile.in etc/Makefile.in
-index 057356b..1e1746b 100644
+index 057356b..ef76f71 100644
 --- etc/Makefile.in
 +++ etc/Makefile.in
 @@ -25,10 +25,11 @@ header   =
@@ -35,7 +36,7 @@
        if [ "x$(rcfile)" != "x" -a -f "$(rcfile)" ]; then \
 -          $(INSTALL) -m 0555 $(rcfile) $(DESTDIR)$(rcdir)/istgt; \
 +          if  [ "x$(rcfile)" == "xistgt.service" ]; then \
-+              $(INSTALL) -m 0555 $(rcfile) $(DESTDIR)$(rcdir)/istgt.service; \
++              $(INSTALL) -m 0644 $(rcfile) $(DESTDIR)$(rcdir)/istgt.service; \
 +          else \
 +              $(INSTALL) -m 0555 $(rcfile) $(DESTDIR)$(rcdir)/istgt; \
 +          fi \
@@ -44,7 +45,7 @@
  install-dirs:
 diff --git etc/istgt.service.in etc/istgt.service.in
 new file mode 100644
-index 0000000..eba4958
+index 0000000..41adeb6
 --- /dev/null
 +++ etc/istgt.service.in
 @@ -0,0 +1,14 @@
@@ -54,8 +55,8 @@
 +
 +[Service]
 +Type=forking
-+PIDFile=/run/samba/smbd.pid
-+ExecStart=%%SBINDIR%%/istgt -c %%SYSCONFDIR%%/istgt.conf
++PIDFile=/var/run/istgt.pid
++ExecStart=%%BINDIR%%/istgt -c %%SYSCONFDIR%%/istgt.conf
 +Restart=on-abort
 +ExecReload=%%BINDIR%%/kill -HUP $MAINPID
 +LimitNOFILE=16384
@@ -63,5 +64,5 @@
 +[Install]
 +WantedBy=multi-user.target
 -- 
-1.8.4.5
+2.1.2
 

++++++ etc-use-bindir-instead-of-sbindir-in-init-scripts.patch ++++++
>From e16092236c07f2ae78b29e8c58c6b37d160146a4 Mon Sep 17 00:00:00 2001
From: David Disseldorp <dd...@suse.de>
Date: Mon, 12 May 2014 14:45:18 +0200
Subject: [PATCH 11/12] etc: use bindir instead of sbindir in init scripts

Signed-off-by: David Disseldorp <dd...@suse.de>
---
 etc/istgt_linux.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git etc/istgt_linux.sh.in etc/istgt_linux.sh.in
index ffc746a..252c2b0 100644
--- etc/istgt_linux.sh.in
+++ etc/istgt_linux.sh.in
@@ -23,7 +23,7 @@ name="istgt"
 
 required_files="${istgt_config}"
 pidfile="${istgt_pidfile}"
-command="%%SBINDIR%%/istgt"
+command="%%BINDIR%%/istgt"
 command_args="-c ${istgt_config} ${istgt_flags}"
 
 case "$1" in
-- 
2.1.2

++++++ iscsi-cancel-conn-worker-threads-using-the-task_pipe.patch ++++++
--- /var/tmp/diff_new_pack.Z20Udv/_old  2014-12-21 12:04:11.000000000 +0100
+++ /var/tmp/diff_new_pack.Z20Udv/_new  2014-12-21 12:04:11.000000000 +0100
@@ -1,7 +1,7 @@
-From 88f929d2c17739e88eaed15fe22c6c898c7dde4d Mon Sep 17 00:00:00 2001
+From 077e65d1019edd4998b7af73b8934410c3e97bac Mon Sep 17 00:00:00 2001
 From: David Disseldorp <dd...@suse.de>
 Date: Wed, 27 Mar 2013 18:30:27 +0100
-Subject: [PATCH 4/7] iscsi: cancel conn worker threads using the task_pipe
+Subject: [PATCH 05/12] iscsi: cancel conn worker threads using the task_pipe
 
 Currently istgt_iscsi_drop_*_conns() use pthread_cancel() to tell the
 connection worker thread to exit. This is unnecessary, as the worker
@@ -11,7 +11,7 @@
  1 file changed, 16 insertions(+), 71 deletions(-)
 
 diff --git src/istgt_iscsi.c src/istgt_iscsi.c
-index 1ca226c..5fa5fbc 100644
+index 7f241d8..8a76379 100644
 --- src/istgt_iscsi.c
 +++ src/istgt_iscsi.c
 @@ -5260,9 +5260,8 @@ wait_all_task(CONN_Ptr conn)
@@ -25,7 +25,7 @@
        ISTGT_LU_Ptr lu;
        int rc;
  
-@@ -5534,9 +5533,6 @@ worker(void *arg)
+@@ -5538,9 +5537,6 @@ worker(void *arg)
        conn->exec_lu_task = NULL;
        lu_task = NULL;
  
@@ -35,7 +35,7 @@
        conn->use_sender = 0;
        if (conn->istgt->swmode >= ISTGT_SWMODE_NORMAL) {
                /* create sender thread */
-@@ -5585,7 +5581,6 @@ worker(void *arg)
+@@ -5589,7 +5585,6 @@ worker(void *arg)
                        }
                }
  
@@ -43,7 +43,7 @@
                if (conn->state != CONN_STATE_RUNNING) {
                        break;
                }
-@@ -5701,9 +5696,6 @@ worker(void *arg)
+@@ -5705,9 +5700,6 @@ worker(void *arg)
                execute_pdu:
                        opcode = BGET8W(&conn->pdu.bhs.opcode, 5, 6);
  
@@ -53,7 +53,7 @@
                        if (conn->state != CONN_STATE_RUNNING) {
                                break;
                        }
-@@ -5913,62 +5905,7 @@ worker(void *arg)
+@@ -5926,62 +5918,7 @@ worker(void *arg)
  
      cleanup_exit:
        ;
@@ -117,7 +117,7 @@
  
        return NULL;
  }
-@@ -6697,7 +6634,6 @@ istgt_iscsi_drop_all_conns(CONN_Ptr conn)
+@@ -6719,7 +6656,6 @@ istgt_iscsi_drop_all_conns(CONN_Ptr conn)
        istgt_yield();
        sleep(1);
        if (num > max_conns + 1) {
@@ -125,7 +125,7 @@
                for (i = 0; i < g_nconns; i++) {
                        xconn = g_conns[i];
                        if (xconn == NULL)
-@@ -6719,9 +6655,14 @@ istgt_iscsi_drop_all_conns(CONN_Ptr conn)
+@@ -6741,9 +6677,14 @@ istgt_iscsi_drop_all_conns(CONN_Ptr conn)
                                            xconn->initiator_addr,
                                            xconn->cid);
                                }
@@ -142,7 +142,7 @@
                                }
                        }
                }
-@@ -6781,7 +6722,6 @@ istgt_iscsi_drop_old_conns(CONN_Ptr conn)
+@@ -6803,7 +6744,6 @@ istgt_iscsi_drop_old_conns(CONN_Ptr conn)
        istgt_yield();
        sleep(1);
        if (num > max_conns + 1) {
@@ -150,7 +150,7 @@
                for (i = 0; i < g_nconns; i++) {
                        xconn = g_conns[i];
                        if (xconn == NULL)
-@@ -6803,9 +6743,14 @@ istgt_iscsi_drop_old_conns(CONN_Ptr conn)
+@@ -6825,9 +6765,14 @@ istgt_iscsi_drop_old_conns(CONN_Ptr conn)
                                            xconn->initiator_addr,
                                            xconn->cid);
                                }
@@ -168,5 +168,5 @@
                        }
                }
 -- 
-1.8.1.4
+2.1.2
 

++++++ istgt-20121028.tar.gz -> istgt-20141125.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/ChangeLog.jp 
new/istgt-20141125/ChangeLog.jp
--- old/istgt-20121028/ChangeLog.jp     2012-10-28 00:26:36.000000000 +0200
+++ new/istgt-20141125/ChangeLog.jp     2014-11-24 16:20:44.000000000 +0100
@@ -1,3 +1,23 @@
+2014/11/25
+       2014/11/25版
+       予約保持者からのキー変更の警告を出さないように変更
+       -fstack-protector をデフォルトに追加
+
+2014/11/22
+       2014/11/22版
+       登録キーの削除が正しく行えなかった問題を修正
+       予約キーが変更された場合に再設定するように変更
+       libmdを優先してリンクするように変更
+
+2012/11/23
+       LEN=0のSYNCHRONIZE_CACHEをスキップする問題を修正
+       (Thanks to Remi GUYOMARCH)
+
+2012/11/13
+       accept中に切断されたらエラーなしで再試行するように変更
+       スレッド待ちを作らないようにバックログを1に変更
+       スレッドを作成した後に起動する為の待ち時間を追加
+
 2012/10/28
        2012/10/28版
        MODE_SENSEでPC=01b(Changeable values)を返すように修正
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/README new/istgt-20141125/README
--- old/istgt-20121028/README   2012-10-15 23:40:18.000000000 +0200
+++ new/istgt-20141125/README   2014-11-22 15:14:21.000000000 +0100
@@ -1,4 +1,4 @@
-The iSCSI target for Debian/NetBSD/FreeBSD
+The iSCSI target for openSUSE/Debian/NetBSD/FreeBSD
 
 This software (istgt) is the implementation of iSCSI target
 (refer to RFC3720 about iSCSI) for FreeBSD 7.1 or later.
@@ -68,6 +68,7 @@
  o VirtualBox 4.x DSO (if use --with-vbox configure option)
 
 Tested Initiators:
+ o Microsoft Windows Server 2012 R2 (builtin)
  o Microsoft Windows Server 2008 (builtin)
  o Microsoft Windows Server 2008 R2 (builtin)
  o Microsoft Windows 7 Ultimate x64 (builtin)
@@ -92,6 +93,7 @@
  o FreeBSD 7.3 + iscsi 2.2.4
  o FreeBSD 8.2 + isboot 0.2.3
  o FreeBSD 9.1 + isboot 0.2.6
+ o FreeBSD 9.3 + isboot 0.2.8
  o CentOS 5.2 + Open-iSCSI (package)
  o Ubuntu 9.10 + Open-iSCSI (package)
  o gPXE 1.0.0 + VirtualBox 3.1.2 on FreeNAS 0.7.1
@@ -100,6 +102,7 @@
  o FreeNAS 0.7.2 (FreeBSD 7.3 + iscsi 2.2.4)
  o FreeNAS 0.7.5 (FreeBSD 9.0 + iscsi 2.3.1.0)
  o NAS4Free 9.1.0.1 (FreeBSD 9.1 + iscsi 2.3.1.0)
+ o NAS4Free 9.3.0.1 (FreeBSD 9.3 + iscsi 2.3.1.0)
 
 Features:
  o MCS/MPIO for failover (up to 255 concurrent sessions)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/configure new/istgt-20141125/configure
--- old/istgt-20121028/configure        2012-08-24 12:19:24.000000000 +0200
+++ new/istgt-20141125/configure        2014-11-24 16:20:44.000000000 +0100
@@ -3403,7 +3403,7 @@
        rcdir='/etc/rc.d'
 
        ;;
-*freebsd*)
+*dragonfly*|*freebsd*)
        tmp="/usr/ports/emulators/virtualbox-ose/work/*/include"
        if test -d "`echo $tmp`"; then
            vboxinc=$tmp
@@ -3472,7 +3472,51 @@
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5_Update in -lcrypto" 
>&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5Update in -lmd" >&5
+$as_echo_n "checking for MD5Update in -lmd... " >&6; }
+if ${ac_cv_lib_md_MD5Update+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmd  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MD5Update ();
+int
+main ()
+{
+return MD5Update ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_md_MD5Update=yes
+else
+  ac_cv_lib_md_MD5Update=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_md_MD5Update" >&5
+$as_echo "$ac_cv_lib_md_MD5Update" >&6; }
+if test "x$ac_cv_lib_md_MD5Update" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMD 1
+_ACEOF
+
+  LIBS="-lmd $LIBS"
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5_Update in 
-lcrypto" >&5
 $as_echo_n "checking for MD5_Update in -lcrypto... " >&6; }
 if ${ac_cv_lib_crypto_MD5_Update+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -3517,6 +3561,8 @@
 
 fi
 
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cam_open_spec_device in 
-lcam" >&5
 $as_echo_n "checking for cam_open_spec_device in -lcam... " >&6; }
 if ${ac_cv_lib_cam_cam_open_spec_device+:} false; then :
@@ -4728,6 +4774,32 @@
 
 
 
+# test for -fstack-protector
+saved_CFLAGS="$CFLAGS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler 
accepts -fstack-protector" >&5
+$as_echo_n "checking whether the C compiler accepts -fstack-protector... " 
>&6; }
+CFLAGS="$CFLAGS -fstack-protector"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }; saved_CFLAGS="$CFLAGS"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$saved_CFLAGS"
+
 # test for -Wall
 saved_CFLAGS="$CFLAGS"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler 
accepts -Wall" >&5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/configure.in 
new/istgt-20141125/configure.in
--- old/istgt-20121028/configure.in     2012-08-24 12:18:04.000000000 +0200
+++ new/istgt-20141125/configure.in     2014-11-24 16:20:44.000000000 +0100
@@ -39,7 +39,7 @@
        AC_SUBST([rctemplate], ["istgt_netbsd.sh.in"])
        AC_SUBST([rcdir], ['/etc/rc.d'])
        ;;
-*freebsd*)
+*dragonfly*|*freebsd*)
        tmp="/usr/ports/emulators/virtualbox-ose/work/*/include"
        if test -d "`echo $tmp`"; then
            vboxinc=$tmp
@@ -60,7 +60,8 @@
 
 # Checks for libraries.
 AC_CHECK_LIB([pthread], [pthread_create])
-AC_CHECK_LIB([crypto], [MD5_Update])
+AC_CHECK_LIB([md], [MD5Update], ,
+  [AC_CHECK_LIB([crypto], [MD5_Update])])
 AC_CHECK_LIB([cam], [cam_open_spec_device])
 
 # Checks for header files.
@@ -142,6 +143,15 @@
   esac])
 AC_SUBST([rcdir])
 
+# test for -fstack-protector
+saved_CFLAGS="$CFLAGS"
+AC_MSG_CHECKING([whether the C compiler accepts -fstack-protector])
+CFLAGS="$CFLAGS -fstack-protector"
+AC_TRY_COMPILE(,,
+  AC_MSG_RESULT(yes); saved_CFLAGS="$CFLAGS",
+  AC_MSG_RESULT(no))
+CFLAGS="$saved_CFLAGS"
+
 # test for -Wall
 saved_CFLAGS="$CFLAGS"
 AC_MSG_CHECKING([whether the C compiler accepts -Wall])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/Makefile.in 
new/istgt-20141125/src/Makefile.in
--- old/istgt-20121028/src/Makefile.in  2012-10-15 23:40:18.000000000 +0200
+++ new/istgt-20141125/src/Makefile.in  2014-11-22 15:03:24.000000000 +0100
@@ -88,8 +88,8 @@
        $(CC) $(LDFLAGS) -o $@ $(ISTGTCONTROL) $(LIBS)
 
 install: install-dirs
-       $(INSTALL) -m 0755 istgt $(DESTDIR)$(bindir)
-       $(INSTALL) -m 0755 istgtcontrol $(DESTDIR)$(bindir)
+       $(INSTALL) -s -m 0755 istgt $(DESTDIR)$(bindir)
+       $(INSTALL) -s -m 0755 istgtcontrol $(DESTDIR)$(bindir)
 
 install-dirs:
        $(MKDIR_P) $(DESTDIR)$(bindir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/config.h.in 
new/istgt-20141125/src/config.h.in
--- old/istgt-20121028/src/config.h.in  2012-08-19 06:51:15.000000000 +0200
+++ new/istgt-20141125/src/config.h.in  2014-11-22 15:03:24.000000000 +0100
@@ -57,6 +57,9 @@
 /* Define to 1 if you have the `crypto' library (-lcrypto). */
 #undef HAVE_LIBCRYPTO
 
+/* Define to 1 if you have the `md' library (-lmd). */
+#undef HAVE_LIBMD
+
 /* Define to 1 if you have the `pthread' library (-lpthread). */
 #undef HAVE_LIBPTHREAD
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt.c 
new/istgt-20141125/src/istgt.c
--- old/istgt-20121028/src/istgt.c      2012-08-27 22:19:22.000000000 +0200
+++ new/istgt-20141125/src/istgt.c      2012-11-12 19:44:24.000000000 +0100
@@ -2457,7 +2457,11 @@
                                rc = accept(fds[i].fd, (struct sockaddr *) &sa, 
&salen);
 #endif /* ISTGT_USE_KQUEUE */
                                if (rc < 0) {
-                                       ISTGT_ERRLOG("accept error: %d\n", rc);
+                                       if (errno == ECONNABORTED || errno == 
ECONNRESET) {
+                                               continue;
+                                       }
+                                       ISTGT_ERRLOG("accept error: 
%d(errno=%d)\n",
+                                           rc, errno);
                                        continue;
                                }
                                sock = rc;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt_iscsi.c 
new/istgt-20141125/src/istgt_iscsi.c
--- old/istgt-20121028/src/istgt_iscsi.c        2012-10-28 00:26:36.000000000 
+0200
+++ new/istgt-20141125/src/istgt_iscsi.c        2014-11-22 15:03:24.000000000 
+0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2012 Daisuke Aoyama <aoy...@peach.ne.jp>.
+ * Copyright (C) 2008-2014 Daisuke Aoyama <aoy...@peach.ne.jp>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -671,15 +671,15 @@
                now = time(NULL);
                if (errno == ECONNRESET) {
                        ISTGT_WARNLOG("Connection reset by peer (%s,time=%d)\n",
-                           conn->initiator_name, (int)difftime(now, start));
+                           conn->initiator_name, istgt_difftime(now, start));
                        conn->state = CONN_STATE_EXITING;
                } else if (errno == ETIMEDOUT) {
                        ISTGT_WARNLOG("Operation timed out (%s,time=%d)\n",
-                           conn->initiator_name, (int)difftime(now, start));
+                           conn->initiator_name, istgt_difftime(now, start));
                        conn->state = CONN_STATE_EXITING;
                } else {
                        ISTGT_ERRLOG("iscsi_read() failed 
(errno=%d,%s,time=%d)\n",
-                           errno, conn->initiator_name, (int)difftime(now, 
start));
+                           errno, conn->initiator_name, istgt_difftime(now, 
start));
                }
                return -1;
        }
@@ -763,7 +763,7 @@
                if (rc < 0) {
                        now = time(NULL);
                        ISTGT_ERRLOG("readv() failed 
(%d,errno=%d,%s,time=%d)\n",
-                           rc, errno, conn->initiator_name, (int)difftime(now, 
start));
+                           rc, errno, conn->initiator_name, 
istgt_difftime(now, start));
                        return -1;
                }
                if (rc == 0) {
@@ -1258,7 +1258,7 @@
                if (rc < 0) {
                        now = time(NULL);
                        ISTGT_ERRLOG("writev() failed (errno=%d,%s,time=%d)\n",
-                           errno, conn->initiator_name, (int)difftime(now, 
start));
+                           errno, conn->initiator_name, istgt_difftime(now, 
start));
                        return -1;
                }
                nbytes -= rc;
@@ -3592,7 +3592,7 @@
                                        ISTGT_ERRLOG("MCS: CmdSN(%u) error 
ExpCmdSN=%u "
                                            "(time=%d)\n",
                                            CmdSN, conn->sess->ExpCmdSN,
-                                           (int)difftime(now, start));
+                                           istgt_difftime(now, start));
                                        SESS_MTX_UNLOCK(conn);
                                        return -1;
                                }
@@ -5476,6 +5476,10 @@
 
        ISTGT_TRACELOG(ISTGT_TRACE_NET, "connect to %s:%s,%d\n",
            conn->portal.host, conn->portal.port, conn->portal.tag);
+#if 0
+       ISTGT_NOTICELOG("connect to %s:%s,%d\n",
+           conn->portal.host, conn->portal.port, conn->portal.tag);
+#endif
 
 #ifdef ISTGT_USE_KQUEUE
        kq = kqueue();
@@ -5743,6 +5747,15 @@
                                }
                        }
 
+#if 0
+                       if (opcode == ISCSI_OP_LOGIN) {
+                               //ISTGT_NOTICELOG("OP LOGIN: %s\n", 
conn->initiator_port);
+                               istgt_yield();
+                               if (conn->full_feature) {
+                                       //ISTGT_NOTICELOG("full_feature %s\n", 
conn->initiator_port);
+                               }
+                       }
+#endif
                        if (opcode == ISCSI_OP_LOGOUT) {
                                ISTGT_TRACELOG(ISTGT_TRACE_ISCSI, "logout 
received\n");
                                break;
@@ -6266,6 +6279,15 @@
        pthread_set_name_np(conn->thread, buf);
 #endif
 
+       /* XXX should use sleep loop? */
+       sleep(1);
+#if 0
+       /* wait the thread is running */
+       while (conn->state == CONN_STATE_INVALID) {
+               istgt_yield();
+       }
+#endif
+
        return 0;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt_lu_disk.c 
new/istgt-20141125/src/istgt_lu_disk.c
--- old/istgt-20121028/src/istgt_lu_disk.c      2012-10-28 00:26:36.000000000 
+0200
+++ new/istgt-20141125/src/istgt_lu_disk.c      2014-11-24 16:20:44.000000000 
+0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2012 Daisuke Aoyama <aoy...@peach.ne.jp>.
+ * Copyright (C) 2008-2014 Daisuke Aoyama <aoy...@peach.ne.jp>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -529,8 +529,11 @@
                spec->wait_lu_task = NULL;
 
                spec->npr_keys = 0;
+               /* spec is cleared, only pointer is handled */
                for (j = 0; j < MAX_LU_RESERVE; j++) {
                        spec->pr_keys[j].registered_initiator_port = NULL;
+                       spec->pr_keys[j].registered_target_port = NULL;
+                       spec->pr_keys[j].initiator_ports = NULL;
                }
                spec->pr_generation = 0;
                spec->rsv_port = NULL;
@@ -2717,15 +2720,21 @@
        int i, j;
 
        ISTGT_TRACELOG(ISTGT_TRACE_DEBUG,
-           "remove other prkey=0x%16.16"PRIx64", port=%s\n",
-           key, ((initiator_port != NULL) ? initiator_port : "N/A"));
+           "remove prkey=0x%16.16"PRIx64", iniport=%s, tgtport=%s\n",
+           key, ((initiator_port != NULL) ? initiator_port : "N/A"),
+           ((target_port != NULL) ? target_port : "N/A"));
 
-       for (i = 0; i < spec->npr_keys; i++) {
+       if (spec->npr_keys == 0)
+               return 0;
+
+       /* remove specified prkey from end of array */
+       for (i = spec->npr_keys - 1; i >= 0; i--) {
                prkey = &spec->pr_keys[i];
                if (prkey == NULL)
                        continue;
                if (key == 0 || prkey->key == key)
                        continue;
+               /* NULL means all initiator/target */
                if (initiator_port == NULL ||
                    strcasecmp(prkey->registered_initiator_port,
                        initiator_port) == 0)
@@ -2736,30 +2745,36 @@
                        target_port) == 0)
                        continue;
 
+               /* this prkey will remove */
                istgt_lu_disk_free_pr_key(prkey);
+               /* move used array */
                for (j = i; j < spec->npr_keys - 1; j++) {
                        prkey1 = &spec->pr_keys[j];
                        prkey2 = &spec->pr_keys[j+1];
-
-                       prkey1->registered_initiator_port
-                               = prkey2->registered_initiator_port;
-                       prkey2->registered_initiator_port = NULL;
-                       prkey1->registered_target_port
-                               = prkey2->registered_target_port;
-                       prkey2->registered_target_port = NULL;
-                       prkey1->pg_idx = prkey2->pg_idx;
-                       prkey2->pg_idx = 0;
-                       prkey1->pg_tag = prkey2->pg_tag;
-                       prkey2->pg_tag = 0;
-                       prkey1->ninitiator_ports = prkey2->ninitiator_ports;
-                       prkey2->ninitiator_ports = 0;
-                       prkey1->initiator_ports = prkey2->initiator_ports;
-                       prkey2->initiator_ports = NULL;
-                       prkey1->all_tpg = prkey2->all_tpg;
-                       prkey2->all_tpg = 0;
+                       *prkey1 = *prkey2;
                }
+               /* last array is cleared */
+               prkey1 = &spec->pr_keys[j];
+               memset(prkey1, 0, sizeof(*prkey1));
+               prkey1->registered_initiator_port = NULL;
+               prkey1->registered_target_port = NULL;
+               prkey1->initiator_ports = NULL;
+               /* update counts */
                spec->npr_keys--;
        }
+#ifdef ISTGT_TRACE_DISK
+       if (g_trace_flag) {
+               for (i = 0; i < spec->npr_keys; i++) {
+                       prkey = &spec->pr_keys[i];
+                       if (prkey == NULL)
+                               continue;
+                       ISTGT_TRACELOG(ISTGT_TRACE_DEBUG,
+                           "keylist: prkey=0x%16.16"PRIx64", iniport=%s, 
tgtport=%s\n",
+                           prkey->key, prkey->registered_initiator_port,
+                           prkey->registered_target_port);
+               }
+       }
+#endif /* ISTGT_TRACE_DISK */
        return 0;
 }
 
@@ -2770,15 +2785,21 @@
        int i, j;
 
        ISTGT_TRACELOG(ISTGT_TRACE_DEBUG,
-           "remove prkey=0x%16.16"PRIx64", port=%s\n",
-           key, ((initiator_port != NULL) ? initiator_port : "N/A"));
+           "remove prkey=0x%16.16"PRIx64", iniport=%s, tgtport=%s\n",
+           key, ((initiator_port != NULL) ? initiator_port : "N/A"),
+           ((target_port != NULL) ? target_port : "N/A"));
 
-       for (i = 0; i < spec->npr_keys; i++) {
+       if (spec->npr_keys == 0)
+               return 0;
+
+       /* remove specified prkey from end of array */
+       for (i = spec->npr_keys - 1; i >= 0; i--) {
                prkey = &spec->pr_keys[i];
                if (prkey == NULL)
                        continue;
                if (key != 0 && prkey->key != key)
                        continue;
+               /* NULL means all initiator/target */
                if (initiator_port != NULL
                    && strcasecmp(prkey->registered_initiator_port,
                        initiator_port) != 0)
@@ -2789,30 +2810,36 @@
                        target_port) != 0)
                        continue;
 
+               /* this prkey will remove */
                istgt_lu_disk_free_pr_key(prkey);
+               /* move used array */
                for (j = i; j < spec->npr_keys - 1; j++) {
                        prkey1 = &spec->pr_keys[j];
                        prkey2 = &spec->pr_keys[j+1];
-
-                       prkey1->registered_initiator_port
-                               = prkey2->registered_initiator_port;
-                       prkey2->registered_initiator_port = NULL;
-                       prkey1->registered_target_port
-                               = prkey2->registered_target_port;
-                       prkey2->registered_target_port = NULL;
-                       prkey1->pg_idx = prkey2->pg_idx;
-                       prkey2->pg_idx = 0;
-                       prkey1->pg_tag = prkey2->pg_tag;
-                       prkey2->pg_tag = 0;
-                       prkey1->ninitiator_ports = prkey2->ninitiator_ports;
-                       prkey2->ninitiator_ports = 0;
-                       prkey1->initiator_ports = prkey2->initiator_ports;
-                       prkey2->initiator_ports = NULL;
-                       prkey1->all_tpg = prkey2->all_tpg;
-                       prkey2->all_tpg = 0;
+                       *prkey1 = *prkey2;
                }
+               /* last array is cleared */
+               prkey1 = &spec->pr_keys[j];
+               memset(prkey1, 0, sizeof(*prkey1));
+               prkey1->registered_initiator_port = NULL;
+               prkey1->registered_target_port = NULL;
+               prkey1->initiator_ports = NULL;
+               /* update counts */
                spec->npr_keys--;
        }
+#ifdef ISTGT_TRACE_DISK
+       if (g_trace_flag) {
+               for (i = 0; i < spec->npr_keys; i++) {
+                       prkey = &spec->pr_keys[i];
+                       if (prkey == NULL)
+                               continue;
+                       ISTGT_TRACELOG(ISTGT_TRACE_DEBUG,
+                           "keylist: prkey=0x%16.16"PRIx64", iniport=%s, 
tgtport=%s\n",
+                           prkey->key, prkey->registered_initiator_port,
+                           prkey->registered_target_port);
+               }
+       }
+#endif /* ISTGT_TRACE_DISK */
        return 0;
 }
 
@@ -3145,9 +3172,12 @@
                                lu_cmd->status = 
ISTGT_SCSI_STATUS_RESERVATION_CONFLICT;
                                return -1;
                        }
+#if 0
+                       /* registrants can change the prkey */
                        if (g_trace_flag) {
                                ISTGT_WARNLOG("LU%d: duplicate reserve\n", 
spec->lu->num);
                        }
+#endif
                        lu_cmd->status = ISTGT_SCSI_STATUS_GOOD;
                        return 0;
                }
@@ -3705,6 +3735,9 @@
 
                /* register new key */
                prkey->key = sarkey;
+               /* replace existing reservation */
+               if (rkey != 0 && spec->rsv_key == rkey)
+                       spec->rsv_key = sarkey;
 
                /* command received port */
                prkey->registered_initiator_port = 
xstrdup(conn->initiator_port);
@@ -3714,6 +3747,11 @@
                prkey->pg_idx = conn->portal.idx;
                prkey->pg_tag = conn->portal.tag;
 
+               ISTGT_TRACELOG(ISTGT_TRACE_DEBUG,
+                   "Register Key:0x%16.16"PRIx64", InitiatorPort: %s, 
TargetPort: %s\n",
+                   prkey->key, prkey->registered_initiator_port,
+                   prkey->registered_target_port);
+
                /* specified ports */
                prkey->ninitiator_ports = nports;
                prkey->initiator_ports = initiator_ports;
@@ -4375,12 +4413,12 @@
        uint64_t nbytes;
        int64_t rc;
 
-       if (len == 0) {
-               return 0;
-       }
-
        maxlba = spec->blockcnt;
-       llen = (uint64_t) len;
+       if (len == 0 && lba < maxlba) {
+               llen = maxlba - lba;
+       } else {
+               llen = (uint64_t) len;
+       }
        blen = spec->blocklen;
        offset = lba * blen;
        nbytes = llen * blen;
@@ -4913,7 +4951,7 @@
        lun_i = istgt_lu_islun2lun(lu_cmd->lun);
        if (lun_i >= lu->maxlun) {
 #ifdef ISTGT_TRACE_DISK
-               ISTGT_ERRLOG("LU%d: LUN%4.4"PRIx64" invalid\n",
+               ISTGT_ERRLOG("LU%d: LUN%d invalid\n",
                    lu->num, lun_i);
 #endif /* ISTGT_TRACE_DISK */
                if (cdb[0] == SPC_INQUIRY) {
@@ -5290,7 +5328,7 @@
                                                ISTGT_ERRLOG("timeout 
trans_cond CmdSN=%u "
                                                    "(time=%d)\n",
                                                    lu_task->lu_cmd.CmdSN,
-                                                   (int)difftime(now, start));
+                                                   istgt_difftime(now, start));
                                                /* timeout */
                                                return -1;
                                        }
@@ -5327,7 +5365,7 @@
                                        lu_task->error = 1;
                                        now = time(NULL);
                                        ISTGT_ERRLOG("timeout trans_cond 
CmdSN=%u (time=%d)\n",
-                                           lu_task->lu_cmd.CmdSN, 
(int)difftime(now, start));
+                                           lu_task->lu_cmd.CmdSN, 
istgt_difftime(now, start));
                                        return -1;
                                }
                                lu_task->error = 1;
@@ -5492,7 +5530,7 @@
        lun_i = istgt_lu_islun2lun(lu_cmd->lun);
        if (lun_i >= lu->maxlun) {
 #ifdef ISTGT_TRACE_DISK
-               ISTGT_ERRLOG("LU%d: LUN%4.4"PRIx64" invalid\n",
+               ISTGT_ERRLOG("LU%d: LUN%d invalid\n",
                    lu->num, lun_i);
 #endif /* ISTGT_TRACE_DISK */
                if (cdb[0] == SPC_INQUIRY) {
@@ -6608,7 +6646,7 @@
                                len = spec->blockcnt;
                        }
                        ISTGT_TRACELOG(ISTGT_TRACE_SCSI,
-                           "SYNCHRONIZE_CACHE_10(lba %"PRIu64
+                           "SYNCHRONIZE_CACHE_16(lba %"PRIu64
                            ", len %u blocks)\n",
                            lba, len);
                        rc = istgt_lu_disk_lbsync(spec, conn, lu_cmd, lba, len);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt_md5.c 
new/istgt-20141125/src/istgt_md5.c
--- old/istgt-20121028/src/istgt_md5.c  2010-01-02 18:57:26.000000000 +0100
+++ new/istgt-20141125/src/istgt_md5.c  2014-11-22 15:03:24.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2010 Daisuke Aoyama <aoy...@peach.ne.jp>.
+ * Copyright (C) 2008-2014 Daisuke Aoyama <aoy...@peach.ne.jp>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,12 @@
 #include <stdint.h>
 
 #include <stddef.h>
+#ifdef HAVE_LIBMD
+#include <sys/types.h>
+#include <md5.h>
+#else
 #include <openssl/md5.h>
+#endif
 
 #include "istgt.h"
 #include "istgt_md5.h"
@@ -45,7 +50,12 @@
 
        if (md5ctx == NULL)
                return -1;
+#ifdef HAVE_LIBMD
+       MD5Init(&md5ctx->md5ctx);
+       rc = 1;
+#else
        rc = MD5_Init(&md5ctx->md5ctx);
+#endif
        return rc;
 }
 
@@ -56,7 +66,12 @@
 
        if (md5ctx == NULL || md5 == NULL)
                return -1;
+#ifdef HAVE_LIBMD
+       MD5Final(md5, &md5ctx->md5ctx);
+       rc = 1;
+#else
        rc = MD5_Final(md5, &md5ctx->md5ctx);
+#endif
        return rc;
 }
 
@@ -69,6 +84,11 @@
                return -1;
        if (data == NULL || len <= 0)
                return 0;
+#ifdef HAVE_LIBMD
+       MD5Update(&md5ctx->md5ctx, data, len);
+       rc = 1;
+#else
        rc = MD5_Update(&md5ctx->md5ctx, data, len);
+#endif
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt_md5.h 
new/istgt-20141125/src/istgt_md5.h
--- old/istgt-20121028/src/istgt_md5.h  2010-01-02 18:57:26.000000000 +0100
+++ new/istgt-20141125/src/istgt_md5.h  2014-11-22 15:03:24.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2010 Daisuke Aoyama <aoy...@peach.ne.jp>.
+ * Copyright (C) 2008-2014 Daisuke Aoyama <aoy...@peach.ne.jp>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,12 @@
 
 #include <stddef.h>
 
+#ifdef HAVE_LIBMD
+#include <sys/types.h>
+#include <md5.h>
+#else
 #include <openssl/md5.h>
+#endif
 
 #define ISTGT_MD5DIGEST_LEN MD5_DIGEST_LENGTH
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt_misc.c 
new/istgt-20141125/src/istgt_misc.c
--- old/istgt-20121028/src/istgt_misc.c 2012-07-29 01:00:11.000000000 +0200
+++ new/istgt-20141125/src/istgt_misc.c 2014-11-22 15:03:24.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2012 Daisuke Aoyama <aoy...@peach.ne.jp>.
+ * Copyright (C) 2008-2014 Daisuke Aoyama <aoy...@peach.ne.jp>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <syslog.h>
+#include <time.h>
 
 #include <unistd.h>
 
@@ -435,6 +436,15 @@
        data[7] = (value >> 0)  & 0xffULL;
 }
 
+int
+istgt_difftime(time_t a, time_t b)
+{
+       double d;
+       /* don't want floating-point format */
+       d = difftime(a, b);
+       return (int)d;
+}
+
 void
 istgt_dump(const char *label, const uint8_t *buf, size_t len)
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt_misc.h 
new/istgt-20141125/src/istgt_misc.h
--- old/istgt-20121028/src/istgt_misc.h 2010-05-15 09:35:39.000000000 +0200
+++ new/istgt-20141125/src/istgt_misc.h 2014-11-22 15:03:24.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2010 Daisuke Aoyama <aoy...@peach.ne.jp>.
+ * Copyright (C) 2008-2014 Daisuke Aoyama <aoy...@peach.ne.jp>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,7 @@
 #include <stdint.h>
 #include <stddef.h>
 #include <stdio.h>
+#include <time.h>
 
 #define ISTGT_USE_MACRO_EXPAND
 
@@ -186,6 +187,7 @@
 int istgt_hex2bin(uint8_t *data, size_t data_len, const char *str);
 
 /* other functions */
+int istgt_difftime(time_t a, time_t b);
 void istgt_dump(const char *label, const uint8_t *buf, size_t len);
 void istgt_fdump(FILE *fp, const char *label, const uint8_t *buf, size_t len);
 void istgt_yield(void);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt_sock.c 
new/istgt-20141125/src/istgt_sock.c
--- old/istgt-20121028/src/istgt_sock.c 2012-10-28 00:26:36.000000000 +0200
+++ new/istgt-20141125/src/istgt_sock.c 2012-11-12 19:44:24.000000000 +0100
@@ -173,7 +173,7 @@
                        continue;
                }
                /* bind OK */
-               rc = listen(sock, 2);
+               rc = listen(sock, 1);
                if (rc != 0) {
                        close(sock);
                        sock = -1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/istgt-20121028/src/istgt_ver.h 
new/istgt-20141125/src/istgt_ver.h
--- old/istgt-20121028/src/istgt_ver.h  2012-10-28 00:26:36.000000000 +0200
+++ new/istgt-20141125/src/istgt_ver.h  2014-11-24 16:20:44.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2012 Daisuke Aoyama <aoy...@peach.ne.jp>.
+ * Copyright (C) 2008-2014 Daisuke Aoyama <aoy...@peach.ne.jp>.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,6 @@
 #define ISTGT_VER_H
 
 #define ISTGT_VERSION "0.5"
-#define ISTGT_EXTRA_VERSION "20121028"
+#define ISTGT_EXTRA_VERSION "20141125"
 
 #endif /* ISTGT_VER_H */

++++++ lu-add-sense-data-to-out-of-range-read-and-write-err.patch ++++++
--- /var/tmp/diff_new_pack.Z20Udv/_old  2014-12-21 12:04:11.000000000 +0100
+++ /var/tmp/diff_new_pack.Z20Udv/_new  2014-12-21 12:04:11.000000000 +0100
@@ -1,7 +1,8 @@
-From 27cfa2b5fd417d6ba7cf72486c90e203314f569e Mon Sep 17 00:00:00 2001
+From 6beb4b34a2441dc4c3d5211ecb2fd01e35cde69b Mon Sep 17 00:00:00 2001
 From: David Disseldorp <dd...@suse.de>
 Date: Tue, 26 Mar 2013 18:56:32 +0100
-Subject: [PATCH 3/7] lu: add sense data to out of range read and write errors
+Subject: [PATCH 04/12] lu: add sense data to out of range read and write
+ errors
 
 ILLEGAL_REQUEST/LOGICAL BLOCK ADDRESS OUT OF RANGE.
 ---
@@ -9,10 +10,10 @@
  1 file changed, 19 insertions(+)
 
 diff --git src/istgt_lu_disk.c src/istgt_lu_disk.c
-index 277e8d2..807b47f 100644
+index 5ff5b09..2319a85 100644
 --- src/istgt_lu_disk.c
 +++ src/istgt_lu_disk.c
-@@ -4031,7 +4031,13 @@ istgt_lu_disk_lbread(ISTGT_LU_DISK *spec, CONN_Ptr conn 
__attribute__((__unused_
+@@ -4069,7 +4069,13 @@ istgt_lu_disk_lbread(ISTGT_LU_DISK *spec, CONN_Ptr conn 
__attribute__((__unused_
            maxlba, lba, len);
  
        if (lba >= maxlba || llen > maxlba || lba > (maxlba - llen)) {
@@ -26,7 +27,7 @@
                return -1;
        }
  
-@@ -4090,7 +4096,13 @@ istgt_lu_disk_lbwrite(ISTGT_LU_DISK *spec, CONN_Ptr 
conn, ISTGT_LU_CMD_Ptr lu_cm
+@@ -4128,7 +4134,13 @@ istgt_lu_disk_lbwrite(ISTGT_LU_DISK *spec, CONN_Ptr 
conn, ISTGT_LU_CMD_Ptr lu_cm
            maxlba, lba, len);
  
        if (lba >= maxlba || llen > maxlba || lba > (maxlba - llen)) {
@@ -40,7 +41,7 @@
                return -1;
        }
  
-@@ -4150,12 +4162,18 @@ istgt_lu_disk_lbwrite_same(ISTGT_LU_DISK *spec, 
CONN_Ptr conn, ISTGT_LU_CMD_Ptr
+@@ -4188,12 +4200,18 @@ istgt_lu_disk_lbwrite_same(ISTGT_LU_DISK *spec, 
CONN_Ptr conn, ISTGT_LU_CMD_Ptr
        uint64_t nblocks;
        uint64_t wblocks;
        int64_t rc;
@@ -59,7 +60,7 @@
                        return -1;
                }
                llen = maxlba - lba;
-@@ -4170,6 +4188,7 @@ istgt_lu_disk_lbwrite_same(ISTGT_LU_DISK *spec, CONN_Ptr 
conn, ISTGT_LU_CMD_Ptr
+@@ -4208,6 +4226,7 @@ istgt_lu_disk_lbwrite_same(ISTGT_LU_DISK *spec, CONN_Ptr 
conn, ISTGT_LU_CMD_Ptr
  
        if (lba >= maxlba || llen > maxlba || lba > (maxlba - llen)) {
                ISTGT_ERRLOG("end of media\n");
@@ -68,5 +69,5 @@
        }
  
 -- 
-1.8.1.4
+2.1.2
 

++++++ lu-perform-lba-range-check-before-0-byte-fastpath.patch ++++++
--- /var/tmp/diff_new_pack.Z20Udv/_old  2014-12-21 12:04:11.000000000 +0100
+++ /var/tmp/diff_new_pack.Z20Udv/_new  2014-12-21 12:04:11.000000000 +0100
@@ -1,7 +1,7 @@
-From 87d106f8ab70594bb6456122da9b1f9e0d5328c9 Mon Sep 17 00:00:00 2001
+From 4d04a693eb507540542b5a7005892c21f49afb82 Mon Sep 17 00:00:00 2001
 From: David Disseldorp <dd...@suse.de>
 Date: Tue, 26 Mar 2013 18:14:50 +0100
-Subject: [PATCH 2/7] lu: perform lba range check before 0 byte fastpath
+Subject: [PATCH 03/12] lu: perform lba range check before 0 byte fastpath
 
 0 byte IOs are subject to the same lba checks as normal IOs.
 ---
@@ -9,10 +9,10 @@
  1 file changed, 11 insertions(+), 11 deletions(-)
 
 diff --git src/istgt_lu_disk.c src/istgt_lu_disk.c
-index 2850955..277e8d2 100644
+index 9b58da3..5ff5b09 100644
 --- src/istgt_lu_disk.c
 +++ src/istgt_lu_disk.c
-@@ -4020,12 +4020,6 @@ istgt_lu_disk_lbread(ISTGT_LU_DISK *spec, CONN_Ptr conn 
__attribute__((__unused_
+@@ -4058,12 +4058,6 @@ istgt_lu_disk_lbread(ISTGT_LU_DISK *spec, CONN_Ptr conn 
__attribute__((__unused_
        uint64_t nbytes;
        int64_t rc;
  
@@ -25,7 +25,7 @@
        maxlba = spec->blockcnt;
        llen = (uint64_t) len;
        blen = spec->blocklen;
-@@ -4041,6 +4035,12 @@ istgt_lu_disk_lbread(ISTGT_LU_DISK *spec, CONN_Ptr conn 
__attribute__((__unused_
+@@ -4079,6 +4073,12 @@ istgt_lu_disk_lbread(ISTGT_LU_DISK *spec, CONN_Ptr conn 
__attribute__((__unused_
                return -1;
        }
  
@@ -38,7 +38,7 @@
        if (nbytes > lu_cmd->iobufsize) {
                ISTGT_ERRLOG("nbytes(%zu) > iobufsize(%zu)\n",
                    (size_t) nbytes, lu_cmd->iobufsize);
-@@ -4079,11 +4079,6 @@ istgt_lu_disk_lbwrite(ISTGT_LU_DISK *spec, CONN_Ptr 
conn, ISTGT_LU_CMD_Ptr lu_cm
+@@ -4117,11 +4117,6 @@ istgt_lu_disk_lbwrite(ISTGT_LU_DISK *spec, CONN_Ptr 
conn, ISTGT_LU_CMD_Ptr lu_cm
        uint64_t nbytes;
        int64_t rc;
  
@@ -50,7 +50,7 @@
        maxlba = spec->blockcnt;
        llen = (uint64_t) len;
        blen = spec->blocklen;
-@@ -4099,6 +4094,11 @@ istgt_lu_disk_lbwrite(ISTGT_LU_DISK *spec, CONN_Ptr 
conn, ISTGT_LU_CMD_Ptr lu_cm
+@@ -4137,6 +4132,11 @@ istgt_lu_disk_lbwrite(ISTGT_LU_DISK *spec, CONN_Ptr 
conn, ISTGT_LU_CMD_Ptr lu_cm
                return -1;
        }
  
@@ -63,5 +63,5 @@
                ISTGT_ERRLOG("nbytes(%zu) > iobufsize(%zu)\n",
                    (size_t) nbytes, lu_cmd->iobufsize);
 -- 
-1.8.1.4
+2.1.2
 

++++++ md5-add-in-tree-MD5-library.patch ++++++
>From 9d1f03c5c49d10306c73326c12953544ad443ad9 Mon Sep 17 00:00:00 2001
From: David Disseldorp <dd...@suse.de>
Date: Fri, 5 Apr 2013 16:08:07 +0200
Subject: [PATCH 06/12] md5: add in-tree MD5 library

This is a very small C library implementing RFC1321, the MD5 message
digest function. This 3-clause BSD licensed library is bundled with many
utilities, such as Heimdal, Android Bionic, BSD, etc.

Signed-off-by: David Disseldorp <dd...@suse.de>
---
 src/Makefile.in |   8 +-
 src/hash.h      |  68 ++++++++++++++
 src/md5.c       | 276 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/md5.h       |  55 +++++++++++
 4 files changed, 403 insertions(+), 4 deletions(-)
 create mode 100644 src/hash.h
 create mode 100644 src/md5.c
 create mode 100644 src/md5.h

diff --git src/Makefile.in src/Makefile.in
index a7f3b60..a35623e 100644
--- src/Makefile.in
+++ src/Makefile.in
@@ -38,18 +38,18 @@ source   = istgt.c istgt_iscsi.c istgt_iscsi_param.c \
        istgt_lu.c istgt_lu_disk.c istgt_lu_disk_vbox.c \
        istgt_lu_dvd.c istgt_lu_tape.c istgt_lu_pass.c istgt_lu_ctl.c \
        istgt_log.c istgt_conf.c istgt_sock.c istgt_misc.c \
-       istgt_queue.c istgt_crc32c.c istgt_md5.c
+       istgt_queue.c istgt_crc32c.c istgt_md5.c md5.c
 header   = istgt_ver.h istgt.h istgt_iscsi.h istgt_iscsi_param.h \
        istgt_scsi.h istgt_proto.h istgt_lu.h \
        istgt_log.h istgt_conf.h istgt_sock.h \
-       istgt_misc.h istgt_queue.h istgt_crc32c.h istgt_md5.h
+       istgt_misc.h istgt_queue.h istgt_crc32c.h istgt_md5.h md5.h
 document = 
 sample   = 
 
 ctl_source = istgtcontrol.c istgt_conf.c istgt_log.c istgt_sock.c istgt_misc.c 
\
-       istgt_md5.c
+       istgt_md5.c md5.c
 ctl_header = istgt_ver.h istgt_conf.h istgt_log.h istgt_sock.h istgt_misc.h \
-       istgt_md5.h
+       istgt_md5.h md5.h
 
 ISTGT    = $(source:.c=.o)
 ISTGTCONTROL = $(ctl_source:.c=.o)
diff --git src/hash.h src/hash.h
new file mode 100644
index 0000000..3b483f1
--- /dev/null
+++ src/hash.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska H�gskolan
+ * (Royal Institute of Technology, Stockholm, Sweden). 
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ *
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright 
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution. 
+ *
+ * 3. Neither the name of KTH nor the names of its contributors may be
+ *    used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+/* $Heimdal: hash.h,v 1.1 1999/03/22 19:16:25 joda Exp $
+   $NetBSD: hash.h,v 1.1.1.3 2002/09/12 12:41:42 joda Exp $ */
+
+/* stuff in common between md4, md5, and sha1 */
+
+#ifndef __hash_h__
+#define __hash_h__
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef min
+#define min(a,b) (((a)>(b))?(b):(a))
+#endif
+
+/* Vector Crays doesn't have a good 32-bit type, or more precisely,
+   int32_t as defined by <bind/bitypes.h> isn't 32 bits, and we don't
+   want to depend in being able to redefine this type.  To cope with
+   this we have to clamp the result in some places to [0,2^32); no
+   need to do this on other machines.  Did I say this was a mess?
+   */
+
+#ifdef _CRAY
+#define CRAYFIX(X) ((X) & 0xffffffff)
+#else
+#define CRAYFIX(X) (X)
+#endif
+
+static inline u_int32_t
+cshift (u_int32_t x, unsigned int n)
+{
+    x = CRAYFIX(x);
+    return CRAYFIX((x << n) | (x >> (32 - n)));
+}
+
+#endif /* __hash_h__ */
diff --git src/md5.c src/md5.c
new file mode 100644
index 0000000..4bbf5c5
--- /dev/null
+++ src/md5.c
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska H�gskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 
+ * 3. Neither the name of the Institute nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <endian.h>
+#include "md5.h"
+#include "hash.h"
+
+#define A m->counter[0]
+#define B m->counter[1]
+#define C m->counter[2]
+#define D m->counter[3]
+#define X data
+
+void
+MD5_Init (struct md5 *m)
+{
+  m->sz[0] = 0;
+  m->sz[1] = 0;
+  D = 0x10325476;
+  C = 0x98badcfe;
+  B = 0xefcdab89;
+  A = 0x67452301;
+}
+
+#define F(x,y,z) CRAYFIX((x & y) | (~x & z))
+#define G(x,y,z) CRAYFIX((x & z) | (y & ~z))
+#define H(x,y,z) (x ^ y ^ z)
+#define I(x,y,z) CRAYFIX(y ^ (x | ~z))
+
+#define DOIT(a,b,c,d,k,s,i,OP) \
+a = b + cshift(a + OP(b,c,d) + X[k] + (i), s)
+
+#define DO1(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,F)
+#define DO2(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,G)
+#define DO3(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,H)
+#define DO4(a,b,c,d,k,s,i) DOIT(a,b,c,d,k,s,i,I)
+
+static inline void
+calc (struct md5 *m, u_int32_t *data)
+{
+  u_int32_t AA, BB, CC, DD;
+
+  AA = A;
+  BB = B;
+  CC = C;
+  DD = D;
+
+  /* Round 1 */
+
+  DO1(A,B,C,D,0,7,0xd76aa478);
+  DO1(D,A,B,C,1,12,0xe8c7b756);
+  DO1(C,D,A,B,2,17,0x242070db);
+  DO1(B,C,D,A,3,22,0xc1bdceee);
+
+  DO1(A,B,C,D,4,7,0xf57c0faf);
+  DO1(D,A,B,C,5,12,0x4787c62a);
+  DO1(C,D,A,B,6,17,0xa8304613);
+  DO1(B,C,D,A,7,22,0xfd469501);
+
+  DO1(A,B,C,D,8,7,0x698098d8);
+  DO1(D,A,B,C,9,12,0x8b44f7af);
+  DO1(C,D,A,B,10,17,0xffff5bb1);
+  DO1(B,C,D,A,11,22,0x895cd7be);
+
+  DO1(A,B,C,D,12,7,0x6b901122);
+  DO1(D,A,B,C,13,12,0xfd987193);
+  DO1(C,D,A,B,14,17,0xa679438e);
+  DO1(B,C,D,A,15,22,0x49b40821);
+
+  /* Round 2 */
+
+  DO2(A,B,C,D,1,5,0xf61e2562);
+  DO2(D,A,B,C,6,9,0xc040b340);
+  DO2(C,D,A,B,11,14,0x265e5a51);
+  DO2(B,C,D,A,0,20,0xe9b6c7aa);
+
+  DO2(A,B,C,D,5,5,0xd62f105d);
+  DO2(D,A,B,C,10,9,0x2441453);
+  DO2(C,D,A,B,15,14,0xd8a1e681);
+  DO2(B,C,D,A,4,20,0xe7d3fbc8);
+
+  DO2(A,B,C,D,9,5,0x21e1cde6);
+  DO2(D,A,B,C,14,9,0xc33707d6);
+  DO2(C,D,A,B,3,14,0xf4d50d87);
+  DO2(B,C,D,A,8,20,0x455a14ed);
+
+  DO2(A,B,C,D,13,5,0xa9e3e905);
+  DO2(D,A,B,C,2,9,0xfcefa3f8);
+  DO2(C,D,A,B,7,14,0x676f02d9);
+  DO2(B,C,D,A,12,20,0x8d2a4c8a);
+
+  /* Round 3 */
+
+  DO3(A,B,C,D,5,4,0xfffa3942);
+  DO3(D,A,B,C,8,11,0x8771f681);
+  DO3(C,D,A,B,11,16,0x6d9d6122);
+  DO3(B,C,D,A,14,23,0xfde5380c);
+
+  DO3(A,B,C,D,1,4,0xa4beea44);
+  DO3(D,A,B,C,4,11,0x4bdecfa9);
+  DO3(C,D,A,B,7,16,0xf6bb4b60);
+  DO3(B,C,D,A,10,23,0xbebfbc70);
+
+  DO3(A,B,C,D,13,4,0x289b7ec6);
+  DO3(D,A,B,C,0,11,0xeaa127fa);
+  DO3(C,D,A,B,3,16,0xd4ef3085);
+  DO3(B,C,D,A,6,23,0x4881d05);
+
+  DO3(A,B,C,D,9,4,0xd9d4d039);
+  DO3(D,A,B,C,12,11,0xe6db99e5);
+  DO3(C,D,A,B,15,16,0x1fa27cf8);
+  DO3(B,C,D,A,2,23,0xc4ac5665);
+
+  /* Round 4 */
+
+  DO4(A,B,C,D,0,6,0xf4292244);
+  DO4(D,A,B,C,7,10,0x432aff97);
+  DO4(C,D,A,B,14,15,0xab9423a7);
+  DO4(B,C,D,A,5,21,0xfc93a039);
+
+  DO4(A,B,C,D,12,6,0x655b59c3);
+  DO4(D,A,B,C,3,10,0x8f0ccc92);
+  DO4(C,D,A,B,10,15,0xffeff47d);
+  DO4(B,C,D,A,1,21,0x85845dd1);
+
+  DO4(A,B,C,D,8,6,0x6fa87e4f);
+  DO4(D,A,B,C,15,10,0xfe2ce6e0);
+  DO4(C,D,A,B,6,15,0xa3014314);
+  DO4(B,C,D,A,13,21,0x4e0811a1);
+
+  DO4(A,B,C,D,4,6,0xf7537e82);
+  DO4(D,A,B,C,11,10,0xbd3af235);
+  DO4(C,D,A,B,2,15,0x2ad7d2bb);
+  DO4(B,C,D,A,9,21,0xeb86d391);
+
+  A += AA;
+  B += BB;
+  C += CC;
+  D += DD;
+}
+
+/*
+ * From `Performance analysis of MD5' by Joseph D. Touch <to...@isi.edu>
+ */
+#if !defined(__BYTE_ORDER) || !defined (__BIG_ENDIAN)
+#error __BYTE_ORDER macros not defined
+#endif
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+static inline u_int32_t
+swap_u_int32_t (u_int32_t t)
+{
+  u_int32_t temp1, temp2;
+
+  temp1   = cshift(t, 16);
+  temp2   = temp1 >> 8;
+  temp1  &= 0x00ff00ff;
+  temp2  &= 0x00ff00ff;
+  temp1 <<= 8;
+  return temp1 | temp2;
+}
+#endif
+
+struct x32{
+  unsigned int a:32;
+  unsigned int b:32;
+};
+
+void
+MD5_Update (struct md5 *m, const void *v, size_t len)
+{
+  const unsigned char *p = v;
+  size_t old_sz = m->sz[0];
+  size_t offset;
+
+  m->sz[0] += len * 8;
+  if (m->sz[0] < old_sz)
+      ++m->sz[1];
+  offset = (old_sz / 8)  % 64;
+  while(len > 0){
+    size_t l = min(len, 64 - offset);
+    memcpy(m->save + offset, p, l);
+    offset += l;
+    p += l;
+    len -= l;
+    if(offset == 64){
+#if __BYTE_ORDER == __BIG_ENDIAN
+      int i;
+      u_int32_t current[16];
+      struct x32 *u = (struct x32*)m->save;
+      for(i = 0; i < 8; i++){
+       current[2*i+0] = swap_u_int32_t(u[i].a);
+       current[2*i+1] = swap_u_int32_t(u[i].b);
+      }
+      calc(m, current);
+#else
+      calc(m, (u_int32_t*)m->save);
+#endif
+      offset = 0;
+    }
+  }
+}
+
+void
+MD5_Final (void *res, struct md5 *m)
+{
+  unsigned char zeros[72];
+  unsigned offset = (m->sz[0] / 8) % 64;
+  unsigned int dstart = (120 - offset - 1) % 64 + 1;
+
+  *zeros = 0x80;
+  memset (zeros + 1, 0, sizeof(zeros) - 1);
+  zeros[dstart+0] = (m->sz[0] >> 0) & 0xff;
+  zeros[dstart+1] = (m->sz[0] >> 8) & 0xff;
+  zeros[dstart+2] = (m->sz[0] >> 16) & 0xff;
+  zeros[dstart+3] = (m->sz[0] >> 24) & 0xff;
+  zeros[dstart+4] = (m->sz[1] >> 0) & 0xff;
+  zeros[dstart+5] = (m->sz[1] >> 8) & 0xff;
+  zeros[dstart+6] = (m->sz[1] >> 16) & 0xff;
+  zeros[dstart+7] = (m->sz[1] >> 24) & 0xff;
+  MD5_Update (m, zeros, dstart + 8);
+  {
+      int i;
+      unsigned char *r = (unsigned char *)res;
+
+      for (i = 0; i < 4; ++i) {
+         r[4*i]   = m->counter[i] & 0xFF;
+         r[4*i+1] = (m->counter[i] >> 8) & 0xFF;
+         r[4*i+2] = (m->counter[i] >> 16) & 0xFF;
+         r[4*i+3] = (m->counter[i] >> 24) & 0xFF;
+      }
+  }
+#if 0
+  {
+    int i;
+    u_int32_t *r = (u_int32_t *)res;
+
+    for (i = 0; i < 4; ++i)
+      r[i] = swap_u_int32_t (m->counter[i]);
+  }
+#endif
+}
diff --git src/md5.h src/md5.h
new file mode 100644
index 0000000..ade11cc
--- /dev/null
+++ src/md5.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1995 - 2001 Kungliga Tekniska H�gskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 
+ * 3. Neither the name of the Institute nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* $Heimdal: md5.h,v 1.8 2001/01/29 02:08:57 assar Exp $
+   $NetBSD: md5.h,v 1.1.1.4 2002/09/12 12:41:42 joda Exp $ */
+
+#ifndef MD5_H
+#define MD5_H
+
+#include <stdlib.h>
+#include <sys/types.h>
+
+struct md5 {
+  unsigned int sz[2];
+  u_int32_t counter[4];
+  unsigned char save[64];
+};
+
+typedef struct md5 MD5_CTX;
+
+void MD5_Init (struct md5 *m);
+void MD5_Update (struct md5 *m, const void *p, size_t len);
+void MD5_Final (void *res, struct md5 *m); /* u_int32_t res[4] */
+
+#endif /* MD5_H */
-- 
2.1.2

++++++ md5-use-in-tree-MD5-rather-than-libcrypto.patch ++++++
>From 0c5a66fd2d137897419a0b8340a15f2965d89380 Mon Sep 17 00:00:00 2001
From: David Disseldorp <dd...@suse.de>
Date: Fri, 5 Apr 2013 16:13:36 +0200
Subject: [PATCH 07/12] md5: use in-tree MD5 rather than libcrypto

Currently libcrypto (openssl) is linked purely for md5 calculation
utilities. Use the tiny in tree library instead, and do away with the
libcrypto dependency.

Signed-off-by: David Disseldorp <dd...@suse.de>
---
 configure       | 91 ---------------------------------------------------------
 configure.in    |  2 --
 src/istgt_md5.c | 40 +++++--------------------
 src/istgt_md5.h | 11 ++-----
 4 files changed, 10 insertions(+), 134 deletions(-)

diff --git configure configure
index 122aee3..83d3838 100755
--- configure
+++ configure
@@ -3472,97 +3472,6 @@ _ACEOF
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5Update in -lmd" >&5
-$as_echo_n "checking for MD5Update in -lmd... " >&6; }
-if ${ac_cv_lib_md_MD5Update+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmd  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char MD5Update ();
-int
-main ()
-{
-return MD5Update ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_md_MD5Update=yes
-else
-  ac_cv_lib_md_MD5Update=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_md_MD5Update" >&5
-$as_echo "$ac_cv_lib_md_MD5Update" >&6; }
-if test "x$ac_cv_lib_md_MD5Update" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBMD 1
-_ACEOF
-
-  LIBS="-lmd $LIBS"
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5_Update in 
-lcrypto" >&5
-$as_echo_n "checking for MD5_Update in -lcrypto... " >&6; }
-if ${ac_cv_lib_crypto_MD5_Update+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char MD5_Update ();
-int
-main ()
-{
-return MD5_Update ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_crypto_MD5_Update=yes
-else
-  ac_cv_lib_crypto_MD5_Update=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_MD5_Update" 
>&5
-$as_echo "$ac_cv_lib_crypto_MD5_Update" >&6; }
-if test "x$ac_cv_lib_crypto_MD5_Update" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCRYPTO 1
-_ACEOF
-
-  LIBS="-lcrypto $LIBS"
-
-fi
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cam_open_spec_device in 
-lcam" >&5
 $as_echo_n "checking for cam_open_spec_device in -lcam... " >&6; }
 if ${ac_cv_lib_cam_cam_open_spec_device+:} false; then :
diff --git configure.in configure.in
index 05c7eed..52e0af9 100644
--- configure.in
+++ configure.in
@@ -60,8 +60,6 @@ esac
 
 # Checks for libraries.
 AC_CHECK_LIB([pthread], [pthread_create])
-AC_CHECK_LIB([md], [MD5Update], ,
-  [AC_CHECK_LIB([crypto], [MD5_Update])])
 AC_CHECK_LIB([cam], [cam_open_spec_device])
 
 # Checks for header files.
diff --git src/istgt_md5.c src/istgt_md5.c
index 6148cb5..fae5024 100644
--- src/istgt_md5.c
+++ src/istgt_md5.c
@@ -33,62 +33,36 @@
 #include <stdint.h>
 
 #include <stddef.h>
-#ifdef HAVE_LIBMD
-#include <sys/types.h>
-#include <md5.h>
-#else
-#include <openssl/md5.h>
-#endif
 
 #include "istgt.h"
+#include "md5.h"
 #include "istgt_md5.h"
 
 int
 istgt_md5init(ISTGT_MD5CTX *md5ctx)
 {
-       int rc;
-
        if (md5ctx == NULL)
                return -1;
-#ifdef HAVE_LIBMD
-       MD5Init(&md5ctx->md5ctx);
-       rc = 1;
-#else
-       rc = MD5_Init(&md5ctx->md5ctx);
-#endif
-       return rc;
+       MD5_Init(&md5ctx->state);
+       return 0;
 }
 
 int
 istgt_md5final(void *md5, ISTGT_MD5CTX *md5ctx)
 {
-       int rc;
-
        if (md5ctx == NULL || md5 == NULL)
                return -1;
-#ifdef HAVE_LIBMD
-       MD5Final(md5, &md5ctx->md5ctx);
-       rc = 1;
-#else
-       rc = MD5_Final(md5, &md5ctx->md5ctx);
-#endif
-       return rc;
+       MD5_Final(md5, &md5ctx->state);
+       return 0;
 }
 
 int
 istgt_md5update(ISTGT_MD5CTX *md5ctx, const void *data, size_t len)
 {
-       int rc;
-
        if (md5ctx == NULL)
                return -1;
        if (data == NULL || len <= 0)
                return 0;
-#ifdef HAVE_LIBMD
-       MD5Update(&md5ctx->md5ctx, data, len);
-       rc = 1;
-#else
-       rc = MD5_Update(&md5ctx->md5ctx, data, len);
-#endif
-       return rc;
+       MD5_Update(&md5ctx->state, data, len);
+       return 0;
 }
diff --git src/istgt_md5.h src/istgt_md5.h
index 355efb4..cf80d62 100644
--- src/istgt_md5.h
+++ src/istgt_md5.h
@@ -30,17 +30,12 @@
 
 #include <stddef.h>
 
-#ifdef HAVE_LIBMD
-#include <sys/types.h>
-#include <md5.h>
-#else
-#include <openssl/md5.h>
-#endif
+#include "md5.h"
 
-#define ISTGT_MD5DIGEST_LEN MD5_DIGEST_LENGTH
+#define ISTGT_MD5DIGEST_LEN 16
 
 typedef struct istgt_md5ctx_t {
-       MD5_CTX md5ctx;
+       struct md5 state;
 } ISTGT_MD5CTX;
 
 int istgt_md5init(ISTGT_MD5CTX *md5ctx);
-- 
2.1.2

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to