Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Oct 2014 11:34:56 +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: r273583 - head/usr.sbin/ctld
Message-ID:  <201410241134.s9OBYujj070574@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410241134.s9OBYujj070574>