Skip to content

Commit

Permalink
Merge pull request #33 from truenas/rebase_on_upstream_master
Browse files Browse the repository at this point in the history
Rebase on upstream master
  • Loading branch information
bmeagherix authored Sep 20, 2024
2 parents 0557e53 + 7ea8f1c commit c59ed0e
Show file tree
Hide file tree
Showing 28 changed files with 703 additions and 438 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/run_regression_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- nightly/update

jobs:
regression_tests:
Expand All @@ -13,24 +14,30 @@ jobs:
fail-fast: false
matrix:
version: [
'6.8.7',
'6.11',
'6.10.10',
'6.9.12',
'6.8.12',
'6.7.12',
'6.6.28',
'6.1.87',
'5.15.156',
'5.10.215',
'5.4.274',
'4.19.312',
'6.6.51',
'6.1.110',
'5.15.167',
'5.10.226',
'5.4.284',
'4.19.322',
'4.14.336',
'4.9.337',
'3.18.140',
'3.10.108',
'5.14.0-427.33.1.el9_4^AlmaLinux^9.4',
'5.14.0-362.24.2.el9_3^AlmaLinux^9.3',
'5.14.0-284.30.1.el9_2^AlmaLinux^9.2',
'4.18.0-513.24.1.el8_9^AlmaLinux^8.9',
'4.18.0-477.13.1.el8_8^AlmaLinux^8.8',
'3.10.0-1160.108.1.el7^CentOS^7.9.2009',
'5.15.0-205.149.5.1.el9uek^UEK^9',
'5.4.17-2136.330.7.1.el8uek^UEK^8',
'4.18.0-425.19.2.el8_7^AlmaLinux^8.7',
'3.10.0-1160.118.1.el7^CentOS^7.9.2009',
'5.15.0-210.163.7.el9uek^UEK^9',
'5.4.17-2136.335.4.el8uek^UEK^8',
'5.4.17-2102.206.1.el7uek^UEK^7',
'4.1.12-124.48.6.el6uek^UEK^6'
]
Expand Down
8 changes: 8 additions & 0 deletions iscsi-scst/README
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ is /sys/kernel/scst_tgt/targets/iscsi. It has the following entries:
iSCSI-SCST attributes before it starts accepting new connections. 0
by default.

- internal_portal - May designate one or more existing portals as being
internal. This will eliminate the need to supply a CHAP user/secret
during discovery or target login to any targets configured on those
portals. This is particularly useful for internal targets used as
part of ALUA configuration. Multiple addresses may be supplied,
separated by space characters. Empty by default.

- link_local - if set, makes the response to an IPv6 SendTargets include
any link local addresses. Default is set.

Expand Down Expand Up @@ -552,6 +559,7 @@ both iSCSI-SCST targets will look like:
| |-- IncomingUser
| |-- OutgoingUser
| |-- enabled
| |-- internal_portal
| |-- iSNSServer
| |-- iqn.2006-10.net.vlnb:tgt
| | |-- DataDigest
Expand Down
65 changes: 65 additions & 0 deletions iscsi-scst/usr/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,18 @@ static int handle_e_get_attr_value(int fd, const struct iscsi_kern_event *event)
snprintf(res_str, sizeof(res_str), "%d\n", send_targets_link_local);
if (send_targets_link_local != DEFAULT_SEND_TARGETS_LINK_LOCAL)
add_key_mark(res_str, sizeof(res_str), 0);
} else if (strcasecmp(ISCSI_INTERNAL_PORTAL_ATTR_NAME, pp) == 0) {
if (target != NULL) {
log_error("Not NULL target %s for global attribute %s",
target->name, pp);
res = -EINVAL;
goto out_free;
}
if (internal_portal) {
snprintf(res_str, sizeof(res_str), "%s\n", internal_portal);
add_key_mark(res_str, sizeof(res_str), 0);
} else
snprintf(res_str, sizeof(res_str), "\n");
} else {
log_error("Unknown attribute %s", pp);
res = -EINVAL;
Expand All @@ -669,6 +681,14 @@ static int handle_e_get_attr_value(int fd, const struct iscsi_kern_event *event)
return res;
}

static bool is_addr(char *addr)
{
struct in_addr ia;
struct in6_addr ia6;

return (inet_pton(AF_INET, addr, &ia) == 1) || inet_pton(AF_INET6, addr, &ia6);
}

static int handle_target_redirect(struct target *target, char *p)
{
int res = 0;
Expand Down Expand Up @@ -1094,6 +1114,51 @@ static int handle_e_set_attr_value(int fd, const struct iscsi_kern_event *event)
res = -EINVAL;
goto out_free;
}
} else if (strcasecmp(ISCSI_INTERNAL_PORTAL_ATTR_NAME, pp) == 0) {
if (target != NULL) {
log_error("Not NULL target %s for global attribute %s",
target->name, pp);
res = -EINVAL;
goto out_free;
}
p = config_strip_string(p);
if (!p || *p == '\0') {
free(internal_portal);
internal_portal = NULL;
} else {
/* We have been provided with a string, check the contents. */
if (strchr(p, ' ')) {
char *portals = strdup(p);
char *portal;

if (!portals) {
log_error("Memory error (internal_portal)");
res = -ENOMEM;
goto out_free;
}

portal = strtok(portals, " ");
while (portal != NULL) {
if (!is_addr(portal)) {
free(portals);
log_error("Invalid address supplied %s", portal);
res = -EINVAL;
goto out_free;
}
portal = strtok(NULL, " ");
}
free(portals);
} else {
/* No spaces */
if (!is_addr(p)) {
log_error("Invalid address supplied %s", p);
res = -EINVAL;
goto out_free;
}
}
free(internal_portal);
internal_portal = strdup(p);
}
} else {
log_error("Unknown attribute %s", pp);
res = -EINVAL;
Expand Down
3 changes: 3 additions & 0 deletions iscsi-scst/usr/iscsi_scstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,9 @@ int main(int argc, char **argv)
if (err != 0)
exit(err);
err = kernel_attr_add(NULL, ISCSI_LINK_LOCAL_ATTR_NAME, 0644, 0);
if (err != 0)
exit(err);
err = kernel_attr_add(NULL, ISCSI_INTERNAL_PORTAL_ATTR_NAME, 0644, 0);
if (err != 0)
exit(err);

Expand Down
30 changes: 29 additions & 1 deletion iscsi-scst/usr/iscsid.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "iscsid.h"

int iscsi_enabled;
char *internal_portal;

static u32 ttt;

Expand Down Expand Up @@ -1011,6 +1012,32 @@ static int cmnd_exec_auth(struct connection *conn)
return res;
}

static bool on_internal_portal(struct connection *conn)
{
if (!internal_portal)
return false;

if (strchr(internal_portal, ' ')) {
char *portals = strdup(internal_portal);

if (portals) {
char *portal = strtok(portals, " ");

while (portal != NULL) {
if (!strcmp(portal, conn->target_portal)) {
free(portals);
return true;
}
portal = strtok(NULL, " ");
}
free(portals);
}
return false;
} else {
return !strcmp(internal_portal, conn->target_portal);
}
}

static void cmnd_exec_login(struct connection *conn)
{
struct iscsi_login_req_hdr *req = (struct iscsi_login_req_hdr *)&conn->req.bhs;
Expand Down Expand Up @@ -1083,7 +1110,8 @@ static void cmnd_exec_login(struct connection *conn)
login_start(conn);
if (rsp->status_class)
return;
if (!accounts_empty(conn->tid, ISCSI_USER_DIR_INCOMING))
if (!accounts_empty(conn->tid, ISCSI_USER_DIR_INCOMING) &&
!on_internal_portal(conn))
goto auth_err;
if (rsp->status_class)
return;
Expand Down
1 change: 1 addition & 0 deletions iscsi-scst/usr/iscsid.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ extern const char *get_error_str(int error);

/* iscsid.c */
extern int iscsi_enabled;
extern char *internal_portal;

extern int cmnd_execute(struct connection *conn);
extern void cmnd_finish(struct connection *conn);
Expand Down
1 change: 1 addition & 0 deletions iscsi-scst/usr/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define ISCSI_ENABLED_ATTR_NAME "enabled"
#define ISCSI_ISNS_ENTITY_ATTR_NAME "isns_entity_name"
#define ISCSI_ALLOWED_PORTAL_ATTR_NAME "allowed_portal"
#define ISCSI_INTERNAL_PORTAL_ATTR_NAME "internal_portal"
#define ISCSI_PER_PORTAL_ACL_ATTR_NAME "per_portal_acl"
#define ISCSI_TARGET_REDIRECTION_ATTR_NAME "redirect"
#define ISCSI_TARGET_REDIRECTION_VALUE_TEMP "temp"
Expand Down
30 changes: 17 additions & 13 deletions nightly/conf/nightly.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,40 @@
ABT_DETAILS="x86_64"
ABT_JOBS=5
ABT_KERNELS=" \
6.8.7 \
6.11 \
6.10.10-nc \
6.9.12-nc \
6.8.12-nc \
6.7.12-nc \
6.6.28-nc \
6.6.51-nc \
6.5.13-nc \
6.4.16-nc \
6.3.13-nc \
6.2.16-nc \
6.1.87-nc \
6.1.110-nc \
6.0.19-nc \
5.19.17-nc \
5.18.19-nc \
5.17.15-nc \
5.16.20-nc \
5.15.156-nc \
5.15.167-nc \
5.14.21-nc \
5.13.19-nc \
5.12.19-nc \
5.11.22-nc \
5.10.215-nc \
5.10.226-nc \
5.9.16-nc \
5.8.18-nc \
5.7.19-nc \
5.6.19-nc \
5.5.19-nc \
5.4.274-nc \
5.4.284-nc \
5.3.18-nc \
5.2.21-nc \
5.1.21-nc \
5.0.21-nc \
4.20.17-nc \
4.19.312-nc \
4.19.322-nc \
4.18.20-nc \
4.17.19-nc \
4.16.18-nc \
Expand Down Expand Up @@ -63,7 +66,8 @@ ABT_KERNELS=" \
3.12.74-nc \
3.11.10-nc \
3.10.108-nc \
5.14.0-362.24.1.el9_3^AlmaLinux^9.3-nc \
5.14.0-427.33.1.el9_4^AlmaLinux^9.4-nc \
5.14.0-362.24.2.el9_3^AlmaLinux^9.3-nc \
5.14.0-284.30.1.el9_2^AlmaLinux^9.2-nc \
5.14.0-162.23.1.el9_1^AlmaLinux^9.1-nc \
5.14.0-70.30.1.el9_0^AlmaLinux^9.0-nc \
Expand All @@ -77,18 +81,18 @@ ABT_KERNELS=" \
4.18.0-193.28.1.el8_2^CentOS^8.2.2004-nc \
4.18.0-147.8.1.el8_1^CentOS^8.1.1911-nc \
4.18.0-80.11.2.el8_0^CentOS^8.0.1905-nc \
3.10.0-1160.108.1.el7^CentOS^7.9.2009-nc \
3.10.0-1160.118.1.el7^CentOS^7.9.2009-nc \
3.10.0-1127.19.1.el7^CentOS^7.8.2003-nc \
3.10.0-1062.18.1.el7^CentOS^7.7.1908-nc \
3.10.0-957.27.2.el7^CentOS^7.6.1810-nc \
3.10.0-862.14.4.el7^CentOS^7.5.1804-nc \
5.15.0-205.149.5.1.el9uek^UEK^9-nc \
5.15.0-205.149.5.1.el8uek^UEK^8-nc \
5.4.17-2136.330.7.1.el8uek^UEK^8-nc \
5.15.0-210.163.7.el9uek^UEK^9-nc \
5.15.0-210.163.7.el8uek^UEK^8-nc \
5.4.17-2136.335.4.el8uek^UEK^8-nc \
5.4.17-2102.206.1.el8uek^UEK^8-nc \
5.4.17-2036.104.5.el8uek^UEK^8-nc \
5.4.17-2011.7.4.el8uek^UEK^8-nc \
5.4.17-2136.330.7.1.el7uek^UEK^7-nc \
5.4.17-2136.335.4.el7uek^UEK^7-nc \
5.4.17-2102.206.1.el7uek^UEK^7-nc \
5.4.17-2036.104.5.el7uek^UEK^7-nc \
5.4.17-2011.7.4.el7uek^UEK^7-nc \
Expand Down
15 changes: 15 additions & 0 deletions qla2x00t-32gbit/include/trace/events/qla.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#if !defined(_TRACE_QLA_H_) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_QLA_H_

#ifndef INSIDE_KERNEL_TREE
#include <linux/version.h>
#endif
#include <linux/tracepoint.h>

#undef TRACE_SYSTEM
Expand All @@ -22,11 +25,23 @@ DECLARE_EVENT_CLASS(qla_log_event,

TP_STRUCT__entry(
__string(buf, buf)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
__dynamic_array(char, msg, QLA_MSG_MAX)
#else
__vstring(msg, vaf->fmt, vaf->va)
#endif
),
TP_fast_assign(
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
__assign_str(buf, buf);
#else
__assign_str(buf);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
vsnprintf(__get_str(msg), QLA_MSG_MAX, vaf->fmt, *vaf->va);
#else
__assign_vstr(msg, vaf->fmt, vaf->va);
#endif
),

TP_printk("%s %s", __get_str(buf), __get_str(msg))
Expand Down
Loading

0 comments on commit c59ed0e

Please sign in to comment.