Commit graph

83 commits

Author SHA1 Message Date
Warner Losh b144e70a33 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit fa9896e082)
2023-08-23 11:43:31 -06:00
Warner Losh 023fc80ee3 Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/

Similar commit in main:
(cherry picked from commit d0b2dbfa0e)
2023-08-23 11:43:30 -06:00
Warner Losh 3d497e17eb Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in main:
(cherry picked from commit 1d386b48a5)
2023-08-23 11:43:26 -06:00
Warner Losh 17da660ad5 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit b3e7694832)
2023-08-23 11:43:21 -06:00
Warner Losh caa41f6417 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

(cherry picked from commit 4d846d260e)
2023-07-25 09:13:49 -06:00
John Baldwin 73c8e321ad 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

(cherry picked from commit 7b02c1e8c6)
2022-11-10 13:48:36 -08:00
John Baldwin 263efa6c4a iscsid: Push #ifdef ICL_KERNEL_PROXY into cap_ioctl_limits list.
This reduces duplication in the two lists and makes it clearer which
ioctls are needed in the ICL_KERNEL_PROXY case.

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

(cherry picked from commit f0df722733)
2022-05-17 14:15:13 -07:00
John Baldwin 1d290d36d8 iscsi: Handle large Text responses.
Text requests and responses can span multiple PDUs.  In that case, the
sender sets the Continue bit in non-final PDUs and the Final bit in
the last PDU.  The receiver responds to non-final PDUs with an empty
text PDU.

To support this, add a more abstract API in libiscsi which accepts and
receives key sets rather than PDUs.  These routines internally send or
receive one or more PDUs.  Use these new functions to replace the
handling of TextRequest and TextResponse PDUs in discovery sessions in
both ctld and iscsid.

Note that there is not currently a use case for large Text requests
and those are still always sent as a single PDU.  However, discovery
sessions can return a text response listing targets that spans
multiple PDUs, so the new API supports sending and receiving multi-PDU
responses.

Reported by:	Jithesh Arakkan @ Chelsio
Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33548

(cherry picked from commit b406897911)
2022-04-29 14:17:43 -07:00
John Baldwin 06a67a1f05 iscsid: Always free the duplicated address in resolve_addr().
If a "raw" IPv6 address (denoted by a leading '[') is used as a target
address, then 'arg' is incremented by one to skip over the '['.
However, this meant that at the end of the function the wrong address
was passed to free().  With malloc junking enabled and given suitably
small strings, malloc() would happily overwrite the correct number of
bytes with junk, but off by one byte overwriting the byte after the
allocation.

This manifested as the first byte of the 'HeaderDigest' key being
overwritten causing the key name on the wire to be sent as
'\x5eaderDigest' which the target rejected.

Reported by:	Jithesh Arakkan @ Chelsio
Found with:	ASAN (via WITH_ASAN=yes)
Sponsored by:	Chelsio Communications

(cherry picked from commit c74ab5ce6f)
2022-04-29 14:17:30 -07:00
John Baldwin 54262b09e5 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

(cherry picked from commit 25700db366)
2022-04-29 14:15:45 -07:00
John Baldwin ec79933e61 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

(cherry picked from commit 6378393308)
2022-04-29 14:13:00 -07:00
Ed Maste 1da2deab7c iscsid: set max_recv_data_segment_length to what we advertise
Previously we updated the conection's conn_max_recv_data_segment_length
only when we received a response containing MaxRecvDataSegmentLength
from the target.  If the target did not send MaxRecvDataSegmentLength
then we left conn_max_recv_data_segment_length at the default (i.e.,
8192).  A target could then send more data than that defult (up to our
advertised maximum), and we would drop the connection.

RFC 7143 specifies that MaxRecvDataSegmentLength is Declarative, not
negotiated.  Just set conn_max_recv_data_segment_length to our
advertised value in login_negotiate().

PR:		259355
Reviewed by:	mav
MFC after:	1 week
Fixes:		a15fbc904a ("Alike to r312190 decouple iSCSI...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32605

(cherry picked from commit fc79cf4fea)
2021-11-03 16:47:11 -04:00
John Baldwin 90f0f8dab2 iscsid: Disable TCP DDP for connection sockets.
cxgbei is not able to offload PDU processing for a socket using TCP
DDP offload.

Sponsored by:	Chelsio Communications

(cherry picked from commit 91c62d626d)
2021-10-29 16:38:06 -07:00
Edward Tomasz Napierala a7972b4904 iscsid(8): fix memory leak by freeing the 'addr'
Reviewed By:	mav
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27328
2020-12-29 14:53:06 +00:00
Edward Tomasz Napierala 7db3d97e0f iscsid(8): free data allocated by getaddrinfo(3)
Reviewed By:	mav
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27329
2020-12-29 14:52:23 +00:00
Edward Tomasz Napierala bce7ee9d41 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
2020-10-28 13:46:11 +00:00
Richard Scheffenegger 4dfbcffbb9 Add network QoS support for PCP to iscsi initiator.
Make the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the initiator
side only.

Reviewed by:	mav, trasz, bcr
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26739
2020-10-24 21:07:13 +00:00
Alexander Motin 7dbbd1aeae Negotiate iSCSIProtocolLevel of 2 (RFC 7144) in initiator.
It does not change anything immediately, but allows further support of
Command Priority, Status Qualifier and new task management functions.

MFC after:	1 month
Sponsored by:	iXsystems, Inc.
2020-10-22 20:26:27 +00:00
Richard Scheffenegger bfabdade5c Add DSCP support for network QoS to iscsi initiator.
Allow the DSCP codepoint also to be configurable
for the traffic in the direction from the initiator
to the target, such that writes and any requests
are also treated in the appropriate QoS class.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26714
2020-10-09 14:33:09 +00:00
Edward Tomasz Napierala 5d9b05ac30 Fix string overflow that could occur during redirection due to passing
the wrong length to strlcpy(3). It looks like it could overflow into
the next field, isc_user, which is properly long to accomodate for it;
I don't think it could cause any harm other than breaking the connection.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26247
2020-09-01 14:52:35 +00:00
Edward Tomasz Napierala 1e89ef5dc1 Stop hardcoding WARNS in iscsid(8).
MFC after:	2 weeks
Sponsored by:	DARPA
2020-04-01 15:09:52 +00:00
Mariusz Zaborski 1489776d43 iscsi: simplify the capsicumization
Approved by:	trasz
Differential Revision:	https://reviews.freebsd.org/D17962
2018-11-30 19:40:16 +00:00
Edward Tomasz Napierala 827904b134 Add missing SPDX identifier in iscsid(8).
MFC after:	2 weeks
2018-01-24 16:34:37 +00:00
Pedro F. Giffuni 1de7b4b805 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.
2017-11-27 15:37:16 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Edward Tomasz Napierala aa21218504 Minor tweaks to iscsi(4) and iscsid(8).
MFC after:	2 weeks
2017-05-28 17:02:29 +00:00
Marcelo Araujo 56eeadd845 Use nitems() from sys/param.h.
MFC after:	3 weeks.
2017-03-11 04:03:13 +00:00
Enji Cooper 64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +00:00
Alexander Motin 625571de20 Remove ISCSI_MAX_DATA_SEGMENT_LENGTH, using negotiated value.
MFC after:	2 weeks
2017-01-20 17:14:10 +00:00
Alexander Motin a15fbc904a Alike to r312190 decouple iSCSI connection limits from defaults.
Connection parameters should remain at defaults until negotiated.

While there, remove sythetic limits, applied if kernel provided none.
iscsid has no own limitations, no configuration and no any idea what
values are good.  Assume kernel knows what it requests.
2017-01-14 20:41:44 +00:00
Navdeep Parhar 97b84d344d 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
2016-08-25 05:22:53 +00:00
Marcelo Araujo f3ccb446d2 Fix calloc(3) argument order.
Reviewed by:	trasz
MFC after:	4 weeks.
Differential Revision:	https://reviews.freebsd.org/D7532
2016-08-22 15:01:39 +00:00
Edward Tomasz Napierala 03b521d4dc Decouple MaxBurstLength and FirstBurstLength from MaxRecvDataSegmentLength
reported by the ICL module in iscsid(8).  This harmed performance and was
just wrong.

MFC after:	1 month
2016-06-09 07:49:20 +00:00
Edward Tomasz Napierala a863d33413 Build iscsid(8) with ICL_KERNEL_PROXY defined by default, as required
for iSER.

Obtained from:	Mellanox Technologies
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-23 12:58:24 +00:00
Edward Tomasz Napierala b7af91d012 When iscsid(8) is running in ICL proxy mode, don't try to send Logout PDUs.
The kernel already does this for us when we ask it to terminate the session.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-19 14:59:21 +00:00
Edward Tomasz Napierala 5abae79af4 Add initial support for negotiating iSER parameters to iscsid(8). Some
rework might be needed to support asymetrical limits, but this should be
ok for now.

Obtained from:	Mellanox Technologies (earlier version)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-17 07:54:53 +00:00
Glen Barber d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
Edward Tomasz Napierala 535bd9beaf Make fail() preserve the errno.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-15 11:10:08 +00:00
Edward Tomasz Napierala e19462c33b Use the log_errno value passed to the function instead of the errno global
variable.

Suggested by:	Daniel Braniss
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-15 11:03:45 +00:00
Glen Barber 7de1daeb93 Create packages for atm, ccdconfig, devd, ipf, ipfw,
iscsi, natd, nandfs, pf, quotacheck, and routed.

Add ping6 and rtsol to the runtime package.

Sponsored by:	The FreeBSD Foundation
2016-02-09 19:30:31 +00:00
Edward Tomasz Napierala 7aebc1bce2 Improve reporting of connection problems in iscsid(8).
Obtained from:	Mellanox Technologies
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-01-27 18:12:42 +00:00
Edward Tomasz Napierala 592d6e850a The <libutil.h> is an ordinary header file; should sort just like any other.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-01-24 18:11:36 +00:00
Bryan Drewery b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Edward Tomasz Napierala f015623182 Remove unneeded includes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-11-14 16:12:56 +00:00
Xin LI 61fa58e525 Remove a few unused headers.
MFC after:	2 weeks
2015-10-06 22:45:23 +00:00
Edward Tomasz Napierala 23bd2dd4a4 Use proper term in the ctld(8) and iscsid(8) man pages.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-09-03 11:43:56 +00:00
Edward Tomasz Napierala 424a3f57a2 Remove OpenSSL dependency from iscsid(8) and ctld(8).
Differential Revision:	https://reviews.freebsd.org/D2866
Submitted by:	Tony Morlan <tony at scroner.com> (earlier version)
Reviewed by:	bapt@, delphij@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-07-03 10:08:10 +00:00
Edward Tomasz Napierala c700f14ce5 Remove unused code.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-12 11:57:31 +00:00
Edward Tomasz Napierala 83f375616e The connection_new() routine was taking an absurd number of parameters; fix it.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-05 07:32:24 +00:00
Edward Tomasz Napierala 82babffba9 Make it possible to set (via iscsi.conf(5)) and query (via iscsictl -v)
initiator iSCSI offload.  Pass maximum data segment size supported by
chosen offload module to iscsid(8), and make iscsid(8) not try to negotiate
anything larger than that.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-05 06:37:59 +00:00