[iscsi-initiator-utils/f19: 4/15] Add/Update entries in chap table through Open-iSCSI

Chris Leech cleech at fedoraproject.org
Mon Apr 14 18:20:45 UTC 2014


commit 374005d4a38a827e72594a2a750d7321151ace48
Author: Chris Leech <cleech at redhat.com>
Date:   Mon Feb 17 14:16:15 2014 -0800

    Add/Update entries in chap table through Open-iSCSI
    
    Resolves: #1006156 #1006161
    
    Signed-off-by: Chris Leech <cleech at redhat.com>

 ...ols-Bug-fix-on-IPC-address-copy-version-2.patch |  103 ++++
 ...dd-support-to-set-ISCSI_FLASHNODE_CHAP_OU.patch |   35 ++
 ...e-x-option-instead-of-v-to-specify-chap_t.patch |  146 +++++
 ...n-page-changes-to-use-x-option-for-chap_t.patch |   53 ++
 ...ges-to-use-long-option-index-instead-of-f.patch |   47 ++
 ...d-support-to-set-CHAP-entry-using-host-ch.patch |  590 ++++++++++++++++++++
 ...-Correctly-get-username_in-and-password_i.patch |   37 ++
 ...nges-for-adding-support-to-set-CHAP-entry.patch |   84 +++
 iscsi-initiator-utils.spec                         |   18 +
 9 files changed, 1113 insertions(+), 0 deletions(-)
---
diff --git a/0034-iscsi-tools-Bug-fix-on-IPC-address-copy-version-2.patch b/0034-iscsi-tools-Bug-fix-on-IPC-address-copy-version-2.patch
new file mode 100644
index 0000000..4ae64e7
--- /dev/null
+++ b/0034-iscsi-tools-Bug-fix-on-IPC-address-copy-version-2.patch
@@ -0,0 +1,103 @@
+From 1fa1b51356c0ea6e1d30f2d370b3b766d4230537 Mon Sep 17 00:00:00 2001
+From: Mike Christie <michaelc at cs.wisc.edu>
+Date: Thu, 5 Dec 2013 18:12:32 -0600
+Subject: [PATCH] iscsi tools: Bug fix on IPC address copy (version 2)
+
+This patch merges Yufei Ren <yufei.ren at stonybrook.edu> patch
+with comments from the list plus what I think is a bug in the
+addr_len usage.
+
+For the addr_len use, it looks like we were using that as the
+arg to memcpy, but that value included the length of the pathname
+string and also the offset of sun_path in the sockaddr_un and so
+that is too long.
+---
+ usr/iscsi_util.c | 12 ++++++++++++
+ usr/iscsi_util.h |  3 +++
+ usr/iscsid_req.c |  7 +------
+ usr/mgmt_ipc.c   |  6 +-----
+ 4 files changed, 17 insertions(+), 11 deletions(-)
+
+diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
+index ac86847..9dbfbfd 100644
+--- a/usr/iscsi_util.c
++++ b/usr/iscsi_util.c
+@@ -25,16 +25,28 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <ctype.h>
++#include <sys/socket.h>
++#include <sys/un.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/resource.h>
+ 
++#include "sysdeps.h"
+ #include "log.h"
+ #include "iscsi_settings.h"
+ #include "iface.h"
+ #include "session_info.h"
+ #include "iscsi_util.h"
+ 
++int setup_abstract_addr(struct sockaddr_un *addr, char *unix_sock_name)
++{
++	memset(addr, 0, sizeof(*addr));
++	addr->sun_family = AF_LOCAL;
++	strlcpy(addr->sun_path + 1, unix_sock_name, sizeof(addr->sun_path) - 1);
++	return offsetof(struct sockaddr_un, sun_path) +
++		strlen(addr->sun_path + 1) + 1;
++}
++
+ void daemon_init(void)
+ {
+ 	int fd;
+diff --git a/usr/iscsi_util.h b/usr/iscsi_util.h
+index 110dfa8..ff725eb 100644
+--- a/usr/iscsi_util.h
++++ b/usr/iscsi_util.h
+@@ -26,4 +26,7 @@ extern int __iscsi_match_session(struct node_rec *rec, char *targetname,
+ extern char *strstrip(char *s);
+ extern char *cfg_get_string_param(char *pathname, const char *key);
+ 
++struct sockaddr_un;
++extern int setup_abstract_addr(struct sockaddr_un *addr, char *unix_sock_name);
++
+ #endif
+diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
+index 715c0aa..0e91dee 100644
+--- a/usr/iscsid_req.c
++++ b/usr/iscsid_req.c
+@@ -67,12 +67,7 @@ static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid)
+ 		return ISCSI_ERR_ISCSID_NOTCONN;
+ 	}
+ 
+-	addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(unix_sock_name) + 1;
+-
+-	memset(&addr, 0, sizeof(addr));
+-	addr.sun_family = AF_LOCAL;
+-	memcpy((char *) &addr.sun_path + 1, unix_sock_name,
+-	       strlen(unix_sock_name));
++	addr_len = setup_abstract_addr(&addr, unix_sock_name);
+ 
+ 	/*
+ 	 * Trying to connect with exponential backoff
+diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
+index 87bd346..a82c063 100644
+--- a/usr/mgmt_ipc.c
++++ b/usr/mgmt_ipc.c
+@@ -59,11 +59,7 @@ mgmt_ipc_listen(void)
+ 		return fd;
+ 	}
+ 
+-	addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(ISCSIADM_NAMESPACE) + 1;
+-
+-	memset(&addr, 0, sizeof(addr));
+-	addr.sun_family = AF_LOCAL;
+-	memcpy((char *) &addr.sun_path + 1, ISCSIADM_NAMESPACE, addr_len);
++	addr_len = setup_abstract_addr(&addr, ISCSIADM_NAMESPACE);
+ 
+ 	if ((err = bind(fd, (struct sockaddr *) &addr, addr_len)) < 0 ) {
+ 		log_error("Can not bind IPC socket");
+-- 
+1.8.3.1
+
diff --git a/0035-flashnode-Add-support-to-set-ISCSI_FLASHNODE_CHAP_OU.patch b/0035-flashnode-Add-support-to-set-ISCSI_FLASHNODE_CHAP_OU.patch
new file mode 100644
index 0000000..cfbde0c
--- /dev/null
+++ b/0035-flashnode-Add-support-to-set-ISCSI_FLASHNODE_CHAP_OU.patch
@@ -0,0 +1,35 @@
+From 360a40f8a83e08a09b34cb12e269c793028b315e Mon Sep 17 00:00:00 2001
+From: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Date: Tue, 17 Sep 2013 08:07:28 -0400
+Subject: [PATCH] flashnode: Add support to set ISCSI_FLASHNODE_CHAP_OUT_IDX
+ param
+
+Add support to set the chap_out_idx session param of flashnode
+entry.
+
+Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Signed-off-by: Vikas Chaudhary <vikas.chaudhary at qlogic.com>
+---
+ usr/flashnode.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/usr/flashnode.c b/usr/flashnode.c
+index da1392a..fe5ab57 100644
+--- a/usr/flashnode.c
++++ b/usr/flashnode.c
+@@ -449,6 +449,12 @@ int flashnode_build_config(struct list_head *params,
+ 			    fnode->sess.portal_type,
+ 			    sizeof(fnode->sess.portal_type)))
+ 				count++;
++		} else if (!strcmp(param->name,
++			  to_key(FLASHNODE_SESS_CHAP_OUT_IDX))) {
++			if (!flashnode_fill_uint32(fnode, &iov[count],
++			    ISCSI_FLASHNODE_CHAP_OUT_IDX,
++			    fnode->sess.chap_out_idx))
++				count++;
+ 		} else if (!strcmp(param->name, to_key(FLASHNODE_CONN_PORT))) {
+ 			if (fnode->conn[0].port)
+ 				port = fnode->conn[0].port;
+-- 
+1.8.3.1
+
diff --git a/0036-iscsiadm-Use-x-option-instead-of-v-to-specify-chap_t.patch b/0036-iscsiadm-Use-x-option-instead-of-v-to-specify-chap_t.patch
new file mode 100644
index 0000000..c18f6da
--- /dev/null
+++ b/0036-iscsiadm-Use-x-option-instead-of-v-to-specify-chap_t.patch
@@ -0,0 +1,146 @@
+From b3913c5943b6e908a1bb8ce83a2e79200d0ceed9 Mon Sep 17 00:00:00 2001
+From: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Date: Tue, 17 Sep 2013 08:07:29 -0400
+Subject: [PATCH] iscsiadm: Use '-x' option instead of '-v' to specify
+ chap_tbl_idx
+
+Make appropriate changes to use -x option for chap_tbl_idx cmdline
+param. This is done because -v option is used along with -n option
+to get the name/value pair.
+
+Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Signed-off-by: Vikas Chaudhary <vikas.chaudhary at qlogic.com>
+---
+ usr/host.h     |  1 +
+ usr/iscsiadm.c | 36 +++++++++++++++++-------------------
+ 2 files changed, 18 insertions(+), 19 deletions(-)
+
+diff --git a/usr/host.h b/usr/host.h
+index db44cfa..52e5b9e 100644
+--- a/usr/host.h
++++ b/usr/host.h
+@@ -7,6 +7,7 @@
+ 
+ #define MAX_HOST_NO UINT_MAX
+ 
++#define MAX_CHAP_ENTRIES 2048
+ #define MAX_CHAP_BUF_SZ 4096
+ #define REQ_CHAP_BUF_SZ (MAX_CHAP_BUF_SZ + sizeof(struct iscsi_uevent))
+ 
+diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
+index c7337ae..beabdf0 100644
+--- a/usr/iscsiadm.c
++++ b/usr/iscsiadm.c
+@@ -115,7 +115,7 @@ static struct option const long_options[] =
+ 	{"packetsize", required_argument, NULL, 'b'},
+ 	{"count", required_argument, NULL, 'c'},
+ 	{"interval", required_argument, NULL, 'i'},
+-	{"flashnode_idx", optional_argument, NULL, 'x'},
++	{"index", optional_argument, NULL, 'x'},
+ 	{"portal_type", optional_argument, NULL, 'A'},
+ 	{NULL, 0, NULL, 0},
+ };
+@@ -136,7 +136,7 @@ iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,au
+ iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P  printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]\n\
+ iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o  operation  ] [ -n name ] [ -v value ] ] [ -C ping [ -a ip ] [ -b packetsize ] [ -c count ] [ -i interval ] ]\n\
+ iscsiadm -m fw [ -d debug_level ] [ -l ]\n\
+-iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -o operation ] [ -v chap_tbl_idx ] ] | [ -C flashnode [ -o operation ] [ -A portal_type ] [ -x flashnode_idx ] [ -n name ] [ -v value ] ] ]\n\
++iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \n\
+ iscsiadm -k priority\n");
+ 	}
+ 	exit(status);
+@@ -1426,18 +1426,10 @@ exit_chap_info:
+ 	return rc;
+ }
+ 
+-static int delete_host_chap_info(uint32_t host_no, char *value)
++static int delete_host_chap_info(uint32_t host_no, uint16_t chap_tbl_idx)
+ {
+ 	struct iscsi_transport *t = NULL;
+ 	int fd, rc = 0;
+-	uint16_t chap_tbl_idx;
+-
+-	if (!value) {
+-		log_error("CHAP deletion requires --value=table_index.");
+-		return ISCSI_ERR_INVAL;
+-	}
+-
+-	chap_tbl_idx = (uint16_t)atoi(value);
+ 
+ 	t = iscsi_sysfs_get_transport_by_hba(host_no);
+ 	if (!t) {
+@@ -1472,22 +1464,28 @@ exit_delete_chap:
+ }
+ 
+ static int exec_host_chap_op(int op, int info_level, uint32_t host_no,
+-			     char *value)
++			     uint64_t chap_index)
+ {
+ 	int rc = ISCSI_ERR_INVAL;
+ 
++	if (op != OP_SHOW && (chap_index > (uint64_t)MAX_CHAP_ENTRIES)) {
++		log_error("Invalid chap table index.");
++		goto exit_chap_op;
++	}
++
+ 	switch (op) {
+ 	case OP_SHOW:
+ 		rc = get_host_chap_info(host_no);
+ 		break;
+ 	case OP_DELETE:
+-		rc = delete_host_chap_info(host_no, value);
++		rc = delete_host_chap_info(host_no, chap_index);
+ 		break;
+ 	default:
+ 		log_error("Invalid operation.");
+ 		break;
+ 	}
+ 
++exit_chap_op:
+ 	return rc;
+ }
+ 
+@@ -2818,7 +2816,7 @@ main(int argc, char **argv)
+ 	struct iface_rec *iface = NULL, *tmp;
+ 	struct node_rec *rec = NULL;
+ 	uint64_t host_no =  (uint64_t)MAX_HOST_NO + 1;
+-	uint64_t flashnode_idx = (uint64_t)MAX_FLASHNODE_IDX + 1;
++	uint64_t index = (uint64_t)MAX_FLASHNODE_IDX + 1;
+ 	struct user_param *param;
+ 	struct list_head params;
+ 
+@@ -2962,9 +2960,9 @@ main(int argc, char **argv)
+ 				ISCSI_VERSION_STR);
+ 			return 0;
+ 		case 'x':
+-			flashnode_idx = strtoull(optarg, NULL, 10);
++			index = strtoull(optarg, NULL, 10);
+ 			if (errno) {
+-				log_error("Invalid flashnode index %s. %s.",
++				log_error("Invalid index %s. %s.",
+ 					  optarg, strerror(errno));
+ 				rc = ISCSI_ERR_INVAL;
+ 				goto free_ifaces;
+@@ -3041,7 +3039,7 @@ main(int argc, char **argv)
+ 					break;
+ 				}
+ 				rc = exec_host_chap_op(op, info_level, host_no,
+-						       value);
++						       index);
+ 				break;
+ 			case MODE_FLASHNODE:
+ 				if (host_no > MAX_HOST_NO) {
+@@ -3051,8 +3049,8 @@ main(int argc, char **argv)
+ 				}
+ 
+ 				rc = exec_flashnode_op(op, info_level, host_no,
+-						       flashnode_idx,
+-						       portal_type, &params);
++						       index, portal_type,
++						       &params);
+ 				break;
+ 			default:
+ 				log_error("Invalid Sub Mode");
+-- 
+1.8.3.1
+
diff --git a/0037-iscsiadm-Man-page-changes-to-use-x-option-for-chap_t.patch b/0037-iscsiadm-Man-page-changes-to-use-x-option-for-chap_t.patch
new file mode 100644
index 0000000..ef5efc5
--- /dev/null
+++ b/0037-iscsiadm-Man-page-changes-to-use-x-option-for-chap_t.patch
@@ -0,0 +1,53 @@
+From 0c4022d865d81a0fb2fc6dcba8df72a6da753cfe Mon Sep 17 00:00:00 2001
+From: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Date: Tue, 17 Sep 2013 08:07:30 -0400
+Subject: [PATCH] iscsiadm: Man page changes to use -x option for chap_tbl_idx
+
+Changes in iscsiadm man page to use -x option instead of -v option
+for chap_tbl_idx cmdline param.
+
+Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Signed-off-by: Vikas Chaudhary <vikas.chaudhary at qlogic.com>
+---
+ doc/iscsiadm.8 | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
+index 6b15fcd..0e8149c 100644
+--- a/doc/iscsiadm.8
++++ b/doc/iscsiadm.8
+@@ -16,7 +16,7 @@ iscsiadm \- open-iscsi administration utility
+ 
+ \fBiscsiadm\fR \-m fw [ \-d debug_level ] [\-l]
+ 
+-\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-o operation ] [ \-v chap_tbl_idx ] ] | [ \-C flashnode [ \-o operation ] [ \-A portal_type ] [ \-x flashnode_idx ] [ \-n name ] [ \-v value ] ] ]
++\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-x chap_tbl_idx ] ] | [ \-C flashnode [ \-A portal_type ] [ \-x flashnode_idx ] ] ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ]
+ 
+ \fBiscsiadm\fR \-k priority
+ 
+@@ -74,7 +74,7 @@ iscsiadm -m iface -I ifacename -C ping -a ipaddr -b packetsize -c count -i inter
+ 
+ For host, it supports chap and flashnode as submodes. For example,
+ 
+-iscsiadm -m host -H hostno -C chap -v chap_tbl_idx -o operation
++iscsiadm -m host -H hostno -C chap -x chap_tbl_idx -o operation
+ 
+ iscsiadm -m host -H hostno -C flashnode -x flashnode_idx -o operation
+ 
+@@ -320,10 +320,10 @@ This option is only valid for node mode and flashnode submode of host mode.
+ display version and exit
+ 
+ .TP
+-\fB\-x\fR, \fB\-\-flashnode_idx=\fIindex\fR
+-Specify the \fIindex\fR of the flash node to operate on.
++\fB\-x\fR, \fB\-\-index=\fIindex\fR
++Specify the \fIindex\fR of the entity to operate on.
+ .IP
+-This option is only valid for flashnode submode of host mode.
++This option is only valid for chap and flashnode submodes of host mode.
+ 
+ .SH DISCOVERY TYPES
+ iSCSI defines 3 discovery types: SendTargets, SLP, and iSNS.
+-- 
+1.8.3.1
+
diff --git a/0038-README-changes-to-use-long-option-index-instead-of-f.patch b/0038-README-changes-to-use-long-option-index-instead-of-f.patch
new file mode 100644
index 0000000..fae2288
--- /dev/null
+++ b/0038-README-changes-to-use-long-option-index-instead-of-f.patch
@@ -0,0 +1,47 @@
+From 38b2993786c26a2c7bb79a42fc8c644720b4507c Mon Sep 17 00:00:00 2001
+From: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Date: Tue, 17 Sep 2013 08:07:31 -0400
+Subject: [PATCH] README changes to use long option --index instead of
+ --flashnode_idx
+
+This change supports use of -x option instead of -v option for
+chap_tbl_idx cmdline param.
+
+Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Signed-off-by: Vikas Chaudhary <vikas.chaudhary at qlogic.com>
+---
+ README | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/README b/README
+index 29b00a9..dda16c9 100644
+--- a/README
++++ b/README
+@@ -393,7 +393,7 @@ Usage: iscsiadm [OPTION]
+ 			  See below for examples.
+   -m iface --interface=iscsi_ifacename -C ping --ip=[ipaddr] --packetsize=[size]
+ 				--count=[count] --interval=[interval]
+-  -m host --host=hostno|MAC --print=level -C chap --op=[op] --value=[chap_tbl_idx]
++  -m host --host=hostno|MAC --print=level -C chap --op=[op] --index=[chap_tbl_idx]
+ 			  Display information for a specific host. The host
+ 			  can be passed in by host number or by MAC address.
+ 			  If a host is not passed in then info
+@@ -414,13 +414,13 @@ Usage: iscsiadm [OPTION]
+ 			  Create new flash node entry for the given host of the
+ 			  specified portal_type. This returns the index of the
+ 			  newly created entry on success.
+-  -m host --host=hostno|MAC -C flashnode --flashnode_idx=[flashnode index] \
++  -m host --host=hostno|MAC -C flashnode --index=[flashnode index] \
+ 				--op=[UPDATE] --name=[name] --value=[value]
+ 			  Update the params of the speficied flash node.
+ 			  The [name] and [value] pairs must be provided for the
+ 			  params that need to be updated. Multiple params can
+ 			  be updated using a single command.
+-  -m host --host=hostno|MAC -C flashnode--flashnode_idx=[flashnode index] \
++  -m host --host=hostno|MAC -C flashnode --index=[flashnode index] \
+ 				--op=[SHOW | DELETE | LOGIN | LOGOUT]
+ 			  op=DELETE|LOGIN|LOGOUT will perform deletion/login/
+ 			  logout operation on the specified flash node.
+-- 
+1.8.3.1
+
diff --git a/0039-iscsiadm-Add-support-to-set-CHAP-entry-using-host-ch.patch b/0039-iscsiadm-Add-support-to-set-CHAP-entry-using-host-ch.patch
new file mode 100644
index 0000000..271cef3
--- /dev/null
+++ b/0039-iscsiadm-Add-support-to-set-CHAP-entry-using-host-ch.patch
@@ -0,0 +1,590 @@
+From 062718a9579a10ea7c87e46162f80e3f57e80b67 Mon Sep 17 00:00:00 2001
+From: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Date: Tue, 17 Sep 2013 08:07:32 -0400
+Subject: [PATCH] iscsiadm: Add support to set CHAP entry using host chap mode
+
+Provide support to add and update CHAP entry using chap submode of
+iscsiadm host mode.
+Both, new and update, iscsiadm operations perform the same function.
+Currently only one entry can be added or updated at a time.
+
+Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Signed-off-by: Vikas Chaudhary <vikas.chaudhary at qlogic.com>
+---
+ include/iscsi_if.h |  19 ++++-
+ usr/host.c         | 110 ++++++++++++++++++++++++++++
+ usr/host.h         |   1 +
+ usr/idbm.c         |   8 ++-
+ usr/idbm.h         |   1 +
+ usr/iscsi_ipc.h    |   3 +
+ usr/iscsiadm.c     | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++---
+ usr/netlink.c      |  25 +++++++
+ 8 files changed, 360 insertions(+), 14 deletions(-)
+
+diff --git a/include/iscsi_if.h b/include/iscsi_if.h
+index 01d38e7..0284662 100644
+--- a/include/iscsi_if.h
++++ b/include/iscsi_if.h
+@@ -74,8 +74,9 @@ enum iscsi_uevent_e {
+ 	ISCSI_UEVENT_LOGIN_FLASHNODE	= UEVENT_BASE + 28,
+ 	ISCSI_UEVENT_LOGOUT_FLASHNODE	= UEVENT_BASE + 29,
+ 	ISCSI_UEVENT_LOGOUT_FLASHNODE_SID	= UEVENT_BASE + 30,
++	ISCSI_UEVENT_SET_CHAP		= UEVENT_BASE + 31,
+ 
+-	ISCSI_UEVENT_MAX		= ISCSI_UEVENT_LOGOUT_FLASHNODE_SID,
++	ISCSI_UEVENT_MAX		= ISCSI_UEVENT_SET_CHAP,
+ 
+ 	/* up events */
+ 	ISCSI_KEVENT_RECV_PDU		= KEVENT_BASE + 1,
+@@ -318,8 +319,16 @@ enum iscsi_param_type {
+ 	ISCSI_HOST_PARAM,	/* iscsi_host_param */
+ 	ISCSI_NET_PARAM,	/* iscsi_net_param */
+ 	ISCSI_FLASHNODE_PARAM,	/* iscsi_flashnode_param */
++	ISCSI_CHAP_PARAM,	/* iscsi_chap_param */
+ };
+ 
++/* structure for minimalist usecase */
++struct iscsi_param_info {
++	uint32_t len;		/* Actual length of the param value */
++	uint16_t param;		/* iscsi param */
++	uint8_t value[0];	/* length sized value follows */
++} __attribute__((__packed__));
++
+ struct iscsi_iface_param_info {
+ 	uint32_t iface_num;	/* iface number, 0 - n */
+ 	uint32_t len;		/* Actual length of the param */
+@@ -748,6 +757,14 @@ enum chap_type_e {
+ 	CHAP_TYPE_IN,
+ };
+ 
++enum iscsi_chap_param {
++	ISCSI_CHAP_PARAM_INDEX,
++	ISCSI_CHAP_PARAM_CHAP_TYPE,
++	ISCSI_CHAP_PARAM_USERNAME,
++	ISCSI_CHAP_PARAM_PASSWORD,
++	ISCSI_CHAP_PARAM_PASSWORD_LEN
++};
++
+ #define ISCSI_CHAP_AUTH_NAME_MAX_LEN	256
+ #define ISCSI_CHAP_AUTH_SECRET_MAX_LEN	256
+ struct iscsi_chap_rec {
+diff --git a/usr/host.c b/usr/host.c
+index 1fcb350..f2052d3 100644
+--- a/usr/host.c
++++ b/usr/host.c
+@@ -34,6 +34,7 @@
+ #include "initiator.h"
+ #include "iface.h"
+ #include "iscsi_err.h"
++#include "iscsi_netlink.h"
+ 
+ static int match_host_to_session(void *data, struct session_info *info)
+ {
+@@ -314,3 +315,112 @@ int host_info_print(int info_level, uint32_t host_no)
+ 	}
+ 	return 0;
+ }
++
++static int chap_fill_param_uint(struct iovec *iov, int param,
++				uint32_t param_val, int param_len)
++{
++	struct iscsi_param_info *param_info;
++	struct nlattr *attr;
++	int len;
++	uint8_t val8 = 0;
++	uint16_t val16 = 0;
++	uint32_t val32 = 0;
++	char *val = NULL;
++
++	len = sizeof(struct iscsi_param_info) + param_len;
++	iov->iov_base = iscsi_nla_alloc(param, len);
++	if (!iov->iov_base)
++		return 1;
++
++	attr = iov->iov_base;
++	iov->iov_len = NLA_ALIGN(attr->nla_len);
++
++	param_info = (struct iscsi_param_info *)ISCSI_NLA_DATA(attr);
++	param_info->param = param;
++	param_info->len = param_len;
++
++	switch (param_len) {
++	case 1:
++		val8 = (uint8_t)param_val;
++		val = (char *)&val8;
++		break;
++
++	case 2:
++		val16 = (uint16_t)param_val;
++		val = (char *)&val16;
++		break;
++
++	case 4:
++		val32 = (uint32_t)param_val;
++		val = (char *)&val32;
++		break;
++
++	default:
++		goto free;
++	}
++	memcpy(param_info->value, val, param_len);
++
++	return 0;
++
++free:
++	free(iov->iov_base);
++	iov->iov_base = NULL;
++	iov->iov_len = 0;
++	return 1;
++}
++
++static int chap_fill_param_str(struct iovec *iov, int param, char *param_val,
++			       int param_len)
++{
++	struct iscsi_param_info *param_info;
++	struct nlattr *attr;
++	int len;
++
++	len = sizeof(struct iscsi_param_info) + param_len;
++	iov->iov_base = iscsi_nla_alloc(param, len);
++	if (!iov->iov_base)
++		return 1;
++
++	attr = iov->iov_base;
++	iov->iov_len = NLA_ALIGN(attr->nla_len);
++
++	param_info = (struct iscsi_param_info *)ISCSI_NLA_DATA(attr);
++	param_info->param = param;
++	param_info->len = param_len;
++	memcpy(param_info->value, param_val, param_len);
++	return 0;
++}
++
++int chap_build_config(struct iscsi_chap_rec *crec, struct iovec *iovs)
++{
++	struct iovec *iov = NULL;
++	int count = 0;
++
++	/* start at 2, because 0 is for nlmsghdr and 1 for event */
++	iov = iovs + 2;
++
++	if (!chap_fill_param_uint(&iov[count], ISCSI_CHAP_PARAM_INDEX,
++				  crec->chap_tbl_idx,
++				  sizeof(crec->chap_tbl_idx)))
++		count++;
++
++	if (!chap_fill_param_uint(&iov[count], ISCSI_CHAP_PARAM_CHAP_TYPE,
++				  crec->chap_type, sizeof(crec->chap_type)))
++		count++;
++
++	if (!chap_fill_param_str(&iov[count], ISCSI_CHAP_PARAM_USERNAME,
++				 crec->username, strlen(crec->username)))
++		count++;
++
++	if (!chap_fill_param_str(&iov[count], ISCSI_CHAP_PARAM_PASSWORD,
++				 (char *)crec->password,
++				 strlen((char *)crec->password)))
++		count++;
++
++	if (!chap_fill_param_uint(&iov[count], ISCSI_CHAP_PARAM_PASSWORD_LEN,
++				  crec->password_length,
++				  sizeof(crec->password_length)))
++		count++;
++
++	return count;
++}
+diff --git a/usr/host.h b/usr/host.h
+index 52e5b9e..149aa0d 100644
+--- a/usr/host.h
++++ b/usr/host.h
+@@ -17,5 +17,6 @@ struct host_info {
+ };
+ 
+ extern int host_info_print(int info_level, uint32_t host_no);
++extern int chap_build_config(struct iscsi_chap_rec *crec, struct iovec *iovs);
+ 
+ #endif
+diff --git a/usr/idbm.c b/usr/idbm.c
+index 1e4f8c8..6b6f57c 100644
+--- a/usr/idbm.c
++++ b/usr/idbm.c
+@@ -456,7 +456,7 @@ void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
+ 	__recinfo_uint16(IFACE_PORT, ri, r, port, IDBM_SHOW, num, 1);
+ }
+ 
+-static void idbm_recinfo_host_chap(struct iscsi_chap_rec *r, recinfo_t *ri)
++void idbm_recinfo_host_chap(struct iscsi_chap_rec *r, recinfo_t *ri)
+ {
+ 	int num = 0;
+ 
+@@ -465,14 +465,14 @@ static void idbm_recinfo_host_chap(struct iscsi_chap_rec *r, recinfo_t *ri)
+ 
+ 	if (r->chap_type == CHAP_TYPE_OUT) {
+ 		__recinfo_str(HOST_AUTH_USERNAME, ri, r, username, IDBM_SHOW,
+-			      num, 0);
++			      num, 1);
+ 		__recinfo_str(HOST_AUTH_PASSWORD, ri, r, password, IDBM_MASKED,
+ 			      num, 1);
+ 		__recinfo_int(HOST_AUTH_PASSWORD_LEN, ri, r, password_length,
+ 			      IDBM_HIDE, num, 1);
+ 	} else {
+ 		__recinfo_str(HOST_AUTH_USERNAME_IN, ri, r, username, IDBM_SHOW,
+-			      num, 0);
++			      num, 1);
+ 		__recinfo_str(HOST_AUTH_PASSWORD_IN, ri, r, password,
+ 			      IDBM_MASKED, num, 1);
+ 		__recinfo_int(HOST_AUTH_PASSWORD_IN_LEN, ri, r, password_length,
+@@ -852,6 +852,8 @@ updated:
+ 	check_password_param(discovery.sendtargets.auth.password_in);
+ 	check_password_param(discovery.slp.auth.password);
+ 	check_password_param(discovery.slp.auth.password_in);
++	check_password_param(host.auth.password);
++	check_password_param(host.auth.password_in);
+ 
+ 	return 0;
+ }
+diff --git a/usr/idbm.h b/usr/idbm.h
+index 5e4038d..b9020fe 100644
+--- a/usr/idbm.h
++++ b/usr/idbm.h
+@@ -185,6 +185,7 @@ extern struct node_rec *
+ idbm_create_rec_from_boot_context(struct boot_context *context);
+ 
+ extern int idbm_print_host_chap_info(struct iscsi_chap_rec *chap);
++extern void idbm_recinfo_host_chap(struct iscsi_chap_rec *r, recinfo_t *ri);
+ 
+ extern int idbm_print_flashnode_info(struct flashnode_rec *target);
+ extern void idbm_recinfo_flashnode(struct flashnode_rec *r, recinfo_t *ri);
+diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
+index b6665cb..a32da1c 100644
+--- a/usr/iscsi_ipc.h
++++ b/usr/iscsi_ipc.h
+@@ -143,6 +143,9 @@ struct iscsi_ipc {
+ 			 uint16_t chap_tbl_idx, uint32_t num_entries,
+ 			 char *chap_buf, uint32_t *valid_chap_entries);
+ 
++	int (*set_chap) (uint64_t transport_handle, uint32_t host_no,
++			 struct iovec *iovs, uint32_t param_count);
++
+ 	int (*delete_chap) (uint64_t transport_handle, uint32_t host_no,
+ 			    uint16_t chap_tbl_idx);
+ 	int (*set_flash_node_params) (uint64_t transport_handle,
+diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
+index beabdf0..045259b 100644
+--- a/usr/iscsiadm.c
++++ b/usr/iscsiadm.c
+@@ -115,7 +115,7 @@ static struct option const long_options[] =
+ 	{"packetsize", required_argument, NULL, 'b'},
+ 	{"count", required_argument, NULL, 'c'},
+ 	{"interval", required_argument, NULL, 'i'},
+-	{"index", optional_argument, NULL, 'x'},
++	{"index", required_argument, NULL, 'x'},
+ 	{"portal_type", optional_argument, NULL, 'A'},
+ 	{NULL, 0, NULL, 0},
+ };
+@@ -1426,11 +1426,193 @@ exit_chap_info:
+ 	return rc;
+ }
+ 
++static int fill_host_chap_rec(struct list_head *params,
++			      struct iscsi_chap_rec *crec, recinfo_t *cinfo,
++			      uint16_t chap_tbl_idx, int type, int *param_count)
++{
++	struct user_param *param;
++	int rc = 0;
++
++	crec->chap_tbl_idx = chap_tbl_idx;
++	crec->chap_type = type;
++
++	idbm_recinfo_host_chap(crec, cinfo);
++
++	list_for_each_entry(param, params, list) {
++		rc = idbm_rec_update_param(cinfo, param->name, param->value, 0);
++		if (rc)
++			break;
++	}
++
++	if (!rc)
++		*param_count += 3; /* index, type and password_length */
++
++	return rc;
++}
++
++static int verify_host_chap_params(struct list_head *params, int *type,
++				   int *param_count)
++{
++	struct user_param *param;
++	int username = -1;
++	int password = -1;
++	int rc = 0;
++
++	list_for_each_entry(param, params, list) {
++		*param_count += 1;
++
++		if (!strcmp(param->name, HOST_AUTH_USERNAME))
++			username = CHAP_TYPE_OUT;
++		else if (!strcmp(param->name, HOST_AUTH_PASSWORD))
++			password = CHAP_TYPE_OUT;
++		else if (!strcmp(param->name, HOST_AUTH_USERNAME_IN))
++			username = CHAP_TYPE_IN;
++		else if (!strcmp(param->name, HOST_AUTH_PASSWORD_IN))
++			password = CHAP_TYPE_IN;
++		else
++			continue;
++	}
++
++	if ((username == CHAP_TYPE_OUT) && (password == CHAP_TYPE_OUT)) {
++		if (type)
++			*type = CHAP_TYPE_OUT;
++
++		rc = ISCSI_SUCCESS;
++	} else if ((username == CHAP_TYPE_IN) && (password == CHAP_TYPE_IN)) {
++		if (type)
++			*type = CHAP_TYPE_IN;
++
++		rc = ISCSI_SUCCESS;
++	} else {
++		rc = ISCSI_ERR;
++	}
++
++	return rc;
++}
++
++static int set_host_chap_info(uint32_t host_no, uint64_t chap_index,
++			      struct list_head *params)
++{
++	struct iscsi_transport *t = NULL;
++	struct iscsi_chap_rec crec;
++	recinfo_t *chap_info = NULL;
++	struct iovec *iovs = NULL;
++	struct iovec *iov = NULL;
++	int type;
++	int param_count;
++	int param_used;
++	int rc = 0;
++	int fd, i = 0;
++
++	if (list_empty(params)) {
++		log_error("Chap username/password not provided.");
++		goto exit_set_chap;
++	}
++
++	chap_info = idbm_recinfo_alloc(MAX_KEYS);
++	if (!chap_info) {
++		log_error("Out of Memory.");
++		rc = ISCSI_ERR_NOMEM;
++		goto exit_set_chap;
++	}
++
++	t = iscsi_sysfs_get_transport_by_hba(host_no);
++	if (!t) {
++		log_error("Could not match hostno %d to transport.", host_no);
++		rc = ISCSI_ERR_TRANS_NOT_FOUND;
++		goto free_info_rec;
++	}
++
++	rc = verify_host_chap_params(params, &type, &param_count);
++	if (rc) {
++		log_error("Invalid username/password pair passed. Unable to determine the type of chap entry");
++		rc = ISCSI_ERR_INVAL;
++		goto free_info_rec;
++	}
++
++	if (param_count > 2) {
++		log_error("Only one pair of username/password can be passed.");
++		rc = ISCSI_ERR;
++		goto free_info_rec;
++	}
++
++	memset(&crec, 0, sizeof(crec));
++	rc = fill_host_chap_rec(params, &crec, chap_info, chap_index, type,
++				&param_count);
++	if (rc) {
++		log_error("Unable to fill CHAP record");
++		goto free_info_rec;
++	}
++
++	/* +2 for event and nlmsghdr */
++	param_count += 2;
++	iovs = calloc((param_count * sizeof(struct iovec)),
++		       sizeof(char));
++	if (!iovs) {
++		log_error("Out of Memory.");
++		rc = ISCSI_ERR_NOMEM;
++		goto free_info_rec;
++	}
++
++	/* param_used gives actual number of iovecs used for chap */
++	param_used = chap_build_config(&crec, iovs);
++	if (!param_used) {
++		log_error("Build chap config failed.");
++		rc = ISCSI_ERR;
++		goto free_iovec;
++	}
++
++	fd = ipc->ctldev_open();
++	if (fd < 0) {
++		rc = ISCSI_ERR_INTERNAL;
++		log_error("Netlink open failed.");
++		goto free_iovec;
++	}
++
++	rc = ipc->set_chap(t->handle, host_no, iovs, param_count);
++	if (rc < 0) {
++		log_error("CHAP setting failed");
++		if (rc == -EBUSY) {
++			rc = ISCSI_ERR_BUSY;
++			log_error("CHAP index %d is in use.",
++				  crec.chap_tbl_idx);
++		} else {
++			rc = ISCSI_ERR;
++		}
++
++		goto exit_set_chap;
++	}
++
++	ipc->ctldev_close();
++
++free_iovec:
++	/* start at 2, because 0 is for nlmsghdr and 1 for event */
++	iov = iovs + 2;
++	for (i = 0; i < param_used; i++, iov++) {
++		if (iov->iov_base)
++			free(iov->iov_base);
++	}
++
++	free(iovs);
++
++free_info_rec:
++	if (chap_info)
++		free(chap_info);
++
++exit_set_chap:
++	return rc;
++}
++
+ static int delete_host_chap_info(uint32_t host_no, uint16_t chap_tbl_idx)
+ {
+ 	struct iscsi_transport *t = NULL;
+ 	int fd, rc = 0;
+ 
++	if (chap_tbl_idx > MAX_CHAP_ENTRIES) {
++		log_error("Invalid chap table index.");
++		goto exit_delete_chap;
++	}
++
+ 	t = iscsi_sysfs_get_transport_by_hba(host_no);
+ 	if (!t) {
+ 		log_error("Could not match hostno %d to "
+@@ -1464,19 +1646,18 @@ exit_delete_chap:
+ }
+ 
+ static int exec_host_chap_op(int op, int info_level, uint32_t host_no,
+-			     uint64_t chap_index)
++			     uint64_t chap_index, struct list_head *params)
+ {
+ 	int rc = ISCSI_ERR_INVAL;
+ 
+-	if (op != OP_SHOW && (chap_index > (uint64_t)MAX_CHAP_ENTRIES)) {
+-		log_error("Invalid chap table index.");
+-		goto exit_chap_op;
+-	}
+-
+ 	switch (op) {
+ 	case OP_SHOW:
+ 		rc = get_host_chap_info(host_no);
+ 		break;
++	case OP_NEW:
++	case OP_UPDATE:
++		rc = set_host_chap_info(host_no, chap_index, params);
++		break;
+ 	case OP_DELETE:
+ 		rc = delete_host_chap_info(host_no, chap_index);
+ 		break;
+@@ -1485,7 +1666,6 @@ static int exec_host_chap_op(int op, int info_level, uint32_t host_no,
+ 		break;
+ 	}
+ 
+-exit_chap_op:
+ 	return rc;
+ }
+ 
+@@ -2816,7 +2996,7 @@ main(int argc, char **argv)
+ 	struct iface_rec *iface = NULL, *tmp;
+ 	struct node_rec *rec = NULL;
+ 	uint64_t host_no =  (uint64_t)MAX_HOST_NO + 1;
+-	uint64_t index = (uint64_t)MAX_FLASHNODE_IDX + 1;
++	uint64_t index = ULLONG_MAX;
+ 	struct user_param *param;
+ 	struct list_head params;
+ 
+@@ -3038,8 +3218,12 @@ main(int argc, char **argv)
+ 					rc = ISCSI_ERR_INVAL;
+ 					break;
+ 				}
++
++				if (index == ULLONG_MAX)
++					index = (uint64_t)MAX_CHAP_ENTRIES + 1;
++
+ 				rc = exec_host_chap_op(op, info_level, host_no,
+-						       index);
++						       index, &params);
+ 				break;
+ 			case MODE_FLASHNODE:
+ 				if (host_no > MAX_HOST_NO) {
+@@ -3048,6 +3232,9 @@ main(int argc, char **argv)
+ 					break;
+ 				}
+ 
++				if (index == ULLONG_MAX)
++					index = (uint64_t)MAX_FLASHNODE_IDX + 1;
++
+ 				rc = exec_flashnode_op(op, info_level, host_no,
+ 						       index, portal_type,
+ 						       &params);
+diff --git a/usr/netlink.c b/usr/netlink.c
+index c07fe3c..151b56d 100644
+--- a/usr/netlink.c
++++ b/usr/netlink.c
+@@ -1228,6 +1228,30 @@ static int kget_chap(uint64_t transport_handle, uint32_t host_no,
+ 	return rc;
+ }
+ 
++static int kset_chap(uint64_t transport_handle, uint32_t host_no,
++			struct iovec *iovs, uint32_t param_count)
++{
++	int rc, ev_len;
++	struct iscsi_uevent ev;
++	struct iovec *iov = iovs + 1;
++
++	log_debug(8, "in %s", __func__);
++
++	ev_len = sizeof(ev);
++	ev.type = ISCSI_UEVENT_SET_CHAP;
++	ev.transport_handle = transport_handle;
++	ev.u.set_path.host_no = host_no;
++
++	iov->iov_base = &ev;
++	iov->iov_len = sizeof(ev);
++
++	rc = __kipc_call(iovs, param_count);
++	if (rc < 0)
++		return rc;
++
++	return 0;
++}
++
+ static int kdelete_chap(uint64_t transport_handle, uint32_t host_no,
+ 			uint16_t chap_tbl_idx)
+ {
+@@ -1705,6 +1729,7 @@ struct iscsi_ipc nl_ipc = {
+ 	.recv_conn_state        = krecv_conn_state,
+ 	.exec_ping		= kexec_ping,
+ 	.get_chap		= kget_chap,
++	.set_chap		= kset_chap,
+ 	.delete_chap		= kdelete_chap,
+ 	.set_flash_node_params	= kset_flashnode_params,
+ 	.new_flash_node		= knew_flashnode,
+-- 
+1.8.3.1
+
diff --git a/0040-iscsi-tools-Correctly-get-username_in-and-password_i.patch b/0040-iscsi-tools-Correctly-get-username_in-and-password_i.patch
new file mode 100644
index 0000000..e15c4b1
--- /dev/null
+++ b/0040-iscsi-tools-Correctly-get-username_in-and-password_i.patch
@@ -0,0 +1,37 @@
+From 65ce3a27da47cecf71015b16b1d186c49cbb7bcc Mon Sep 17 00:00:00 2001
+From: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Date: Tue, 17 Sep 2013 08:07:33 -0400
+Subject: [PATCH] iscsi tools: Correctly get username_in and password_in
+ flashnode params
+
+Fix to correctly read username_in and password_in sysfs params for
+flashnode session.
+
+Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Signed-off-by: Vikas Chaudhary <vikas.chaudhary at qlogic.com>
+---
+ usr/iscsi_sysfs.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
+index 56cb90c..04c3673 100644
+--- a/usr/iscsi_sysfs.c
++++ b/usr/iscsi_sysfs.c
+@@ -601,12 +601,12 @@ int iscsi_sysfs_get_flashnode_info(struct flashnode_rec *fnode,
+ 	sysfs_get_str(sess_id, ISCSI_FLASHNODE_SUBSYS, "username",
+ 		      (fnode->sess).username, sizeof((fnode->sess).username));
+ 	sysfs_get_str(sess_id, ISCSI_FLASHNODE_SUBSYS, "username_in",
+-		      (fnode->sess).username,
++		      (fnode->sess).username_in,
+ 		      sizeof((fnode->sess).username_in));
+ 	sysfs_get_str(sess_id, ISCSI_FLASHNODE_SUBSYS, "password",
+ 		      (fnode->sess).password, sizeof((fnode->sess).password));
+ 	sysfs_get_str(sess_id, ISCSI_FLASHNODE_SUBSYS, "password_in",
+-		      (fnode->sess).password,
++		      (fnode->sess).password_in,
+ 		      sizeof((fnode->sess).password_in));
+ 	sysfs_get_uint(conn_id, ISCSI_FLASHNODE_SUBSYS, "statsn",
+ 		       &((fnode->conn[0]).stat_sn));
+-- 
+1.8.3.1
+
diff --git a/0041-README-changes-for-adding-support-to-set-CHAP-entry.patch b/0041-README-changes-for-adding-support-to-set-CHAP-entry.patch
new file mode 100644
index 0000000..35d9d5d
--- /dev/null
+++ b/0041-README-changes-for-adding-support-to-set-CHAP-entry.patch
@@ -0,0 +1,84 @@
+From f1ed1f7049f42ad12f5e6bf5b02de75290271c56 Mon Sep 17 00:00:00 2001
+From: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Date: Tue, 17 Sep 2013 08:07:34 -0400
+Subject: [PATCH] README changes for adding support to set CHAP entry
+
+README changes for the support added to set CHAP entry using chap
+submode of iscsiadm host mode.
+
+Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi at qlogic.com>
+Signed-off-by: Vikas Chaudhary <vikas.chaudhary at qlogic.com>
+---
+ README | 42 +++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 41 insertions(+), 1 deletion(-)
+
+diff --git a/README b/README
+index dda16c9..813548d 100644
+--- a/README
++++ b/README
+@@ -393,7 +393,7 @@ Usage: iscsiadm [OPTION]
+ 			  See below for examples.
+   -m iface --interface=iscsi_ifacename -C ping --ip=[ipaddr] --packetsize=[size]
+ 				--count=[count] --interval=[interval]
+-  -m host --host=hostno|MAC --print=level -C chap --op=[op] --index=[chap_tbl_idx]
++  -m host --host=hostno|MAC --print=level -C chap --op=[SHOW]
+ 			  Display information for a specific host. The host
+ 			  can be passed in by host number or by MAC address.
+ 			  If a host is not passed in then info
+@@ -406,6 +406,14 @@ Usage: iscsiadm [OPTION]
+ 			  is connected to.
+ 			  3 = Print iscsi params used.
+ 			  4 = Print SCSI info like LUNs, device state.
++  -m host --host=hostno|MAC -C chap --op=[DELETE] --index=[chap_tbl_idx]
++			   Delete chap entry at the given index from chap table.
++  -m host --host=hostno|MAC -C chap --op=[NEW | UPDATE] --index=[chap_tbl_idx] \
++				--name=[name] --value=[value]
++			  Add new or update existing chap entry at the given
++			  index with given username and password pair. If index
++			  is not passed then entry is added at the first free
++			  index in chap table.
+   -m host --host=hostno|MAC -C flashnode
+ 			  Display list of all the targets in adapter's
+ 			  flash (flash node), for the specified host,
+@@ -1033,6 +1041,38 @@ To now log into targets it is the same as with sofware iscsi. See section
+     - Delete a flash node entry
+ 	    ./iscsiadm -m host -H 6 -C flashnode -x 1 -o delete
+ 
++    Host mode with chap submode:
++
++    - Display list of chap entries for a host
++
++	    ./iscsiadm -m host -H 6 -C chap -o show
++
++	This will list all the chap entries for the given host.
++
++    - Delete a chap entry for a host
++
++	    ./iscsiadm -m host -H 6 -C chap -o delete -x 5
++
++	This will delete any chap entry present at given index 5.
++
++    - Add/Update a local chap entry for a host
++
++	    ./iscsiadm -m host -H 6 -C chap -o update -x 4 -n username \
++			-v value -n password -v value
++
++	This will update the local chap entry present at index 4. If index 4
++	is free then entry of type local chap will be created at that index
++	with given username and password values.
++
++    - Add/Update a bidi chap entry for a host
++
++	    ./iscsiadm -m host -H 6 -C chap -o update -x 5 -n username_in \
++			-v value -n password_in -v value
++
++	This will update the bidi chap entry present at index 5. If index 5
++	is free then entry of type bidi chap will be created at that index
++	with given username_in and password_in values.
++
+ 6. Configuration
+ ================
+ 
+-- 
+1.8.3.1
+
diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec
index 78359b6..e3b2fe5 100644
--- a/iscsi-initiator-utils.spec
+++ b/iscsi-initiator-utils.spec
@@ -47,6 +47,15 @@ Patch30: 0030-iscsi-tools-sync-iscsi_if.h-with-kernel-space.patch
 Patch31: 0031-PATCH-v5-1-3-ISCSISTART-Saved-ibft-boot-info-to-the-.patch
 Patch32: 0032-ISCSID-Added-the-extraction-of-the-session-boot-info.patch
 Patch33: 0033-ISCSID-Added-iface-content-override-fix.patch
+Patch34: 0034-iscsi-tools-Bug-fix-on-IPC-address-copy-version-2.patch
+Patch35: 0035-flashnode-Add-support-to-set-ISCSI_FLASHNODE_CHAP_OU.patch
+Patch36: 0036-iscsiadm-Use-x-option-instead-of-v-to-specify-chap_t.patch
+Patch37: 0037-iscsiadm-Man-page-changes-to-use-x-option-for-chap_t.patch
+Patch38: 0038-README-changes-to-use-long-option-index-instead-of-f.patch
+Patch39: 0039-iscsiadm-Add-support-to-set-CHAP-entry-using-host-ch.patch
+Patch40: 0040-iscsi-tools-Correctly-get-username_in-and-password_i.patch
+Patch41: 0041-README-changes-for-adding-support-to-set-CHAP-entry.patch
+
 # not (yet) upstream merged
 Patch43: 0043-idmb_rec_write-check-for-tpgt-first.patch
 Patch45: 0045-idbm_rec_write-seperate-old-and-new-style-writes.patch
@@ -132,6 +141,14 @@ developing applications that use %{name}.
 %patch31 -p1
 %patch32 -p1
 %patch33 -p1
+%patch34 -p1
+%patch35 -p1
+%patch36 -p1
+%patch37 -p1
+%patch38 -p1
+%patch39 -p1
+%patch40 -p1
+%patch41 -p1
 # pending upstream merge
 %patch43 -p1
 %patch45 -p1
@@ -307,6 +324,7 @@ fi
 - 1007388 fixes for iscsiadm to support qla4xxx
 - refresh boot session info patches to final version from upstream,
   fixes context issues with later patches
+- 1006156, 1006161 Add/Update entries in chap table through Open-iSCSI
 
 * Fri Jan 24 2014 Daniel Mach <dmach at redhat.com> - 6.2.0.873-18
 - Mass rebuild 2014-01-24


More information about the scm-commits mailing list