From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 11:34:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9D59F5B; Fri, 24 Oct 2014 11:34:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95D273D9; Fri, 24 Oct 2014 11:34:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OBYurX070575; Fri, 24 Oct 2014 11:34:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OBYujj070574; Fri, 24 Oct 2014 11:34:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410241134.s9OBYujj070574@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 24 Oct 2014 11:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273583 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 11:34:56 -0000 Author: trasz Date: Fri Oct 24 11:34:55 2014 New Revision: 273583 URL: https://svnweb.freebsd.org/changeset/base/273583 Log: Tidy up the login code; no functional changes. MFC after: 1 month 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 Fri Oct 24 09:48:58 2014 (r273582) +++ head/usr.sbin/ctld/login.c Fri Oct 24 11:34:55 2014 (r273583) @@ -672,6 +672,7 @@ login(struct connection *conn) struct iscsi_bhs_login_response *bhslr2; struct keys *request_keys, *response_keys; struct auth_group *ag; + struct portal_group *pg; const char *initiator_name, *initiator_alias, *session_type, *target_name, *auth_method; @@ -688,6 +689,8 @@ login(struct connection *conn) log_errx(1, "received Login PDU with non-zero TSIH"); } + pg = conn->conn_portal->p_portal_group; + memcpy(conn->conn_initiator_isid, bhslr->bhslr_isid, sizeof(conn->conn_initiator_isid)); @@ -741,9 +744,7 @@ login(struct connection *conn) log_errx(1, "received Login PDU without TargetName"); } - conn->conn_target = - target_find(conn->conn_portal->p_portal_group->pg_conf, - target_name); + conn->conn_target = target_find(pg->pg_conf, target_name); if (conn->conn_target == NULL) { login_send_error(request, 0x02, 0x03); log_errx(1, "requested target \"%s\" not found", @@ -760,14 +761,14 @@ login(struct connection *conn) log_debugx("initiator requests to connect " "to target \"%s\"; auth-group \"%s\"", conn->conn_target->t_name, - conn->conn_target->t_auth_group->ag_name); + ag->ag_name); } else { log_debugx("initiator requests to connect " "to target \"%s\"", conn->conn_target->t_name); } } else { assert(conn->conn_session_type == CONN_SESSION_TYPE_DISCOVERY); - ag = conn->conn_portal->p_portal_group->pg_discovery_auth_group; + ag = pg->pg_discovery_auth_group; if (ag->ag_name != NULL) { log_debugx("initiator requests " "discovery session; auth-group \"%s\"", ag->ag_name); @@ -837,8 +838,7 @@ login(struct connection *conn) response = login_new_response(request); bhslr2 = (struct iscsi_bhs_login_response *)response->pdu_bhs; bhslr2->bhslr_flags |= BHSLR_FLAGS_TRANSIT; - login_set_nsg(response, - BHSLR_STAGE_OPERATIONAL_NEGOTIATION); + login_set_nsg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION); response_keys = keys_new(); /* * Required by Linux initiator. @@ -852,8 +852,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", - conn->conn_portal->p_portal_group->pg_tag); + keys_add_int(response_keys, + "TargetPortalGroupTag", pg->pg_tag); } keys_save(response_keys, response); pdu_send(response); @@ -903,8 +903,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", - conn->conn_portal->p_portal_group->pg_tag); + keys_add_int(response_keys, + "TargetPortalGroupTag", pg->pg_tag); } keys_save(response_keys, response);