Commit Graph

187 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
9a95cfffd8 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
Edward Tomasz Napierala
a113ac0506 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
Edward Tomasz Napierala
8cab2ed4cd 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
Edward Tomasz Napierala
ba3a2d31c8 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
Edward Tomasz Napierala
19b59f13d8 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
Edward Tomasz Napierala
e6954b999d Make the error message more clear.
Sponsored by:	The FreeBSD Foundation
2014-03-19 13:00:44 +00:00
Robert Watson
b881b8be1d 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
Edward Tomasz Napierala
cadf3831b3 Make the debug messages during ctld(8) shutdown less confusing.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:38:44 +00:00
Edward Tomasz Napierala
6dc3a9f496 Show proper configuration file line numbers in error messages.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:37:49 +00:00
Edward Tomasz Napierala
e0fccc9806 Make ctld error out on invalid characters in ctl.conf.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:36:15 +00:00
Edward Tomasz Napierala
b3361aabc8 Improve error reporting.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:35:26 +00:00
Edward Tomasz Napierala
70b939ecd3 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
Edward Tomasz Napierala
e76ce4484d 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
Edward Tomasz Napierala
ccb1f04d95 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
Edward Tomasz Napierala
affb88f5a2 Update manual page to match recent auth-group "default" changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:29:58 +00:00
Edward Tomasz Napierala
e7977549f7 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
Edward Tomasz Napierala
252d941cc3 Make it possible to redefine portal-group "default".
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:27:25 +00:00
Edward Tomasz Napierala
df9900fb5b Add auth-type.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:26:05 +00:00
Edward Tomasz Napierala
f7ae5bf8de Rename a variable, no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:14:50 +00:00
Edward Tomasz Napierala
e1c0d0d8a3 Yacc cleanup; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:11:37 +00:00
Edward Tomasz Napierala
1658628dc6 Make function ordering slightly more logical; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:10:01 +00:00
Edward Tomasz Napierala
8cb2e95863 Implement initiator-name and initiator-portal restrictions.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:08:04 +00:00
Edward Tomasz Napierala
5d5a95f138 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
Edward Tomasz Napierala
017cbe4aaa 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
Edward Tomasz Napierala
1885dba7b1 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
Edward Tomasz Napierala
a19eebb1b7 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
Edward Tomasz Napierala
2fabfaa504 Refactor.
Sponsored by:	The FreeBSD Foundation
2014-02-11 10:53:08 +00:00
Edward Tomasz Napierala
b30f0d901a 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
Edward Tomasz Napierala
5292c670c2 Grammar fix.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2013-12-02 09:47:22 +00:00
Edward Tomasz Napierala
5d02cc7ff9 Fix typos.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2013-12-02 09:23:34 +00:00
Edward Tomasz Napierala
c095756f2e Fix typo.
Submitted by:	feld@
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2013-11-10 13:16:28 +00:00
Edward Tomasz Napierala
5989c4cc16 Plug memory leaks.
Coverity CID:	1087993, 1087992
Approved by:	re (marius)
Sponsored by:	FreeBSD Foundation
2013-10-09 13:28:45 +00:00
Edward Tomasz Napierala
1af403658b Fix off-by-one.
Coverity CID:	1011375
Approved by:	re (glebius)
Sponsored by:	FreeBSD Foundation
2013-10-09 12:17:40 +00:00
Edward Tomasz Napierala
7843bd031a 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
Edward Tomasz Napierala
c76e8a9aa0 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 Dahl
33e1779ab8 Minor mdoc fixes.
Approved by:	re (blanket)
2013-09-14 21:43:18 +00:00
Edward Tomasz Napierala
009ea47eb2 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