History log of /freebsd/usr.sbin/ctld/ctld.c (Results 1 – 25 of 164)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b4a5ab97 24-Jan-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Factor out code to setup a listening socket into a separate function

While here:

- Reuse the address family from the addrinfo structure instead of
calling getsockname(2) on the socket.

- R

ctld: Factor out code to setup a listening socket into a separate function

While here:

- Reuse the address family from the addrinfo structure instead of
calling getsockname(2) on the socket.

- Remove a bogus comment about the PCP option.

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

show more ...


# dd360374 24-Jan-2025 John Baldwin <jhb@FreeBSD.org>

iscsi: Move valid_iscsi_name to libiscsiutil

While here, use isxdigit(3) instead of a home-rolled version.

Reviewed by: mav, asomers
Sponsored by: Chelsio Communications
Differential Revision: http

iscsi: Move valid_iscsi_name to libiscsiutil

While here, use isxdigit(3) instead of a home-rolled version.

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

show more ...


# 237e9b7f 18-Jan-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Trim trailing whitespace

Sponsored by: Chelsio Communications


# f26fe2c6 17-Jan-2025 Alan Somers <asomers@FreeBSD.org>

ctld: correctly parse LUN size on 32-bit arches

Disk offset values must always be 64-bit, not size_t.

PR: 214874
Submitted by: pprocacci@gmail.com
MFC after: 2 weeks
Event: January 2025 Bug-busti

ctld: correctly parse LUN size on 32-bit arches

Disk offset values must always be 64-bit, not size_t.

PR: 214874
Submitted by: pprocacci@gmail.com
MFC after: 2 weeks
Event: January 2025 Bug-busting session

show more ...


Revision tags: release/14.2.0, release/13.4.0
# 5f89aea7 07-Aug-2024 Alan Somers <asomers@FreeBSD.org>

ctld: fix several process setup/teardown bugs

All of the below bugs could result in a system where ctld is not
running, but LUNs and targets still exist in the kernel; a difficult
situation to recov

ctld: fix several process setup/teardown bugs

All of the below bugs could result in a system where ctld is not
running, but LUNs and targets still exist in the kernel; a difficult
situation to recover from.

* open the pidfile earlier. Open the pidfile before reading the
kernel's current state, so two racing ctld processes won't step on
each others' toes.

* close the pidfile later. Close it after tearing down the
configuration, for the same reason.

* If the configured pidfile changes, then rename it on SIGHUP rather
than remove and recreate it.

* When running in debug mode, don't close the pidfile while handling a
new connection. Only do that in non-debug mode, in the child of the
fork.

* Register signal handlers earlier. Otherwise a SIGTERM signal received
during startup could kill ctld without tearing down the configuration.

MFC after: 2 weeks
PR: 271460
Sponsored by: Axcient
Reviewed by: mav
Pull Request: https://github.com/freebsd/freebsd-src/pull/1370

show more ...


# 969876fc 11-Jun-2024 Alan Somers <asomers@FreeBSD.org>

ctld: parse config file independently of getting kernel info

Separate the parsing of the config file from the reading of kernel port
information. This has three benefits:

* Separation of concerns

ctld: parse config file independently of getting kernel info

Separate the parsing of the config file from the reading of kernel port
information. This has three benefits:

* Separation of concerns makes future changes easier.
* Allows the config file to be read earlier, which is necessary for
fixing PR 271460.
* Reduces total line count, by eliminating duplication between parse.y
(for traditional config file) and uclparse.c (for UCL config file).

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: mav
Pull Request: https://github.com/freebsd/freebsd-src/pull/1287

show more ...


# 2909ddd1 12-Jun-2024 Alan Somers <asomers@FreeBSD.org>

ctld: plug memory leaks

MFC after: 2 weeks
Reviewed by: mav
Sponsored by: Axcient
Reported by: valgrind
Pull Request: https://github.com/freebsd/freebsd-src/pull/1288


Revision tags: release/14.1.0, release/13.3.0, release/14.0.0
# 2391e536 09-Oct-2023 Alan Somers <asomers@FreeBSD.org>

Fix multiple bugs with ctld's UCL parsing

* Don't segfault when parsing a misformatted auth-group section
* If the config file specifies a chap section within a target but no
auth-group, create a

Fix multiple bugs with ctld's UCL parsing

* Don't segfault when parsing a misformatted auth-group section
* If the config file specifies a chap section within a target but no
auth-group, create a new anonymous auth-group. That matches the
behavior with non-UCL config files.
* Protect some potential segfaults with assertions

PR: 274380
MFC after: 1 week
Sponsored by: Axcient
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D43198

show more ...


# 4d65a7c6 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

usr.sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix

show more ...


# 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

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

show more ...


Revision tags: release/13.2.0, release/12.4.0
# 15b3e3bb 13-Oct-2022 Alan Somers <asomers@FreeBSD.org>

ctld: if adding a target fails, retry it on the next reload

If the admin creates more CTL ports than kern.cam.ctl.max_ports, then
adding some will fail. If he then removes some ports and does
"serv

ctld: if adding a target fails, retry it on the next reload

If the admin creates more CTL ports than kern.cam.ctl.max_ports, then
adding some will fail. If he then removes some ports and does
"service ctld reload", he would expect that the new ports would get
added in the newly-freed port space. But they don't, because ctld
assigned them port numbers during their first creation attempts.

Fix this bug by removing newly created ports from ctld's internal list
if the kernel rejects them for any reason. That way, a subsequent
config reload will attempt to add them again, possibly with new port
numbers.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: jhb, mav
Differential Revision: https://reviews.freebsd.org/D36974

show more ...


Revision tags: release/13.1.0
# 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 connect

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

show more ...


Revision tags: release/12.3.0
# 3b5f95d7 13-Sep-2021 John Baldwin <jhb@FreeBSD.org>

ctld: 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


Revision tags: release/13.0.0
# bdbc2a6f 29-Dec-2020 Alexander Motin <mav@FreeBSD.org>

Fix typo in an_initator_name.

MFC after: 1 week


# a3434cdc 29-Dec-2020 Alexander Motin <mav@FreeBSD.org>

Fix typo in ap_initator_portal.

MFC after: 1 week


# 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 peopl

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

show more ...


# ea8f1280 24-Oct-2020 Richard Scheffenegger <rscheff@FreeBSD.org>

Add network QoS support for PCP to iscsi target.

Mak the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the target
side only.

Re

Add network QoS support for PCP to iscsi target.

Mak the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the target
side only.

Reviewed by: mav, trasz, bcr
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26740

show more ...


Revision tags: release/12.2.0
# ba2548b7 01-Oct-2020 Edward Tomasz Napierala <trasz@FreeBSD.org>

Don't ignore the return value from gethostname(3). It probably
cannot happen, but it silences Coverity.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Diff

Don't ignore the return value from gethostname(3). It probably
cannot happen, but it silences Coverity.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26606

show more ...


# 64ffe6d4 27-Sep-2020 Richard Scheffenegger <rscheff@FreeBSD.org>

Add DSCP support for network QoS to iscsi target.

In order to prioritize iSCSI traffic across a network,
DSCP can be used. In order not to rely on "ipfw setdscp"
or in-network reclassification, this

Add DSCP support for network QoS to iscsi target.

In order to prioritize iSCSI traffic across a network,
DSCP can be used. In order not to rely on "ipfw setdscp"
or in-network reclassification, this adds the dscp value
directly to the portal group (where TCP sessions are accepted).

The incoming iSCSI session is first handled by ctld for any
CHAP authentication and the socket is then handed off to the
in-kernel iscsi driver without modification of the socket
parameters. Simply setting up the socket in ctld is sufficient
to keep sending outgoing iSCSI related traffic with the
configured DSCP value.

Reviewed by: mav, trasz
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D26385

show more ...


Revision tags: release/11.4.0
# 7fcbecd0 31-Mar-2020 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add 'ctld -t', to test configuration file validity.

Reviewed by: mav, allanjude, bcr (man pages)
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D23792


Revision tags: release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0
# 8951f055 10-May-2018 Marcelo Araujo <araujo@FreeBSD.org>

Rework CTL frontend & backend options to use nv(3), allow creating multiple
ioctl frontend ports.

This revision introduces two changes to CTL:
- Changes the way options are passed to CTL_LUN_REQ and

Rework CTL frontend & backend options to use nv(3), allow creating multiple
ioctl frontend ports.

This revision introduces two changes to CTL:
- Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls.
Removes ctl_be_arg structure and associated logic and replaces it with
nv(3)-based logic for passing in and out arguments.
- Allows creating multiple ioctl frontend ports using either ctladm(8) or
ctld(8).
New frontend ports are represented by /dev/cam/ctl<pp>.<vp> nodes, eg /dev/cam/ctl5.3.
Those device nodes respond only to CTL_IO ioctl.

New command-line options for ctladm:
# creates new ioctl frontend port with using free pp and vp=0
ctladm port -c
# creates new ioctl frontend port with pp=10 and vp=0
ctladm port -c -O pp=10
# creates new ioctl frontend port with pp=11 and vp=12
ctladm port -c -O pp=11 -O vp=12
# removes port with number 4 (it's a "targ_port" number, not pp number)
ctladm port -r -p 4

New syntax for ctl.conf:
target ... {
port ioctl/<pp>
...
}

target ... {
port ioctl/<pp>/<vp>
...

Note: Most of this work was made by jceel@, thank you.

Submitted by: jceel
Reworked by: myself
Reviewed by: mav (earlier versions and recently during the rework)
Obtained from: FreeNAS and TrueOS
Relnotes: Yes
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D9299

show more ...


# 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

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.

show more ...


Revision tags: release/10.4.0, release/11.1.0
# 9215e501 10-Apr-2017 Alexander Motin <mav@FreeBSD.org>

Do not register in CTL portal groups without portals.

From config synthax point of view such portal groups are not incorrect,
but they are useless since can not receive any connection. And since
CT

Do not register in CTL portal groups without portals.

From config synthax point of view such portal groups are not incorrect,
but they are useless since can not receive any connection. And since
CTL port resource is very limited, it is good to save it.

MFC after: 2 weeks

show more ...


# 8209d3fd 15-Jan-2017 Enji Cooper <ngie@FreeBSD.org>

MFhead@r312217


1234567