History log of /src/usr.sbin/ctld/uclparse.cc (Results 1 – 25 of 39)
Revision Date Author Comments
# ab328f4e 07-Aug-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Catch exceptions by reference instead of by value

Reported by: GCC -Wcatch-value
Sponsored by: Chelsio Communications


# 66b5296f 06-Aug-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Add support for NVMe over Fabrics

While the overall structure is similar for NVMeoF controllers and
iSCSI targets, there are sufficient differences that NVMe support uses
an alternate configur

ctld: Add support for NVMe over Fabrics

While the overall structure is similar for NVMeoF controllers and
iSCSI targets, there are sufficient differences that NVMe support uses
an alternate configuration syntax.

- In authentication groups, permitted NVMeoF hosts can be allowed by
names (NQNs) via "host-nqn" values (similar to "initiator-name" for
iSCSI). Similarly, "host-address" accepts permitted host addresses
similar to "initiator-portal" for iSCSI.

- A new "transport-group" context enumerates transports that can be
used by a group of NVMeoF controllers similar to the "portal-group"
context for iSCSI. In this section, the "listen" keyword accepts a
transport as well as an address to permit other types of transports
besides TCP in the future. The "foreign", "offload", and "redirect"
keywords are also not meaningful and thus not supported.

- A new "controller" context describes an NVMeoF I/O controller
similar to the "target" context for iSCSI. One key difference here
is that "lun" objects are replaced by "namespace" objects. However,
a "namespace" can reference a named global lun permitting LUNs to be
shared between iSCSI targets and NVMeoF controllers.

NB: Authentication via CHAP is not implemented for NVMeoF.

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48773

show more ...


# 9a36ad4f 04-Aug-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Use scoped guards to finish configuration scopes in the UCL parser

Sponsored by: Chelsio Communications
Pull Request: https://github.com/freebsd/freebsd-src/pull/1794


# aea7fa72 04-Aug-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Switch to the C++ bindings for libucl

In particular, this permits using ranged-for loops to iterate over
keys in an object which is more readable.

Sponsored by: Chelsio Communications
Pull Re

ctld: Switch to the C++ bindings for libucl

In particular, this permits using ranged-for loops to iterate over
keys in an object which is more readable.

Sponsored by: Chelsio Communications
Pull Request: https://github.com/freebsd/freebsd-src/pull/1794

show more ...


# e01fe14c 04-Aug-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Make config file parsing exception safe

Split parse_conf in half keeping yyparse_conf as C-only function in
parse.y. parse_conf uses freebsd::FILE_up to ensure that the config
file is always

ctld: Make config file parsing exception safe

Split parse_conf in half keeping yyparse_conf as C-only function in
parse.y. parse_conf uses freebsd::FILE_up to ensure that the config
file is always closed.

Both parse_conf and uclparse_conf catch any exceptions thrown during
parsing. This is in preparation for using C++ objects allocated with
new for various data structures.

Note that this treats memory allocation failures from new as parsing
errors rather than ctld exiting entirely as it currently does if
malloc or calloc fail.

Sponsored by: Chelsio Communications
Pull Request: https://github.com/freebsd/freebsd-src/pull/1794

show more ...


# 34e8d664 04-Aug-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Rename {ctld,isns}.h to {ctld,isns}.hh

Subsequent commits will use C++ in these headers rather than only C.
conf.h remains as a C-only header since it is intended for use by the
C code generat

ctld: Rename {ctld,isns}.h to {ctld,isns}.hh

Subsequent commits will use C++ in these headers rather than only C.
conf.h remains as a C-only header since it is intended for use by the
C code generated from parse.y.

Sponsored by: Chelsio Communications
Pull Request: https://github.com/freebsd/freebsd-src/pull/1794

show more ...


# bf411567 11-Apr-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Properly validate mutual user/secret for CHAP-MUTUAL in the UCL parser

The code was checking the non-mutual UCL objects twice instead.

Sponsored by: Chelsio Communications
Differential Revisi

ctld: Properly validate mutual user/secret for CHAP-MUTUAL in the UCL parser

The code was checking the non-mutual UCL objects twice instead.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D49645

show more ...


# 251439f1 11-Apr-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Remove dead code in UCL parsing of hex DSCP values

libucl treats strings starting with "0x" as an integer if they do
not contain invalid characters. The code also looks broken as it
only call

ctld: Remove dead code in UCL parsing of hex DSCP values

libucl treats strings starting with "0x" as an integer if they do
not contain invalid characters. The code also looks broken as it
only calls strtol if the string exactly matches "0x" without any
trailing characters.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D49644

show more ...


# 839d0755 02-Apr-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Convert to C++

This is the minimal set of changes need to compile as C++ so git can
handle the rename correctly.

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revisio

ctld: Convert to C++

This is the minimal set of changes need to compile as C++ so git can
handle the rename correctly.

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D49139

show more ...


# 5b511473 26-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Permit simpler syntax for target LUNs in UCL

Allow the LUN number to be specified as the key for a LUN instead
of requiring it as a "number" field. If a key is used, permit
a simple string va

ctld: Permit simpler syntax for target LUNs in UCL

Allow the LUN number to be specified as the key for a LUN instead
of requiring it as a "number" field. If a key is used, permit
a simple string value to be used for non-anymous LUNs. This permits
replacing:

lun = [
{ number = 0, name = zvol_lun },
{
number = 1
backend = ramdisk
size = 1GB
}
]

with:

lun = {
0 = zvol_lun
1 {
backend = ramdisk
size = 1GB
}
}

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48939

show more ...


# e49db000 26-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Permit targets to use a string for portal-groups in UCL

In the case that a separate auth-group is not required, this permits
replacing:

portal-group = { name = pg0 }

with:

portal-group =

ctld: Permit targets to use a string for portal-groups in UCL

In the case that a separate auth-group is not required, this permits
replacing:

portal-group = { name = pg0 }

with:

portal-group = pg0

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48938

show more ...


# b797cc83 26-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Support anonymous LUN entries in UCL

If a target LUN entry doesn't have a name property, assume it is an
anonymous LUN and parse other properties from the entry to define the
LUN.

This remove

ctld: Support anonymous LUN entries in UCL

If a target LUN entry doesn't have a name property, assume it is an
anonymous LUN and parse other properties from the entry to define the
LUN.

This removes the odd support for target LUNs only named by an integer.
My guess is this was meant to implement support for anonymous LUNs
based on how the syntax for this works in the non-UCL case, but the
prior implementation was useless (it just created unconfigured LUNs).

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48937

show more ...


# 67940b20 26-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Add missing properties to the UCL parser

- Support for "foreign", "offload", and "tag" properties in portal
group contexts.

- Support for "ctl-lun" and "device-type" properties in LUN conte

ctld: Add missing properties to the UCL parser

- Support for "foreign", "offload", and "tag" properties in portal
group contexts.

- Support for "ctl-lun" and "device-type" properties in LUN contexts.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48936

show more ...


# e28b758b 26-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Be more consistent for auth parameters in the UCL config

The auth-group context required an array of entries for "chap",
"chap-mutual", "initiator-name", and "initiator-portal" whereas the
tar

ctld: Be more consistent for auth parameters in the UCL config

The auth-group context required an array of entries for "chap",
"chap-mutual", "initiator-name", and "initiator-portal" whereas the
target context required exactly one entry (and only permitted a single
entry).

Allow either a single entry or an array of entries for these keywords
in both the auth-group and target contexts.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48935

show more ...


# f3a43b3d 26-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Fail UCL configurations with a nested error

Errors from auth groups, portal groups, global luns, and targets were
not propagated out of the main loop.

Sponsored by: Chelsio Communications
Dif

ctld: Fail UCL configurations with a nested error

Errors from auth groups, portal groups, global luns, and targets were
not propagated out of the main loop.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D49071

show more ...


# d42a73fb 26-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Add a dedicated API between parse.y and the rest of the program

The primary purpose of this is to permit the rest of ctld to use C++.
However, this also has the nice side effect of reducing co

ctld: Add a dedicated API between parse.y and the rest of the program

The primary purpose of this is to permit the rest of ctld to use C++.
However, this also has the nice side effect of reducing code
duplication with the UCL parser.

As a general rule, setting of options including error handling for
invalid values, etc. is moved out of parse.y and into conf.c. The
globals for the current configuration, auth group, portal group, lun,
and target are also moved into conf.c hiding the types from parse.y.
The intention is that all of the functions declared in conf.h will be
extern "C" for use by parse.y and that the backing data structures can
be reimplemented as C++ classes instead of C structures if desired.

A few other small changes are included with this refactoring:

- Warn and fail a configuration that specifies the same LUN multiple
times for a target.

- Use T_* constants for SCSI device types instead of magic numbers.

- Warn and fail for a few UCL properties that aren't the required type
including "discovery-auth-group" in a portal group context,
"auth-type" and "port" in a target context.

- Fix a bug where chap-mutual in a target in UCL would not auto-create
a new auth-group.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48934

show more ...


# 5e6a4622 12-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Fix parsing of text values for DSCP in UCL parser

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48933


# 79a4240b 12-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Use preferred style for evaluating result of strcmp

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48932


# f42f7bed 12-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Fail for missing or invalid CHAP secrets in UCL config

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48931


# 64905b38 12-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Fix the isns-period and isns-timeout keywords in the UCL parser

These keywords were setting the wrong configuration value (connection
timeout).

Reviewed by: asomers
Sponsored by: Chelsio Comm

ctld: Fix the isns-period and isns-timeout keywords in the UCL parser

These keywords were setting the wrong configuration value (connection
timeout).

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48930

show more ...


# 450a84c2 12-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Some bool-related cleanups

- Convert a few variables from int to bool

- Return bool instead of inverted 0/1 from configuration parsing
functions and the auth check functions

- Invert the e

ctld: Some bool-related cleanups

- Convert a few variables from int to bool

- Return bool instead of inverted 0/1 from configuration parsing
functions and the auth check functions

- Invert the existing dont_daemonize bool into a daemonize boolx

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48928

show more ...


# aa060232 05-Feb-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Factor out functions to parse dscp and pcp properties

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48769


# 703b03a8 30-Jan-2025 John Baldwin <jhb@FreeBSD.org>

ctld: Use nvlist instead of home-rolled name-value lists

Reviewed by: asomers (older version)
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48595


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

ctld: Use bool in uclparse.c

Previously these functions all returned either 0 or 1, but 0 was
success and 1 was failure. Use a bool where false indicates failure
instead which is more readable.

Re

ctld: Use bool in uclparse.c

Previously these functions all returned either 0 or 1, but 0 was
success and 1 was failure. Use a bool where false indicates failure
instead which is more readable.

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

show more ...


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

ctld: Trim trailing whitespace

Sponsored by: Chelsio Communications


12