2c4537b
From 3b4b45001b6d8412aad76a55347de42d30d694f7 Mon Sep 17 00:00:00 2001
c2d5d21
From: Eddie Wai <eddie.wai@broadcom.com>
2c4537b
Date: Fri, 23 Aug 2013 14:04:12 -0700
2c4537b
Subject: [PATCH] ISCSID: Added iface content override fix
c2d5d21
c2d5d21
Patch provided by Mike Christie.
c2d5d21
c2d5d21
This patch fixes the unconditional overwrite of the iface struct
c2d5d21
even when the corresponding iface info from the node config was
c2d5d21
found and extracted.
c2d5d21
c2d5d21
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
c2d5d21
---
c2d5d21
 usr/iscsid.c | 8 +++-----
c2d5d21
 1 file changed, 3 insertions(+), 5 deletions(-)
c2d5d21
c2d5d21
diff --git a/usr/iscsid.c b/usr/iscsid.c
c2d5d21
index 8f19220..d1756ef 100644
c2d5d21
--- a/usr/iscsid.c
c2d5d21
+++ b/usr/iscsid.c
c2d5d21
@@ -111,9 +111,7 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct session_info *info)
c2d5d21
 	strlcpy(rec->name, info->targetname, TARGET_NAME_MAXLEN);
c2d5d21
 	rec->conn[0].port = info->persistent_port;
c2d5d21
 	strlcpy(rec->conn[0].address, info->persistent_address, NI_MAXHOST);
c2d5d21
-	memcpy(&rec->iface, &info->iface, sizeof(struct iface_rec));
c2d5d21
 	rec->tpgt = info->tpgt;
c2d5d21
-	iface_copy(&rec->iface, &info->iface);
c2d5d21
 
c2d5d21
 	iscsi_sysfs_get_negotiated_session_conf(info->sid, &session_conf);
c2d5d21
 	iscsi_sysfs_get_negotiated_conn_conf(info->sid, &conn_conf);
c2d5d21
@@ -238,6 +236,7 @@ static int sync_session(void *data, struct session_info *info)
c2d5d21
 		log_warning("Could not read data from db. Using default and "
c2d5d21
 			    "currently negotiated values\n");
c2d5d21
 		setup_rec_from_negotiated_values(&rec, info);
c2d5d21
+		iface_copy(&rec.iface, &info->iface);
c2d5d21
 	} else {
c2d5d21
 		/*
c2d5d21
 		 * we have a valid record and iface so lets merge
c2d5d21
@@ -251,13 +250,12 @@ static int sync_session(void *data, struct session_info *info)
c2d5d21
 		memset(&sysfsrec, 0, sizeof(node_rec_t));
c2d5d21
 		setup_rec_from_negotiated_values(&sysfsrec, info);
c2d5d21
 		/*
c2d5d21
-		 * target, portal and iface name values have to be the same
c2d5d21
+		 * target, portal and iface values have to be the same
c2d5d21
 		 * or we would not have found the record, so just copy
c2d5d21
-		 * CHAP and iface settings.
c2d5d21
+		 * CHAP settings.
c2d5d21
 		 */
c2d5d21
 		memcpy(&rec.session.auth, &sysfsrec.session.auth,
c2d5d21
 		      sizeof(struct iscsi_auth_config));
c2d5d21
-		memcpy(&rec.iface, &info->iface, sizeof(rec.iface));
c2d5d21
 	}
c2d5d21
 
c2d5d21
 	/* multiple drivers could be connected to the same portal */
c2d5d21
-- 
2c4537b
1.8.3.1
c2d5d21