Blame SOURCES/0048-iscsi-tools-Ignore-network-parameter-if-not-enabled-.patch

786c6d
From da404f2137daa4e5cf06d69e4d7b6a0bff8c13b5 Mon Sep 17 00:00:00 2001
786c6d
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
786c6d
Date: Fri, 18 Oct 2013 09:29:23 -0400
786c6d
Subject: [PATCH] iscsi tools: Ignore network parameter if not enabled/disabled
786c6d
786c6d
If iface does not contain network parameter or incorrect value is set,
786c6d
do not send that network parameter value to driver.
786c6d
786c6d
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
786c6d
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
786c6d
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
786c6d
---
786c6d
 usr/iface.c | 13 ++++++++++---
786c6d
 1 file changed, 10 insertions(+), 3 deletions(-)
786c6d
786c6d
diff --git a/usr/iface.c b/usr/iface.c
786c6d
index 6454f75..55b0dd4 100644
786c6d
--- a/usr/iface.c
786c6d
+++ b/usr/iface.c
786c6d
@@ -1346,11 +1346,18 @@ static int iface_fill_param_state(struct iovec *iov, uint32_t iface_num,
786c6d
 	net_param->param = param;
786c6d
 	net_param->iface_type = iface_type;
786c6d
 	net_param->param_type = param_type;
786c6d
-	if (strcmp(param_val, "disable"))
786c6d
-		net_param->value[0] = ISCSI_NET_PARAM_ENABLE;
786c6d
-	else /* Assume disabled */
786c6d
+	if (!strcmp(param_val, "disable"))
786c6d
 		net_param->value[0] = ISCSI_NET_PARAM_DISABLE;
786c6d
+	else if (!strcmp(param_val, "enable"))
786c6d
+		net_param->value[0] = ISCSI_NET_PARAM_ENABLE;
786c6d
+	else
786c6d
+		goto free;
786c6d
 	return 0;
786c6d
+free:
786c6d
+	free(iov->iov_base);
786c6d
+	iov->iov_base = NULL;
786c6d
+	iov->iov_len = 0;
786c6d
+	return 1;
786c6d
 }
786c6d
 
786c6d
 #define IFACE_SET_PARAM_STATE(iov, inum, itype, param, ptype, ival,	\
786c6d
-- 
786c6d
1.8.3.1
786c6d