debian/0000775000000000000000000000000012321772206007172 5ustar debian/rules0000775000000000000000000000042512265223165010255 0ustar #!/usr/bin/make -f #export DH_VERBOSE=1 CFLAGS = -Wall -g TGT_OPTIONS = FCOE=1 ISCSI=1 ISCSI_RDMA=1 CEPH_RBD=1 %: dh $@ --parallel --with bash-completion override_dh_auto_build: dh_auto_build -- $(TGT_OPTIONS) override_dh_auto_install: dh_auto_install -- $(TGT_OPTIONS) debian/upstart0000664000000000000000000000022412265223165010617 0ustar description "tgt daemon" start on runlevel [2345] stop on runlevel [!2345] expect fork respawn exec tgtd post-start exec /usr/sbin/tgt-admin -e debian/source/0000775000000000000000000000000012265251651010475 5ustar debian/source/format0000664000000000000000000000001412265223165011702 0ustar 3.0 (quilt) debian/bash-completion0000664000000000000000000000003412265223165012200 0ustar scripts/tgt.bashcomp.sh tgt debian/tests/0000775000000000000000000000000012265251651010337 5ustar debian/tests/daemon0000775000000000000000000000027412265223165011532 0ustar #!/bin/bash #------------ # Testing tgt #------------ set -e DAEMON=tgtd if pidof -x $DAEMON > /dev/null; then echo "OK" else echo "ERROR: ${DAEMON} IS NOT RUNNING" exit 1 fi debian/tests/control0000664000000000000000000000007012265223165011736 0ustar Tests: daemon admin Depends: @ Restrictions: needs-root debian/tests/admin0000775000000000000000000000031212265223165011350 0ustar #!/bin/bash #--------------- # Testing tgtadm #--------------- set -e ADMIN=tgtadm $ADMIN --help > /dev/null 2>&1 RET=$? if [[ $RET != 0 ]]; then echo "ERROR, ${ADMIN} is not running" exit $RET fi debian/compat0000664000000000000000000000000212265223165010372 0ustar 8 debian/copyright0000664000000000000000000000262112265223165011130 0ustar This package was debianized by Frederik Schüler on Tue, 07 Aug 2007 01:33:34 +0200. It was downloaded from http://stgt.berlios.de/releases/ Upstream Authors: Mike Christie FUJITA Tomonori Copyright: Copyright © 2005-2007 FUJITA Tomonori and Mike Christie Digest implementations for iSCSI are Copyright © 1995,1996,1998,1999,2001,2002,2003,2008 Free Software Foundation, Inc. License: This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU General Public License version 2 can be found in `/usr/share/common-licenses/GPL-2'. The Debian packaging is © 2007, Frederik Schüler and is licensed under the GPL, version 2 or (at your option) any later version. debian/init0000664000000000000000000000750412265223165010070 0ustar #!/bin/bash ### BEGIN INIT INFO # Provides: tgtd # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: zfs # Should-Stop: zfs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: iscsi target daemon # Description: iscsi target daemon ### END INIT INFO DESC="target framework daemon" NAME=tgtd DAEMON=/usr/sbin/${NAME} TGTD_CONFIG=/etc/tgt/targets.conf TASK=$1 . /lib/lsb/init-functions [ -x $DAEMON ] || exit 0 start() { log_daemon_msg "Starting $DESC" "$NAME" # Start tgtd first. tgtd &>/dev/null RETVAL=$? if [ "$RETVAL" -ne 0 ] ; then log_end_msg 1 exit 1 else log_end_msg 0 fi # Put tgtd into "offline" state until all the targets are configured. # We don't want initiators to (re)connect and fail the connection # if it's not ready. tgtadm --op update --mode sys --name State -v offline # Configure the targets. tgt-admin -e -c $TGTD_CONFIG # Put tgtd into "ready" state. tgtadm --op update --mode sys --name State -v ready } stop() { if [ "$RUNLEVEL" == 0 -o "$RUNLEVEL" == 6 ] ; then forcedstop fi log_daemon_msg "Stopping $DESC" "$NAME" # Remove all targets. It only removes targets which are not in use. tgt-admin --update ALL -c /dev/null &>/dev/null # tgtd will exit if all targets were removed tgtadm --op delete --mode system &>/dev/null RETVAL=$? if [ "$RETVAL" -eq 107 ] ; then if [ "$TASK" != "restart" ] ; then log_end_msg 1 exit 1 else log_end_msg 0 fi elif [ "$RETVAL" -ne 0 ] ; then log_end_msg 1 echo "Some initiators are still connected - could not stop tgtd" exit 2 else log_end_msg 0 fi echo -n } forcedstop() { # NOTE: Forced shutdown of the iscsi target may cause data corruption # for initiators that are connected. echo "Force-stopping target framework daemon" # Offline everything first. May be needed if we're rebooting, but # expect the initiators to reconnect cleanly when we boot again # (i.e. we don't want them to reconnect to a tgtd which is still # working, but the target is gone). tgtadm --op update --mode sys --name State -v offline &>/dev/null RETVAL=$? if [ "$RETVAL" -eq 107 ] ; then echo "tgtd is not running" [ "$TASK" != "restart" ] && exit 1 else tgt-admin --offline ALL # Remove all targets, even if they are still in use. tgt-admin --update ALL -c /dev/null -f # It will shut down tgtd only after all targets were removed. tgtadm --op delete --mode system RETVAL=$? if [ "$RETVAL" -ne 0 ] ; then echo "Failed to shutdown tgtd" exit 1 fi fi echo -n } reload() { log_daemon_msg "Reloading configuration of $DESC" "$NAME" # Update configuration for targets. Only targets which # are not in use will be updated. tgt-admin --update ALL -c $TGTD_CONFIG &>/dev/null RETVAL=$? if [ "$RETVAL" -eq 107 ] ; then log_end_msg 1 echo "tgtd is not running" exit 1 fi log_end_msg 0 } forcedreload() { log_daemon_msg "Forced-reload configuration of $DESC" "$NAME" # Update configuration for targets, even those in use. tgt-admin --update ALL -f -c $TGTD_CONFIG &>/dev/null RETVAL=$? if [ "$RETVAL" -eq 107 ] ; then log_end_msg 1 echo "tgtd is not running" exit 1 else log_end_msg 0 fi } status() { # Don't name this script "tgtd"... TGTD_PROC=$(ps -C tgtd | grep -c tgtd) if [ "$TGTD_PROC" -eq 2 ] ; then echo "tgtd is running. Run 'tgt-admin -s' to see detailed target info." else echo "tgtd is NOT running." fi } case $1 in start) start ;; stop) stop ;; forcedstop) forcedstop ;; restart) TASK=restart stop && start ;; forcedrestart) TASK=restart forcedstop && start ;; reload) reload ;; force-reload) forcedreload ;; status) status ;; *) echo "Usage: $0 {start|stop|forcedstop|restart|forcedrestart|reload|force-reload|status}" exit 2 ;; esac debian/control0000664000000000000000000000210212265223165010572 0ustar Source: tgt Section: net Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Kernel Team Uploaders: Frederik Schüler , Ben Hutchings Build-Depends: debhelper (>= 8~), libibverbs-dev, librdmacm-dev, librbd-dev, xsltproc, docbook-xsl, bash-completion Standards-Version: 3.9.4 Homepage: http://stgt.berlios.de/ XS-Testsuite: autopkgtest Package: tgt Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libconfig-general-perl, sg3-utils Description: Linux SCSI target user-space tools The Linux target framework (tgt) allows a Linux system to provide SCSI devices (targets) over networked SCSI transports. . Tgt consists of kernel modules, user-space daemon, and user-space This package contains the user-space daemon and tools; a recent Linux kernel is required for the modules. . This package includes drivers for: . - FCoE (Fibre Channel over Ethernet) - iSCSI (SCSI over IP) - iSER (iSCSI over RDMA, using Infiniband) . debian/watch0000664000000000000000000000007512265223165010227 0ustar version=3 https://github.com/fujita/tgt/tags .*/v(.*).tar.gz debian/changelog0000664000000000000000000002015012321772206011042 0ustar tgt (1:1.0.43-0ubuntu4) trusty; urgency=medium * debian/patches/fix_delayed_management_request.patch: Adjust patch to fix a FTBFS. * debian/patches/fix_leak_of_task_in_scsi_flag.patch: Adjust patch to fix a FTBFS. -- Chuck Short Fri, 11 Apr 2014 09:14:03 -0400 tgt (1:1.0.43-0ubuntu3) trusty; urgency=medium * Fix tgt connection issues under heavy load (LP: #1305343) - debian/patches/fix_delayed_management_request.patch: Fix a crash of tgtd which occured when removing a target with the --force option (https://github.com/fujita/tgt/commit/e6e8d0fd3b83208278fb7ed765c3665ae7c5ab49) - debian/patches/fix_leak_of_task_in_scsi_flag.patch: Clear task_in_scsi flag when exiting iscsi_tm_execute() and iser_tm_exec() functions. (https://github.com/fujita/tgt/commit/05fc2cb424863fbf2f3c60a8b617308ef1e370c5) -- Chuck Short Wed, 09 Apr 2014 19:35:20 -0400 tgt (1:1.0.43-0ubuntu2) trusty; urgency=medium * d/p/fix-config-regression.patch: Cherry picked fix from upstream VCS to resolve regression on configuration of control port. -- James Page Tue, 14 Jan 2014 15:11:35 +0000 tgt (1:1.0.43-0ubuntu1) trusty; urgency=medium * New upstream release. -- James Page Tue, 14 Jan 2014 12:05:08 +0000 tgt (1:1.0.41-0ubuntu1) trusty; urgency=low * New upstream release: - debian/patches/fix-tgt-admin-bashism: Dropped, included upstream. * d/control,rules,bash-completion: Enable bash completion support for tgt commands. -- James Page Mon, 11 Nov 2013 15:00:10 +0000 tgt (1:1.0.38-0ubuntu1) saucy; urgency=low * New upstream release: - d/p/include-rbd-docs.patch,example-config-use-conf-dot-dee: Dropped, included upstream. - Refreshed other patches. * d/watch: Really update to track github repository for releases. -- James Page Tue, 06 Aug 2013 17:38:27 +0100 tgt (1:1.0.37-0ubuntu1) saucy; urgency=low * Merge from Debian unstable: - d/control: Drop depends on lsb-base; handled by debhelper. * d/watch: Updated to track github upstream repository. * New upstream release (LP: #1191180): - d/control: Add xsltproc and docbook-xsl to BD's. - d/p: Refreshed and tidied patches. * Enable support for Ceph RBD backend: - d/rules: Add CEPH_RBD=1 to options. - d/control: Add BD on librbd-dev. - d/p/include-rbd-docs.patch: Include README.rbd docs. * Switch to debhelper compat level 8: - d/rules: Rewrite to use debhelper overrides. - d/compat,control: Bump compat level and minimum version requirement for debhelper. -- James Page Tue, 18 Jun 2013 13:08:34 +0100 tgt (1:1.0.17-1.1) unstable; urgency=low * Non-maintainer upload. * Adds an init script: - Depends: lsb-base - Adds dh_installinit call in debian/rules - adds debian/init -- Thomas Goirand Thu, 11 Apr 2013 23:25:08 +0800 tgt (1:1.0.17-1ubuntu4) saucy; urgency=low * d/tests: added dep-8-tests -- Yolanda Tue, 21 May 2013 10:41:18 +0200 tgt (1:1.0.17-1ubuntu3) quantal; urgency=low * Rebuild for new armel compiler default of ARMv5t. -- Colin Watson Mon, 08 Oct 2012 23:02:42 +0100 tgt (1:1.0.17-1ubuntu2) precise; urgency=low * change /etc/tgt/tgt.conf to support adding config.d format snippets in /etc/tgt/conf.d (LP: #978507) * start tgt on installation (LP: #977621) * stop tgt on shutdown (LP: #820699) -- Scott Moser Tue, 10 Apr 2012 23:11:00 -0400 tgt (1:1.0.17-1ubuntu1) oneiric; urgency=low * Merge from debian remaining changes: - debian/usptart: Add upstart job. - Dropped: - debian/patches/CVE-2011-0001.patch: No longer needed, use debian instead. -- Chuck Short Mon, 08 Aug 2011 04:45:03 -0400 tgt (1:1.0.17-1) unstable; urgency=low * New upstream release. -- Frederik Schüler Tue, 21 Jun 2011 11:44:56 +0200 tgt (1:1.0.4-3) unstable; urgency=high * iscsi: fix buffer overflow before login (CVE-2011-0001) -- Ben Hutchings Mon, 21 Mar 2011 03:32:59 +0000 tgt (1:1.0.13-0ubuntu3) oneiric; urgency=low * SECURITY UPDATE: denial of service and possible code execution via double free in iscsi_rx_handler function - debian/patches/CVE-2011-0001.patch: make sure the received data isn't larger than INCOMING_BUFSIZE in usr/iscsi/iscsid.c. - CVE-2011-0001 -- Marc Deslauriers Tue, 21 Jun 2011 09:01:03 -0400 tgt (1:1.0.13-0ubuntu2) natty; urgency=low * debian/upstart: Add respawn to upstart job. (LP: #715686) -- Chuck Short Mon, 14 Feb 2011 10:31:26 -0500 tgt (1:1.0.13-0ubuntu1) natty; urgency=low * New upstream release. * debian/patches/make-tgt-setup-lun-executable: Dropped no longer needed. -- Chuck Short Tue, 08 Feb 2011 10:31:04 -0500 tgt (1:1.0.4-2ubuntu1) natty; urgency=low * Merge from debian unstable. Remaining changes: - debian/upstart: Add upstart job. - Dropped: + debian/patches/scripts-tgt-admin: Use debian's instead. -- Chuck Short Fri, 10 Sep 2010 16:19:59 +0100 tgt (1:1.0.4-2) unstable; urgency=low * Fix bashism in tgt-admin, thanks to Chris Cheney (Closes: #589716) -- Ben Hutchings Sun, 05 Sep 2010 22:13:52 +0100 tgt (1:1.0.4-1ubuntu4) maverick; urgency=low * debian/upstart: Corrected typo with post-start command; Resolving "unknown job" error. (LP: #574554) -- Dave Walker (Daviey) Mon, 09 Aug 2010 23:49:42 +0100 tgt (1:1.0.4-1ubuntu3) maverick; urgency=low * tgtd target will not start unless it's configured with "allow-in-use yes" (LP: 605721) -- Chris Cheney Tue, 20 Jul 2010 04:29:56 -0500 tgt (1:1.0.4-1ubuntu2) maverick; urgency=low * debian/usptart: Add post-start exec to upstart script. (LP: #574554) -- Chuck Short Fri, 16 Jul 2010 10:47:33 -0400 tgt (1:1.0.4-1ubuntu1) maverick; urgency=low * debian/rules, debian/tgt.tgtd.upstart: Add upstart script. (LP: #574554) -- Chuck Short Thu, 17 Jun 2010 10:22:39 -0400 tgt (1:1.0.4-1) unstable; urgency=low * New upstream release. -- Frederik Schüler Wed, 05 May 2010 09:04:59 +0200 tgt (1:1.0.3-2) unstable; urgency=low * Fix Format string vulnerability CVE-2010-0743. (Closes: #576086) -- Frederik Schüler Tue, 13 Apr 2010 10:54:19 +0200 tgt (1:1.0.3-1) unstable; urgency=low * New upstream release. * Update Standards-Version to 3.8.4, no changes needed. * Drop patches/tgtadm-usage-metasyntax. * Add parallel build ability to debian/rules. * Add watch file. -- Frederik Schüler Mon, 29 Mar 2010 13:09:33 +0200 tgt (1:1.0.0-2) unstable; urgency=low * Depend on sg3-utils. (Closes: #565168) -- Frederik Schüler Tue, 19 Jan 2010 19:36:40 +0100 tgt (1:1.0.0-1) unstable; urgency=low * New upstream release. - Drop GPL digest patch, upstream has other implementation. * Add dependency on libconfig-general-perl. (Closes: #560710) * Build iSER driver, too. -- Frederik Schüler Thu, 24 Dec 2009 16:34:17 +0100 tgt (1:0.9.11-1) unstable; urgency=low [ Ben Hutchings ] * New upstream version (Closes: #501149) - Adds -D_GNU_SOURCE to compiler options (Closes: #526562) * Add myself to Uploaders * Fix syntax of usage messages (Closes: #493375) * Use GPL-compatible digest code instead of OpenSSL (Closes: #556294) * Update Standards-Version to 3.8.3 - Add Homepage field * Enable FCoE driver * Update package description - Fix grammar - Mention 'SCSI' in the short description - Update list of drivers [ Frederik Schüler ] * Switch to debhelper 7. -- Frederik Schüler Wed, 09 Dec 2009 10:29:39 +0100 tgt (20070924-1) unstable; urgency=low [ Frederik Schüler ] * Initial release (Closes: #436320) -- Frederik Schüler Mon, 24 Sep 2007 20:04:05 +0200 debian/patches/0000775000000000000000000000000012321767316010627 5ustar debian/patches/fix_delayed_management_request.patch0000664000000000000000000000125512321765224020070 0ustar Description: Fix leak of task for delayed management request Author: Chuck Short Forwaded: Not needed diff -Naurp tgt-1.0.43.orig/usr/iscsi/iscsid.c tgt-1.0.43/usr/iscsi/iscsid.c --- tgt-1.0.43.orig/usr/iscsi/iscsid.c 2014-01-07 07:16:21.000000000 -0500 +++ tgt-1.0.43/usr/iscsi/iscsid.c 2014-04-11 09:09:50.693973485 -0400 @@ -1428,6 +1428,11 @@ static int iscsi_tm_done(struct mgmt_req task->result = ISCSI_TMF_RSP_REJECTED; break; } + + if (task->conn->state == STATE_CLOSE) { + iscsi_free_task(task); + return 0; + } list_add_tail(&task->c_list, &task->conn->tx_clist); task->conn->tp->ep_event_modify(task->conn, EPOLLIN | EPOLLOUT); return 0; debian/patches/fix_leak_of_task_in_scsi_flag.patch0000664000000000000000000000072512321767316017644 0ustar Description: fix leak of task_in_scsi flag Author: Chuck Short Fowarded: Not Needed diff -Naurp tgt-1.0.43.orig/usr/target.c tgt-1.0.43/usr/target.c --- tgt-1.0.43.orig/usr/target.c 2014-01-07 07:16:21.000000000 -0500 +++ tgt-1.0.43/usr/target.c 2014-04-09 19:25:53.569907620 -0400 @@ -1454,7 +1454,7 @@ enum mgmt_req_result target_mgmt_request } if (err) - return err; + return MGMT_REQ_FAILED; else if (send) return MGMT_REQ_DONE; debian/patches/series0000664000000000000000000000016312321767304012041 0ustar conf-makefile fix-config-regression.patch fix_delayed_management_request.patch fix_leak_of_task_in_scsi_flag.patch debian/patches/conf-makefile0000664000000000000000000000123612265223165013250 0ustar Description: Install examples to /usr/share/doc/tgt By default they get installed to /etc/tgt Author: Unknown Forwarded: no --- a/conf/Makefile +++ b/conf/Makefile @@ -11,9 +11,9 @@ install: if [ ! -f $(DESTDIR)$(sysconfdir)/tgt/targets.conf ] ; then \ install -m 644 targets.conf $(DESTDIR)$(sysconfdir)/tgt ; \ fi - install -d -m 755 $(DESTDIR)$(sysconfdir)/tgt/examples + install -d -m 755 $(DESTDIR)/usr/share/doc/tgt/examples for f in $(EXAMPLES) ; do \ - install -m 644 examples/$$f $(DESTDIR)$(sysconfdir)/tgt/examples ;\ + install -m 644 examples/$$f $(DESTDIR)/usr/share/doc/tgt/examples ;\ done install -d $(DESTDIR)$(sysconfdir)/tgt/conf.d debian/patches/fix-config-regression.patch0000664000000000000000000000216612265251275016063 0ustar From e2cdfe52e221f11a67329efdee13c66429e94c18 Mon Sep 17 00:00:00 2001 From: Ryusuke Konishi Date: Sun, 12 Jan 2014 12:31:54 +0900 Subject: [PATCH] fix befd471ef7dcf46b regression control_port can be zero. Signed-off-by: FUJITA Tomonori --- usr/tgtadm.c | 2 +- usr/tgtd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/tgtadm.c b/usr/tgtadm.c index a46f1a4..7771119 100644 --- a/usr/tgtadm.c +++ b/usr/tgtadm.c @@ -600,7 +600,7 @@ int main(int argc, char **argv) ac_dir = ACCOUNT_TYPE_OUTGOING; break; case 'C': - rc = str_to_int_gt(optarg, control_port, 0); + rc = str_to_int_ge(optarg, control_port, 0); if (rc) bad_optarg(rc, ch, optarg); break; diff --git a/usr/tgtd.c b/usr/tgtd.c index 64eff32..50e1c83 100644 --- a/usr/tgtd.c +++ b/usr/tgtd.c @@ -537,7 +537,7 @@ int main(int argc, char **argv) is_daemon = 0; break; case 'C': - ret = str_to_int_gt(optarg, control_port, 0); + ret = str_to_int_ge(optarg, control_port, 0); if (ret) bad_optarg(ret, ch, optarg); break; -- 1.8.5.1