git: 614ef718496e - main - ctld: Don't add an iscsi port for targets with only kernel ports

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 23 Apr 2026 19:17:47 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=614ef718496eb6fd815ddcfde203bee8da1178b1

commit 614ef718496eb6fd815ddcfde203bee8da1178b1
Author:     Ken J. Thomson <thomsonk@yandex.com>
AuthorDate: 2026-04-23 19:15:48 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-04-23 19:15:48 +0000

    ctld: Don't add an iscsi port for targets with only kernel ports
    
    PR:             293076
    Reviewed by:    asomers
    Fixes:          969876fcee57 ("ctld: parse config file independently of getting kernel info")
    Differential Revision:  https://reviews.freebsd.org/D56523
---
 usr.sbin/ctld/ctld.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/ctld/ctld.cc b/usr.sbin/ctld/ctld.cc
index b634debeafc8..e3050974dd35 100644
--- a/usr.sbin/ctld/ctld.cc
+++ b/usr.sbin/ctld/ctld.cc
@@ -1461,7 +1461,7 @@ target::verify()
 		t_auth_group = t_conf->find_auth_group("default");
 		assert(t_auth_group != nullptr);
 	}
-	if (t_ports.empty()) {
+	if (t_ports.empty() && t_pports.empty()) {
 		struct portal_group *pg = default_portal_group();
 		assert(pg != NULL);
 		t_conf->add_port(this, pg, nullptr);