History log of /freebsd-current/usr.sbin/ctld/login.c
Revision Date Author Comments
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 7b02c1e8 18-Apr-2022 John Baldwin <jhb@FreeBSD.org>

iscsi: Fetch limits based on a socket rather than assuming global limits.

cxgbei needs the ability to return different limits based on the
connection (e.g. if the connection is over a T5 adapter or a T6
adapter as well as factoring in the MTU).

This change plumbs through the changes in the ioctls without changing
any of the backends. The limits callback passed to icl_register now
accepts a second socket argument which holds the integer file
descriptor. To support ABI compatiblity for old binaries, the
callback should return "global" values if the socket fd is zero.

The CTL_ISCSI_LIMITS argument used with CTL_ISCSI by ctld(8) now
accepts the socket fd in a field that was previously part of a
reserved spare field. Old binaries zero this request which results in
passing a socket fd of 0 to the limits callback.

The ISCSIDREQUEST ioctl no longer returns limits. Instead, iscsid(8)
invokes a new ISCSIDLIMITS ioctl after establishing the connection via
connect(2). For ABI compat, if the old ISCSIDREQUEST is invoked, the
global limits are still fetched (with a socket fd of 0) and returned.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34928


# 25700db3 22-Dec-2021 John Baldwin <jhb@FreeBSD.org>

libiscsiutil: Change keys_load/save to operate on data buffers.

This will be used in future changes to support large text requests
spanning multiple PDUs.

Provide wrapper functions keys_load/save_pdu that operate use a PDU's
data buffer.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D33547


# 63783933 22-Dec-2021 John Baldwin <jhb@FreeBSD.org>

Add an internal libiscsiutil library.

Move some of the code duplicated between ctld(8) and iscsid(8) into a
libiscsiutil library.

Sharing the low-level PDU code did require having a
'struct connection' base class with a method table to permit separate
initiator vs target behavior (e.g. in handling proxy PDUs).

Reviewed by: mav, emaste
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D33544


# 7ef7b252 26-Oct-2021 John Baldwin <jhb@FreeBSD.org>

ctld: Always declare MaxRecvDataSegmentLength.

This key is Declarative and should always be sent even if the
initiator did not send it's own limit. This is similar to the fix in
fc79cf4fea72 but for the target side. However, unlike that fix,
failure to send the key simply results in reduced performance.

PR: 259439
Reviewed by: mav, emaste
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32651


# bce7ee9d 28-Oct-2020 Edward Tomasz Napierala <trasz@FreeBSD.org>

Drop "All rights reserved" from all my stuff. This includes
Foundation copyrights, approved by emaste@. It does not include
files which carry other people's copyrights; if you're one
of those people, feel free to make similar change.

Reviewed by: emaste, imp, gbe (manpages)
Differential Revision: https://reviews.freebsd.org/D26980


# dae3a64f 26-Dec-2017 Eitan Adler <eadler@FreeBSD.org>

userland: Fix several typos and minor errors

- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by: imp, benno


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# 74864a1e 04-Nov-2017 Edward Tomasz Napierala <trasz@FreeBSD.org>

Use proper naming in a debug message.

MFC after: 2 weeks


# 7aceb7fc 14-Jan-2017 Alexander Motin <mav@FreeBSD.org>

Fix wrong way assignment in r312190.


# 59c6e3a5 14-Jan-2017 Alexander Motin <mav@FreeBSD.org>

Decouple iSCSI connection limits from defaults.

If initiator does not negotiate some parameter, it expects one to get
default value, not some unknown remote hardware limit. On the side side,
if some parameter is negotiated, its default value from RFC should not
be used for anything.


# 97b84d34 24-Aug-2016 Navdeep Parhar <np@FreeBSD.org>

Make the iSCSI parameter negotiation more flexible.

Decouple the send and receive limits on the amount of data in a single
iSCSI PDU. MaxRecvDataSegmentLength is declarative, not negotiated, and
is direction-specific so there is no reason for both ends to limit
themselves to the same min(initiator, target) value in both directions.

Allow iSCSI drivers to report their send, receive, first burst, and max
burst limits explicitly instead of using hardcoded values or trying to
derive all of them from the receive limit (which was the only limit
reported by the drivers prior to this change).

Display the send and receive limits separately in the userspace iSCSI
utilities.

Reviewed by: jpaetzel@ (earlier version), trasz@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D7279


# fd936afb 22-Jul-2016 Navdeep Parhar <np@FreeBSD.org>

ctld(8): Fix MaxBurstLength negotiation.

The target must reply with the selected value of MaxBurstSize instead of
just echoing back the initiator's offered value.

Reviewed by: mav@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D7278


# 2317fdfa 09-Jun-2016 Edward Tomasz Napierala <trasz@FreeBSD.org>

Don't cap FirstBurstLength to maximum MaxRecvDataSegmentLength claimed
by the offload driver; there is no reason to do so, and it actually
harms performance.

MFC after: 1 month


# 4e5408f1 05-Jun-2016 Edward Tomasz Napierala <trasz@FreeBSD.org>

Report negotiated MaxBurstLength and FirstBurstLength in "iscsictl -v"
and "ctladm islist -v" outputs.

MFC after: 1 month


# ec77f107 15-May-2016 Don Lewis <truckman@FreeBSD.org>

pdu_delete(request) frees request, so move the call after
login_new_response(request) to avoid a use-after-free error

Reported by: Coverity
Reviewed by: 1331219, 1331220


# c85285a9 12-Feb-2016 Alexander Motin <mav@FreeBSD.org>

Don't check CmdSN for initial login request.

This fixes connection errors for some initiators not starting CmdSN
from zero.

While there, fix wrong status details reported for couple errors.

MFC after: 3 days


# 860d3db9 13-Sep-2015 Alexander Motin <mav@FreeBSD.org>

Add negotiation of iSCSIProtocolLevel to 2 (RFC7144).

We may need to pass negotiated value to kernel level, but so far it is
not necessary, since it does not use any new features without request.


# d7f51860 08-Aug-2015 Alexander Motin <mav@FreeBSD.org>

Refactor early stages of security negotiation.

MFC after: 2 weeks


# 4462a604 08-Aug-2015 Alexander Motin <mav@FreeBSD.org>

Remove some code duplication.

MFC after: 1 week


# f249b52d 01-Jun-2015 Alexander Motin <mav@FreeBSD.org>

Fix bug in r278331: unlike some other options MaxRecvDataSegmentLength
is not negotiated as minimum, but only reported by sides to each other.

MFC after: 1 week


# aa32b5e0 27-Apr-2015 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make setproctitle(3) work in Capsicum capability mode. This makes
ctld(8) child processes to indicate initiator address and name in
their titles, similar to what iscsid(8) child processes do.

PR: 181352
Differential Revision: https://reviews.freebsd.org/D2363
Reviewed by: rwatson@, mjg@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# a7c4ad39 14-Apr-2015 Xin LI <delphij@FreeBSD.org>

Eliminate unused headers.


# a9d78210 27-Feb-2015 Edward Tomasz Napierala <trasz@FreeBSD.org>

Move the "offload" clause from the target section to portal-group
section; it makes more sense there.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 07b49a3e 06-Feb-2015 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make it possible to set (via ctl.conf(5)) and query (via ctladm islist -v)
target iSCSI offload. Add mechanism to query maximum receive data segment
size supported by chosen hardware offload module, and use it in ctld(8)
to determine the value to advertise to the other side.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 92847ee1 06-Feb-2015 Alexander Motin <mav@FreeBSD.org>

Add support for multiple portal groups per target.

This change allows multiple "portal-group" options to be specified per
target. Each of them may include new optional auth-group name parameter
to override per-target auth parameters for specific portal group.

Kernel side support was added earlier at r278161.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 3f9e1172 18-Dec-2014 Alexander Motin <mav@FreeBSD.org>

Slightly polish iSCSI parameters negotiation.

MFC after: 1 week


# 2124e3b0 17-Dec-2014 Alexander Motin <mav@FreeBSD.org>

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.

MFC after: 2 weeks


# 7889a083 09-Nov-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

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

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 6dbdbf82 09-Nov-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add support for sending redirections to iSCSI target.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 05374883 29-Oct-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add discovery-filter. This makes it possible to restrict which targets
are returned during discovery based on initiator portal, name, and CHAP
credentials.

Reviewed by: mav@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# e867e162 24-Oct-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make the initiator-name and initiator-portal checks a little nicer.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# ff982835 24-Oct-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Tidy up the login code; no functional changes.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 2bd28269 22-Oct-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Whitespace fixes.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 45078155 22-Oct-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Untangle iSCSI authentication code by splitting off the CHAP
implementation.

Reviewed by: mav@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation


# 2e779f74 09-Sep-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Use keys_add_int() where appropriate. No functional changes.

Sponsored by: The FreeBSD Foundation


# dce704a6 09-Sep-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

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
MFC after: 1 week
Sponsored by: The FreeBSD Foundation


# d6944036 05-Sep-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Fix typo.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


# b7a65e39 21-Aug-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make the iSCSI stack use __FBSDID() properly.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


# 073edb1c 27-Jul-2014 Alexander Motin <mav@FreeBSD.org>

Add netmasks support to initiator-portal option.

MFC after: 2 weeks


# 6d81c129 05-Jul-2014 Alexander Motin <mav@FreeBSD.org>

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.


# 63946680 16-Apr-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Use proper terminology in debug messages.

Sponsored by: The FreeBSD Foundation


# e6954b99 19-Mar-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make the error message more clear.

Sponsored by: The FreeBSD Foundation


# e76ce448 11-Feb-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

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


# f7ae5bf8 11-Feb-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Rename a variable, no functional changes.

Sponsored by: The FreeBSD Foundation


# 8cb2e958 11-Feb-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

Implement initiator-name and initiator-portal restrictions.

Sponsored by: The FreeBSD Foundation


# 017cbe4a 11-Feb-2014 Edward Tomasz Napierala <trasz@FreeBSD.org>

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


# b30f0d90 10-Dec-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

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


# 5989c4cc 09-Oct-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Plug memory leaks.

Coverity CID: 1087993, 1087992
Approved by: re (marius)
Sponsored by: FreeBSD Foundation


# 009ea47e 14-Sep-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Bring in the new iSCSI target and initiator.

Reviewed by: ken (parts)
Approved by: re (delphij)
Sponsored by: FreeBSD Foundation