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