git: ffb02a356dfa - main - ctld: Refactor auth_group to support NVMe
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 06 Aug 2025 20:09:59 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=ffb02a356dfaed258b5c0c7065ab83c530d64aa7
commit ffb02a356dfaed258b5c0c7065ab83c530d64aa7
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-08-06 19:56:18 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-08-06 19:56:18 +0000
ctld: Refactor auth_group to support NVMe
Split out a private method to parse a listen address and optional
mask. This will avoid having to duplicate that code for NVMe
host addresses.
Rename the ag_names and ag_portals members to include "initiator"
to indicate they are iSCSI-specific.
Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D51728
---
usr.sbin/ctld/ctld.cc | 12 ++++++------
usr.sbin/ctld/ctld.hh | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/usr.sbin/ctld/ctld.cc b/usr.sbin/ctld/ctld.cc
index 23d01364a6a4..29fc95c76a4f 100644
--- a/usr.sbin/ctld/ctld.cc
+++ b/usr.sbin/ctld/ctld.cc
@@ -301,17 +301,17 @@ bool
auth_group::add_initiator_name(std::string_view name)
{
/* Silently ignore duplicates. */
- ag_names.emplace(name);
+ ag_initiator_names.emplace(name);
return (true);
}
bool
auth_group::initiator_permitted(std::string_view initiator_name) const
{
- if (ag_names.empty())
+ if (ag_initiator_names.empty())
return (true);
- return (ag_names.count(std::string(initiator_name)) != 0);
+ return (ag_initiator_names.count(std::string(initiator_name)) != 0);
}
bool
@@ -390,7 +390,7 @@ auth_group::add_initiator_portal(const char *portal)
return (false);
}
- ag_portals.emplace_back(ap);
+ ag_initiator_portals.emplace_back(ap);
return (true);
}
@@ -429,10 +429,10 @@ auth_portal::matches(const struct sockaddr *sa) const
bool
auth_group::initiator_permitted(const struct sockaddr *sa) const
{
- if (ag_portals.empty())
+ if (ag_initiator_portals.empty())
return (true);
- for (const auth_portal &ap : ag_portals)
+ for (const auth_portal &ap : ag_initiator_portals)
if (ap.matches(sa))
return (true);
return (false);
diff --git a/usr.sbin/ctld/ctld.hh b/usr.sbin/ctld/ctld.hh
index 059f719668f9..53479aa09d9d 100644
--- a/usr.sbin/ctld/ctld.hh
+++ b/usr.sbin/ctld/ctld.hh
@@ -124,8 +124,8 @@ private:
std::string ag_label;
auth_type ag_type = auth_type::UNKNOWN;
std::unordered_map<std::string, auth> ag_auths;
- std::unordered_set<std::string> ag_names;
- std::list<auth_portal> ag_portals;
+ std::unordered_set<std::string> ag_initiator_names;
+ std::list<auth_portal> ag_initiator_portals;
};
using auth_group_sp = std::shared_ptr<auth_group>;