Date: Tue, 9 Sep 2014 16:45:37 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271319 - head/usr.sbin/ctld Message-ID: <201409091645.s89GjbnV063848@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Tue Sep 9 16:45:36 2014 New Revision: 271319 URL: http://svnweb.freebsd.org/changeset/base/271319 Log: Fix ctld(8) to not forget to send TargetPortalGroupTag and TargetAlias when the initiator skips security negotiation. This fixes interoperability with Xtend SAN initiator. PR: 193021 MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/login.c Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Tue Sep 9 16:11:04 2014 (r271318) +++ head/usr.sbin/ctld/login.c Tue Sep 9 16:45:36 2014 (r271319) @@ -785,7 +785,8 @@ login_negotiate(struct connection *conn, struct pdu *response; struct iscsi_bhs_login_response *bhslr2; struct keys *request_keys, *response_keys; - int i; + char *portal_group_tag; + int i, rv; bool skipped_security; if (request == NULL) { @@ -806,6 +807,21 @@ login_negotiate(struct connection *conn, login_set_csg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION); login_set_nsg(response, BHSLR_STAGE_FULL_FEATURE_PHASE); response_keys = keys_new(); + + if (skipped_security && + conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) { + if (conn->conn_target->t_alias != NULL) + keys_add(response_keys, + "TargetAlias", conn->conn_target->t_alias); + rv = asprintf(&portal_group_tag, "%d", + conn->conn_portal->p_portal_group->pg_tag); + if (rv <= 0) + log_err(1, "asprintf"); + keys_add(response_keys, + "TargetPortalGroupTag", portal_group_tag); + free(portal_group_tag); + } + for (i = 0; i < KEYS_MAX; i++) { if (request_keys->keys_names[i] == NULL) break; @@ -1069,6 +1085,9 @@ login(struct connection *conn) response_keys = keys_new(); keys_add(response_keys, "AuthMethod", "CHAP"); if (conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) { + if (conn->conn_target->t_alias != NULL) + keys_add(response_keys, + "TargetAlias", conn->conn_target->t_alias); rv = asprintf(&portal_group_tag, "%d", conn->conn_portal->p_portal_group->pg_tag); if (rv <= 0) @@ -1076,9 +1095,6 @@ login(struct connection *conn) keys_add(response_keys, "TargetPortalGroupTag", portal_group_tag); free(portal_group_tag); - if (conn->conn_target->t_alias != NULL) - keys_add(response_keys, - "TargetAlias", conn->conn_target->t_alias); } keys_save(response_keys, response);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409091645.s89GjbnV063848>