From: Harish Zunjarrao <harish.zunjar...@qlogic.com>

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.zunjar...@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravan...@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudh...@qlogic.com>
---
 usr/iface.c |   13 ++++++++++---
 1 files 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.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to