5003024
diff -aurp open-iscsi-2.0-868-test1/usr/iscsid.c open-iscsi-2.0-868-test1.work/usr/iscsid.c
5003024
--- open-iscsi-2.0-868-test1/usr/iscsid.c	2008-03-11 17:25:29.000000000 -0500
5003024
+++ open-iscsi-2.0-868-test1.work/usr/iscsid.c	2008-03-11 17:25:50.000000000 -0500
5003024
@@ -177,7 +177,7 @@ setup_rec_from_negotiated_values(idbm_t 
5003024
 static int sync_session(void *data, struct session_info *info)
5003024
 {
5003024
 	idbm_t *db = data;
5003024
-	node_rec_t rec;
5003024
+	node_rec_t rec, sysfsrec;
5003024
 	iscsiadm_req_t req;
5003024
 	iscsiadm_rsp_t rsp;
5003024
 	struct iscsi_transport *t;
5003024
@@ -219,6 +219,27 @@ static int sync_session(void *data, stru
5003024
 		log_warning("Could not read data from db. Using default and "
5003024
 			    "currently negotiated values\n");
5003024
 		setup_rec_from_negotiated_values(db, &rec, info);
5003024
+	} else {
5003024
+		/*
5003024
+		 * we have a valid record and iface so lets merge
5003024
+		 * the values from them and sysfs to try and get
5003024
+		 * the most uptodate values.
5003024
+		 *
5003024
+		 * Currenlty that means we will use the CHAP, target and
5003024
+		 * and portal values from sysfs and use timer, queue depth,
5003024
+		 * and segment length values from the record. In the future
5003024
+		 * when boot supports iface binding we will want to use
5003024
+		 * those values from sysfs.
5003024
+		 */
5003024
+		memset(&sysfsrec, 0, sizeof(node_rec_t));
5003024
+		setup_rec_from_negotiated_values(db, &sysfsrec, info);
5003024
+		/*
5003024
+		 * target and portal values have to be the same or
5003024
+		 * we would not have found the record, so just copy
5003024
+		 * CHAP.
5003024
+		 */
5003024
+		memcpy(&rec.session.auth, &sysfsrec.session.auth,
5003024
+		      sizeof(struct iscsi_auth_config));
5003024
 	}
5003024
 
5003024
 	/* multiple drivers could be connected to the same portal */