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