Commit Graph

106 Commits

Author SHA1 Message Date
mav
eb1bbc24aa Fix r269183 build woth GCC.
MFC after:	2 weeks
2014-07-28 14:32:20 +00:00
mav
658bca818f Add netmasks support to initiator-portal option.
MFC after:	2 weeks
2014-07-28 12:47:09 +00:00
wblock
f3bb5d8aca Correct spelling errors in ctld.8. While here, correct similar errors
in ctl.conf.5 and fix a couple of contractions.

PR:		191984
Submitted by:	olgeni
MFC after:	1 week
2014-07-20 22:13:51 +00:00
mav
e0b7e1e457 Fix ctld crash on startup if target alias is not set.
MFC after:	3 days
2014-07-17 11:38:37 +00:00
mav
ac68a20a27 Close race in r268291 between port destruction, delayed by sessions
teardown, and new port creation during `service ctld restart`.

Close it by returning iSCSI port internal state, that allows to identify
dying ports, which should not be counted as existing, from really alive.
2014-07-06 17:57:59 +00:00
mav
e3cec6db55 Pass through iSCSI session ISID from LOGIN request to the CTL frontend.
ISID is an important part of initiator transport ID for iSCSI.  It is not
used now, but should be to properly implement persistent reservation.
2014-07-05 21:18:33 +00:00
mav
dd9568e892 Burry devid port method, which was a gross hack.
Instead make ports provide wanted port and target IDs, and LUNs provide
wanted LUN IDs.  After that core Device ID VPD code only had to link all
of them together and add relative port and port group numbers.

LUN ID for iSCSI LUNs no longer created by CTL, but by ctld, and passed
to CTL as "scsiname" LUN option.  This makes LUNs to report the same set
of IDs, independently from the port through which it is accessed, as
required by SCSI specifications.
2014-07-05 19:30:20 +00:00
mav
4e932574fb Create separate CTL port for every iSCSI target (and maybe portal group).
Having single port for all iSCSI connections makes problematic implementing
some more advanced SCSI functionality in CTL, that require proper ports
enumeration and identification.

This change extends CTL iSCSI API, making ctld daemon to control list of
iSCSI ports in CTL.  When new target is defined in config fine, ctld will
create respective port in CTL.  When target is removed -- port will be
also removed after all active commands through that port properly aborted.
This change require ctld to be rebuilt to match the kernel.

As a minor side effect, this allows to have iSCSI targets without LUNs.
While that may look odd and not very useful, that is not incorrect.
2014-07-05 18:15:00 +00:00
jpaetzel
3211f93c4b Fix issues in config parser relating to lun serial numbers.
Without this fix some serial numbers needed to be quoted
to avoid the config parser bailing out.

Submitted by:	delphij
Sponsored by:	iXsystems
2014-06-24 19:12:55 +00:00
bapt
c0cd28f928 use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
mav
f13b1f8844 serial_num and device_id fields are not necessarily null-terminated.
Before this it was impossible to use all 16 bytes of serial number, and
client always got serial number NULL-terminated, that is not required.

MFC after:	2 weeks
2014-06-19 19:28:35 +00:00
mav
d8f7f85b0a On discovery stage add set of TargetAddress keys to reply, reporting to
the client all the portal groups addresses and ports.

Reviewed by:	trasz@
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2014-06-18 12:26:02 +00:00
trasz
7535bc4627 Style fixes. 2014-04-24 11:28:23 +00:00
trasz
18bde13fd9 English.
Sponsored by:	The FreeBSD Foundation
2014-04-16 11:07:29 +00:00
trasz
a926ac6eae If we fail to create LUN, try again on next configuration reload.
Sponsored by:	The FreeBSD Foundation
2014-04-16 11:06:45 +00:00
trasz
dcde441db6 Use consistent punctuation.
Sponsored by:	The FreeBSD Foundation
2014-04-16 11:05:57 +00:00
trasz
5094b33e15 Use proper terminology in debug messages.
Sponsored by:	The FreeBSD Foundation
2014-04-16 11:03:21 +00:00
trasz
6a793c73c6 Constify.
Sponsored by:	The FreeBSD Foundation
2014-04-16 11:01:59 +00:00
trasz
6c1910fb63 Properly pass the initiator address when running in proxy mode.
Sponsored by:	The FreeBSD Foundation
2014-04-16 11:00:10 +00:00
trasz
fdee78839e Use socket address from accept(2) instead of retrieving it via
getpeername(2).

Sponsored by:	The FreeBSD Foundation
2014-04-16 10:49:48 +00:00
trasz
b9b743fae9 Rework the way we enable CTL iSCSI port. Previously conf_apply()
needed it to be already enabled, because listening in proxy mode
requires it; however, it's conf_apply() that opens pidfiles,
so it resulted in port being enabled before pidfile was opened.
This was not so bad, but it was also disabled when pidfile couldn't
be opened due to ctld already running; this means that starting
second ctld instance screwed up the first.

Sponsored by:	The FreeBSD Foundation
2014-04-16 10:43:12 +00:00
trasz
9f88148032 Properly identify target portal when running in proxy mode. While here,
remove CTL_ISCSI_CLOSE, it wasn't used or implemented anyway.

Sponsored by:	The FreeBSD Foundation
2014-04-16 10:29:34 +00:00
trasz
6886f6fa4f Make it possible for the iSCSI target side to operate in both normal
and ICL_KERNEL_PROXY mode, and fix some bit rot so the latter actually
works again.

Sponsored by:	The FreeBSD Foundation
2014-04-16 10:06:37 +00:00
trasz
16b4ecc28d Stop treating LUN 0 as mandatory. There is no reason to do that.
Suggested by:	mav@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-04-15 14:55:56 +00:00
trasz
f1f4cd9f22 Make the error message more clear.
Sponsored by:	The FreeBSD Foundation
2014-03-19 13:00:44 +00:00
rwatson
a400e9c007 Update most userspace consumers of capability.h to use capsicum.h instead.
auditdistd is not updated as I will make the change upstream and then do a
vendor import sometime in the next week or two.

MFC after:	3 weeks
2014-03-16 11:04:44 +00:00
trasz
22da121a75 Make the debug messages during ctld(8) shutdown less confusing.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:38:44 +00:00
trasz
e1b3e5b339 Show proper configuration file line numbers in error messages.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:37:49 +00:00
trasz
a0a9d5e257 Make ctld error out on invalid characters in ctl.conf.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:36:15 +00:00
trasz
7ca282e9cb Improve error reporting.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:35:26 +00:00
trasz
35478760f6 So, it turns out SIGCHLD is discarded by default, so we have to set up
a dummy handler to make it interrupt an ioctl(2) or select(2).

This makes those short-lived ctld(8) zombies disappear.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:33:44 +00:00
trasz
d223366773 Use new auth-type "deny" instead of using "chap" with no chap entries;
it's cleaner this way, and gives better feedback to the user.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:32:36 +00:00
trasz
7f7fd0dbc0 Use "default" as default discovery-auth-group, instead of "no-access".
It doesn't change visible behaviour, as previously auth-group "default"
wasn't redefinable, so by default access was always denied.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:31:08 +00:00
trasz
87a841d29a Update manual page to match recent auth-group "default" changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:29:58 +00:00
trasz
e4d2947104 Add a new auth-group "default", defaulting to deny, and make it possible
to redefine it.  From now on, assigning auth-group to a target is no longer
mandatory.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:29:05 +00:00
trasz
7dbe2512bb Make it possible to redefine portal-group "default".
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:27:25 +00:00
trasz
f5f5c39110 Add auth-type.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:26:05 +00:00
trasz
e8652707f0 Rename a variable, no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:14:50 +00:00
trasz
5f228e3b08 Yacc cleanup; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:11:37 +00:00
trasz
760495fbd7 Make function ordering slightly more logical; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:10:01 +00:00
trasz
fec3636fbd Implement initiator-name and initiator-portal restrictions.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:08:04 +00:00
trasz
b84432b20c Daemonize after applying configuration, not before, so that
any problems - including "daemon already running" - are visible
on the terminal and not just in logs.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:59:57 +00:00
trasz
e4b6e911a2 Empty data segment during Login Phase is rather unlikely, but it's
not, by itself, a protocol error.  This fixes interoperability with
OpenBSD initiator.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:58:32 +00:00
trasz
1d16ec7cee The log_whatever() routines don't accept NULL for format strings,
so mark them as __printflike instead of__printf0like.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:56:43 +00:00
trasz
f0306f793f Improve check for duplicated paths. It shows the warning twice for
every path (once for each duplicate found), but it should do for now.

Sponsored by:	The FreeBSD Foundation
2014-02-11 10:55:32 +00:00
trasz
942aab7c51 Refactor.
Sponsored by:	The FreeBSD Foundation
2014-02-11 10:53:08 +00:00
trasz
9e76667e13 Fix handling for empty auth-groups. Without it, ctld child process
would either exit on assertion, or, if assertions are not enabled,
fail to authenticate the target.

MFC after:	2 days
Sponsored by:	The FreeBSD Foundation
2013-12-10 17:27:11 +00:00
trasz
6149217d80 Grammar fix.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2013-12-02 09:47:22 +00:00
trasz
e3b2accfd9 Fix typos.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2013-12-02 09:23:34 +00:00
trasz
c5a7ee0968 Fix typo.
Submitted by:	feld@
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2013-11-10 13:16:28 +00:00
trasz
33f6245f1b Plug memory leaks.
Coverity CID:	1087993, 1087992
Approved by:	re (marius)
Sponsored by:	FreeBSD Foundation
2013-10-09 13:28:45 +00:00
trasz
05bb4f6fbc Fix off-by-one.
Coverity CID:	1011375
Approved by:	re (glebius)
Sponsored by:	FreeBSD Foundation
2013-10-09 12:17:40 +00:00
trasz
84d8bf623b Fix several problems in the new iSCSI stack; this includes interoperability
fix for LIO (Linux target), removing possibility for the target to avoid mutual
CHAP by choosing to skip authentication altogether, and fixing truncated error
messages in iscsictl(8) output.  This also fixes several of the problems found
with Coverity.

Note that this change requires world rebuild.

Coverity CID:	1088038, 1087998, 1087990, 1088004, 1088044, 1088041, 1088040
Approved by:	re (blanket)
Sponsored by:	FreeBSD Foundation
2013-09-18 21:15:21 +00:00
trasz
2320759748 Make iscsictl(8) automatically try to load the iscsi module. While here,
improve module loading in iscsid(8) and ctld(8).

Approved by:	re (delphij)
2013-09-18 08:37:14 +00:00
joel
44f767ab70 Minor mdoc fixes.
Approved by:	re (blanket)
2013-09-14 21:43:18 +00:00
trasz
a992abf041 Bring in the new iSCSI target and initiator.
Reviewed by:	ken (parts)
Approved by:	re (delphij)
Sponsored by:	FreeBSD Foundation
2013-09-14 15:29:06 +00:00