Commit Graph

96 Commits

Author SHA1 Message Date
mav
31fb601bdc MFC r274853:
For both iSCSI initiator and target increase socket buffer sizes before
establishing connection.

This is a workaround for Chelsio TOE driver, that does not update socket
buffer size in hardware after connection established, and unless that is
done beforehand, kernel code will stuck, attempting to send/receive full
PDU at once.
2015-02-19 14:28:47 +00:00
mav
4d95d689f3 MFC r274804:
In conf_apply() remove iSCSI ports from kernel before removing LUNs.

Previous order confused initiators with messages about "removed" LUNs
during simple ctld restart without any real config change.  After this
commit initiators only reestablish lost connection, receive "Power on
occurred" UNIT ATTENTION status and continue normal operation.
2015-02-19 14:26:49 +00:00
trasz
13678d19f2 MFC r274791:
Add missing error checking for kernel_port_{add,remove}().  Both can fail
for reasons yet unknown; don't make it increment cumulated_error as a kind
of temporary workaround.

MFC r275399:

Fix null pointer dereference.

Sponsored by:	The FreeBSD Foundation
2015-01-26 13:21:30 +00:00
mav
2952feb3ad MFC r275864: Make sequence numbers checks more strict.
While we don't support MCS, hole in received sequence numbers may mean
only PDU loss.  While we don't support lost PDU recovery, terminate the
connection to avoid stuck commands.

While there, improve handling of sequence numbers wrap after 2^32 PDUs.
2015-01-03 13:08:08 +00:00
trasz
8a977bdac7 MFC r274954:
Remove the pidfile clause from the ctl.conf example.  Why do everyone
just copy/paste this line into their configs, it's beyond me.

Sponsored by:	The FreeBSD Foundation
2015-01-01 15:45:22 +00:00
mav
270e05ae8c MFC r275925: Slightly polish iSCSI parameters negotiation. 2014-12-26 09:12:19 +00:00
mav
43c3b12592 MFC r275452: Do not corrupt the listen string when parsing it.
This fixes problem with ctld reload when it is configured to listen on two
portals with same IP, but different ports.
2014-12-10 08:53:41 +00:00
trasz
c131c42ed7 MFC r274310:
Add HISTORY section to ctld(8).

Sponsored by:	The FreeBSD Foundation
2014-12-09 11:52:36 +00:00
trasz
35a0788239 MFC r274308:
Add support for sending redirections to iSCSI target.

MFC r274309:

Fix several nits in redirection handling - don't use wrong CSG,
and avoid use-after-free.

Sponsored by:	The FreeBSD Foundation
2014-12-09 11:50:50 +00:00
trasz
379a1af59c MFC r274277:
ctld(8) doesn't require -lcam or -lssl; remove those from DPADD and LDADD.

Sponsored by:	The FreeBSD Foundation
2014-12-08 11:28:08 +00:00
mav
19732a0540 MFC r274248: Remove unused assignments, noticed by Clang analyzer. 2014-12-05 07:29:31 +00:00
trasz
1fc4976104 MFC r274278:
Improve wording in ctl.conf(5).

Sponsored by:	The FreeBSD Foundation
2014-11-29 16:01:44 +00:00
trasz
59965706b2 MFC r273822:
Fix iscsictl(8) and ctld(8) to correctly handle Windows newlines
(CRLF) in iscsi.conf and ctl.conf.

Sponsored by:	The FreeBSD Foundation
2014-11-29 15:39:31 +00:00
trasz
00cfd4605b MFC r273821:
Keep the token list sorted.

Sponsored by:	The FreeBSD Foundation
2014-11-29 15:37:51 +00:00
trasz
704c9e7b81 MFC r273820:
Make it possible to optionally use semicolon to separate statements.
This makes it possible to format stuff like this:

target xxx {
	lun 0 { path /foo/bar; size 4G; }
}

Sponsored by:	The FreeBSD Foundation
2014-11-29 15:36:10 +00:00
trasz
077d08af55 MFC r273816:
Simplify code; no functional changes.

Sponsored by:	The FreeBSD Foundation
2014-11-29 15:34:17 +00:00
trasz
aa126c68f3 MFC r273813:
Add discovery-filter.  This makes it possible to restrict which targets
are returned during discovery based on initiator portal, name, and CHAP
credentials.
2014-11-29 15:32:15 +00:00
trasz
43998423fb MFC r273770:
Fix build after previous commit.  While here, improve error messages.

Sponsored by:	The FreeBSD Foundation
2014-11-27 10:48:06 +00:00
trasz
863c0f84a8 MFC r273768:
Remove the distinction between strings and numbers from ctld(8) yacc parser.
This fixes problems with passing strings that look like numbers to clauses
that expect strings; previously it caused syntax errors and had to be worked
by user, using quotes.  The workaround introduced in r267833 is no longer
neccessary.

Sponsored by:	The FreeBSD Foundation
2014-11-27 10:45:55 +00:00
trasz
0f5dfd9d3d MFC r273585:
Improve ctld.conf example.

Sponsored by:	The FreeBSD Foundation
2014-11-24 08:09:50 +00:00
trasz
99d5e34563 MFC r273470:
Fix ctl.conf example to use proper paths to ZVOLs.

Sponsored by:	The FreeBSD Foundation
2014-11-24 08:06:29 +00:00
trasz
46ba63ac4f MFC r273467:
Comment out parts about iSER; it's not implemented.

Sponsored by:	The FreeBSD Foundation
2014-11-24 08:04:40 +00:00
trasz
6d3549321e MFC r273584:
Make the initiator-name and initiator-portal checks a little nicer.

Sponsored by:	The FreeBSD Foundation
2014-11-24 07:59:44 +00:00
trasz
3ffc9ed98b MFC 273583:
Tidy up the login code; no functional changes.

Sponsored by:	The FreeBSD Foundation
2014-11-24 07:57:18 +00:00
mav
a3fd5530e7 MFC r273635, r273793, r274797: Add basic iSNS client to the iSCSI target.
This makes ctld(8) register its iSCSI targets and portals on configured
iSNS servers to allow initiators find them without active discovery.

Fetching of allowed initiators from iSNS is not implemented now, so target
ACLs still should be configured manually.

Relnotes:	Yes
Sponsored by:	iXsystems, Inc.
2014-11-24 00:47:04 +00:00
mav
8ef35bbcf8 MFC r274328:
Make both iSCSI initiator and target support base64 encoded CHAP data.

While all tested initiators and targets use hex-encoded CHAP data, RFC also
allows base64 encoding there, and Microsoft certificaition tool uses it.
2014-11-23 04:17:39 +00:00
trasz
19b6e68597 MFC r273543:
Clean up (refactor) discovery a little; no functional changes.

Sponsored by:	The FreeBSD Foundation
2014-11-22 17:58:39 +00:00
trasz
340f150ff8 MFC r273468:
Remove misleading statement.  Bump date.

Sponsored by:	The FreeBSD Foundation
2014-11-22 17:56:03 +00:00
trasz
c6421981a9 MFC r273466:
Remove spurious empty line.

Sponsored by:	The FreeBSD Foundation
2014-11-22 17:54:11 +00:00
trasz
4844d3d80c MFC r273465:
Fix ctld(8) to not show the "auth-group <name> not assigned to any target"
warning for auth-groups assigned to a portal-group.

Sponsored by:	The FreeBSD Foundation
2014-11-22 17:52:33 +00:00
trasz
38906efd97 MFC r273464:
Whitespace fixes.

Sponsored by:	The FreeBSD Foundation
2014-11-22 17:50:14 +00:00
trasz
e89f2b0aad MFC r271320:
Use keys_add_int() where appropriate.  No functional changes.

Sponsored by:	The FreeBSD Foundation
2014-11-22 17:48:09 +00:00
trasz
071ca148ac MFC r273459:
Untangle iSCSI authentication code by splitting off the CHAP
implementation.

Sponsored by:	The FreeBSD Foundation
2014-11-22 17:39:39 +00:00
mav
b61a1b5706 MFC r272911:
Make ctld start even if some LUNs are unable to open backing storage.

Such LUNs will be visible to initiators, but return "not ready" status
on media access commands.  If backing storage become available later,
`ctladm modify ...` or `service ctld reload` can trigger its reopen.
2014-10-20 07:41:37 +00:00
mav
0c6538f05f MFC r271797: Make kernel to update LUN size from the backing storage
on configuration reload also if that size was not specified in the new
configuration.

Previously it happened only if size was explicitly changed in config.

Approved by:	re (delphij)
2014-09-21 13:09:05 +00:00
trasz
3f933e4c16 MFC r271571:
Fix two small nits in ctl.conf(5).

Approved by:	re (glebius)
Sponsored by:	The FreeBSD Foundation
2014-09-18 11:52:28 +00:00
allanjude
ddfed1e4ee MFC r271445,r271446,r271560:
Improve markup and language throughout the ctl.conf man page

MFC r271543:
Add the new iscsi(4) man page
Cross reference it from iscsid(8) and iscsictl(8)

Approved by:	re (gjb), bcr (mentor)
2014-09-18 03:02:00 +00:00
trasz
595559f064 MFC r271319:
Fix ctld(8) to not forget to send TargetPortalGroupTag and TargetAlias
when the initiator skips security negotiation.  This fixes interoperability
with Xtend SAN initiator.

PR:		193021
Approved by:	re (marius)
Sponsored by:	The FreeBSD Foundation
2014-09-17 07:06:02 +00:00
trasz
95a8c9b2ac MFC r271187:
Avoid ctld(8) crash on getaddrinfo(3) failure.

Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
2014-09-15 16:40:27 +00:00
trasz
0c1d52f3f7 MFC r271169:
Turn two errors, which are possible to trigger only by bugs,
into assertions.

Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
2014-09-15 14:21:57 +00:00
trasz
17ea2e1bc5 MFC r271157:
Fix typo.

Approved by:	re (marius)
Sponsored by:	The FreeBSD Foundation
2014-09-15 14:04:55 +00:00
ngie
b13059ee32 MFC r270179:
Add missing libraries to DPADD; sort DPADD so DPADD and LDADD match up

  This fixes "make checkdpadd"

  Approved by: jmmv (mentor)
  Phabric: D630
  PR: 192765
2014-09-02 16:14:16 +00:00
trasz
bd6edcc077 MFC r270279:
Make the iSCSI stack use __FBSDID() properly.

Sponsored by:	The FreeBSD Foundation
2014-08-31 20:21:08 +00:00
mav
f3589bc4f2 MFC r269183, r269191:
Add netmasks support to initiator-portal option.
2014-08-18 16:06:04 +00:00
wblock
d357493f14 MFC 268931:
Correct spelling errors in ctld.8.  While here, correct similar errors
in ctl.conf.5 and fix a couple of contractions.
2014-07-31 14:53:07 +00:00
mav
394f34f485 MFC r268795:
Fix ctld crash on startup if target alias is not set.
2014-07-20 07:35:00 +00:00
mav
100d0f0aa6 MFC r268328:
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-15 17:10:48 +00:00
mav
0468376762 MFC r268302:
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-15 17:07:07 +00:00
mav
f1200cac15 MFC r268293:
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-15 17:06:10 +00:00
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