97 Commits

Author SHA1 Message Date
mav
b40b547aa1 MFC r268291:
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-15 17:05:11 +00:00
mav
3b926638cf MFC r267648:
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.
2014-07-04 16:17:15 +00:00
mav
2b0cbbb52b MFC r267606:
On discovery stage add set of TargetAddress keys to reply, reporting to
the client all the portal groups addresses and ports.
2014-07-02 10:18:42 +00:00
jpaetzel
79ef481e2b MFC: 267833
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-27 17:10:28 +00:00
trasz
73fdbcd002 MFC r264877:
Style fixes.

Sponsored by:	The FreeBSD Foundation
2014-05-07 08:00:59 +00:00
trasz
4dda47a3fa MFC r264535:
English.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:44:17 +00:00
trasz
854e04966d MFC r264534:
If we fail to create LUN, try again on next configuration reload.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:43:13 +00:00
trasz
db043740d7 MFC r264533:
Use consistent punctuation.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:41:58 +00:00
trasz
25fa6ec500 MFC r264532:
Use proper terminology in debug messages.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:40:45 +00:00
trasz
4eacdf9453 MFC r264531:
Constify.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:39:16 +00:00
trasz
21ec0cf2d0 MFC r264530:
Properly pass the initiator address when running in proxy mode.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:37:55 +00:00
trasz
a59839947c MFC r264529:
Use socket address from accept(2) instead of retrieving it via
getpeername(2).

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:36:46 +00:00
trasz
04b1f4adf5 MFC r264528:
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-05-07 07:35:21 +00:00
trasz
f2085cbf68 MFC r264526:
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-05-07 07:32:45 +00:00
trasz
690b7a7a12 MFC r264524:
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-05-07 07:29:39 +00:00
trasz
7420d3ad26 MFC r264500:
Stop treating LUN 0 as mandatory.  There is no reason to do that.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:28:23 +00:00
trasz
59337a66a6 MFC r263356:
Make the error message more clear.

Sponsored by:	The FreeBSD Foundation
2014-03-25 12:38:43 +00:00
trasz
4a35e9f814 MFC r261752:
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-03-25 12:33:16 +00:00
trasz
9a3c8da93d MFC r261751:
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-03-25 12:31:08 +00:00
trasz
b25383a8f9 MFC r261764:
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-03-25 12:24:18 +00:00
trasz
5fb75e3b8f MFC r261763:
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-03-25 12:22:30 +00:00
trasz
d3e539d4a4 MFC r261762:
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-03-25 12:20:29 +00:00
trasz
760d220cff MFC r261761:
Update manual page to match recent auth-group "default" changes.

Sponsored by:	The FreeBSD Foundation
2014-03-25 12:18:37 +00:00
trasz
60885b6065 MFC r261760:
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-03-25 12:16:52 +00:00
trasz
d57dc1f923 MFC r261759:
Make it possible to redefine portal-group "default".

Sponsored by:	The FreeBSD Foundation
2014-03-25 12:14:48 +00:00
trasz
47c8dbe543 MFC r261758:
Add auth-type.

Sponsored by:	The FreeBSD Foundation
2014-03-25 12:12:37 +00:00
trasz
b76fc2462a MFC r261757:
Rename a variable, no functional changes.

Sponsored by:	The FreeBSD Foundation
2014-03-25 12:10:30 +00:00
trasz
8783fbbc56 MFC r261756:
Yacc cleanup; no functional changes.

Sponsored by:	The FreeBSD Foundation
2014-03-25 12:08:35 +00:00
trasz
225da9bc73 MFC r261755:
Make function ordering slightly more logical; no functional changes.

Sponsored by:	The FreeBSD Foundation
2014-03-25 12:06:42 +00:00
trasz
c67809725b MFC r261754:
Implement initiator-name and initiator-portal restrictions.

Sponsored by:	The FreeBSD Foundation
2014-03-25 12:01:55 +00:00
trasz
cf1ffe3cac MFC r261753:
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-03-25 12:00:05 +00:00
trasz
930438f7d5 MFC r261750:
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-03-25 11:58:24 +00:00
trasz
57c5c94274 MFC r261749:
Refactor.

Sponsored by:	The FreeBSD Foundation
2014-03-25 11:53:47 +00:00
trasz
b76cdca91a MFC r261768:
Make the debug messages during ctld(8) shutdown less confusing.

Sponsored by:	The FreeBSD Foundation
2014-03-25 11:46:46 +00:00
trasz
68324fc037 MFC r261767:
Show proper configuration file line numbers in error messages.

Sponsored by:	The FreeBSD Foundation
2014-03-25 11:45:03 +00:00
trasz
e5c161c379 MFC r261766:
Make ctld error out on invalid characters in ctl.conf.

Sponsored by:	The FreeBSD Foundation
2014-03-25 11:43:09 +00:00
trasz
70b9e78e3d MFC r261765:
Improve error reporting.

Sponsored by:	The FreeBSD Foundation
2014-03-25 11:41:10 +00:00
trasz
77844c8786 MFC r259182:
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.

Sponsored by:	The FreeBSD Foundation
2013-12-13 15:23:07 +00:00
trasz
d3ef2c7747 MFC r258842:
Grammar fix.

Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
2013-12-05 16:29:22 +00:00
trasz
f6339a17f9 MFC r258841:
Fix typos.

Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
2013-12-05 16:14:56 +00:00
trasz
77d8ffb510 Fix typo.
Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
2013-11-14 12:14:27 +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