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

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