Merge remote-tracking branch 'rhel/rhel-7.0'

Conflicts:
	0146-idbw_rec_write-pick-tpgt-from-existing-record.patch
	0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
	iscsi-initiator-utils.spec
This commit is contained in:
Chris Leech 2014-04-14 09:54:08 -07:00
commit f8da4ee7c1
73 changed files with 24181 additions and 158 deletions

View File

@ -0,0 +1,213 @@
From 3256b93ee3025bf76757001ff3d24914c4c4af28 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Tue, 9 Jul 2013 08:17:14 -0400
Subject: [PATCH] iscsiadm: Correctly check for invalid hostno and flashnode
index
In host mode, correctly compare for invalid hostno and flashnode index.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/flashnode.h | 2 ++
usr/host.h | 2 ++
usr/iscsiadm.c | 48 ++++++++++++++++++++++++++++++------------------
usr/types.h | 1 +
4 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/usr/flashnode.h b/usr/flashnode.h
index c1de9cc..2950fb5 100644
--- a/usr/flashnode.h
+++ b/usr/flashnode.h
@@ -26,6 +26,8 @@
#include "config.h"
#include "auth.h"
+#define MAX_FLASHNODE_IDX UINT_MAX
+
typedef enum portal_type {
IPV4,
IPV6,
diff --git a/usr/host.h b/usr/host.h
index 894ab91..db44cfa 100644
--- a/usr/host.h
+++ b/usr/host.h
@@ -5,6 +5,8 @@
#include "types.h"
#include "config.h"
+#define MAX_HOST_NO UINT_MAX
+
#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 da0a3ec..c7337ae 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1744,20 +1744,22 @@ exit_logout_sid:
}
static int exec_flashnode_op(int op, int info_level, uint32_t host_no,
- uint32_t flashnode_idx, int type,
+ uint64_t fnode_idx, int type,
struct list_head *params)
{
struct iscsi_transport *t = NULL;
int rc = ISCSI_SUCCESS;
char *portal_type;
+ uint32_t flashnode_idx;
if (op != OP_SHOW && op != OP_NOOP && op != OP_NEW &&
- flashnode_idx == 0xffffffff) {
+ fnode_idx > MAX_FLASHNODE_IDX) {
log_error("Invalid flashnode index");
rc = ISCSI_ERR_INVAL;
goto exit_flashnode_op;
}
+ flashnode_idx = (uint32_t)fnode_idx;
t = iscsi_sysfs_get_transport_by_hba(host_no);
if (!t) {
log_error("Could not match hostno %u to transport.", host_no);
@@ -1768,7 +1770,7 @@ static int exec_flashnode_op(int op, int info_level, uint32_t host_no,
switch (op) {
case OP_NOOP:
case OP_SHOW:
- if (flashnode_idx == 0xffffffff)
+ if (fnode_idx > MAX_FLASHNODE_IDX)
rc = list_flashnodes(info_level, host_no);
else
rc = get_flashnode_info(host_no, flashnode_idx);
@@ -1880,7 +1882,7 @@ static int verify_iface_params(struct list_head *params, struct node_rec *rec)
/* TODO: merge iter helpers and clean them up, so we can use them here */
static int exec_iface_op(int op, int do_show, int info_level,
- struct iface_rec *iface, uint32_t host_no,
+ struct iface_rec *iface, uint64_t host_no,
struct list_head *params)
{
struct host_info hinfo;
@@ -2001,9 +2003,9 @@ update_fail:
printf("%s applied.\n", iface->name);
break;
case OP_APPLY_ALL:
- if (host_no == -1) {
- log_error("Applyall requires a host number or MAC "
- "passed in with the --host argument.");
+ if (host_no > MAX_HOST_NO) {
+ log_error("Applyall requires a valid host number or MAC"
+ " passed in with the --host argument.");
rc = ISCSI_ERR_INVAL;
break;
}
@@ -2014,7 +2016,7 @@ update_fail:
memset(&hinfo, 0, sizeof(struct host_info));
hinfo.host_no = host_no;
if (iscsi_sysfs_get_hostinfo_by_host_no(&hinfo)) {
- log_error("Could not match host%u to ifaces.", host_no);
+ log_error("Could not match host%lu to ifaces.", host_no);
rc = ISCSI_ERR_INVAL;
break;
}
@@ -2025,7 +2027,7 @@ update_fail:
break;
}
- printf("Applied settings to ifaces attached to host%u.\n",
+ printf("Applied settings to ifaces attached to host%lu.\n",
host_no);
break;
default:
@@ -2637,10 +2639,10 @@ done:
return rc;
}
-static uint32_t parse_host_info(char *optarg, int *rc)
+static uint64_t parse_host_info(char *optarg, int *rc)
{
int err = 0;
- uint32_t host_no = -1;
+ uint64_t host_no;
*rc = 0;
if (strstr(optarg, ":")) {
@@ -2653,8 +2655,11 @@ static uint32_t parse_host_info(char *optarg, int *rc)
*rc = ISCSI_ERR_INVAL;
}
} else {
- host_no = strtoul(optarg, NULL, 10);
- if (errno) {
+ host_no = strtoull(optarg, NULL, 10);
+ if (errno || (host_no > MAX_HOST_NO)) {
+ if (host_no > MAX_HOST_NO)
+ errno = ERANGE;
+
log_error("Invalid host no %s. %s.",
optarg, strerror(errno));
*rc = ISCSI_ERR_INVAL;
@@ -2806,13 +2811,14 @@ main(int argc, char **argv)
int tpgt = PORTAL_GROUP_TAG_UNKNOWN, killiscsid=-1, do_show=0;
int packet_size=32, ping_count=1, ping_interval=0;
int do_discover = 0, sub_mode = -1;
- int flashnode_idx = -1, portal_type = -1;
+ int portal_type = -1;
struct sigaction sa_old;
struct sigaction sa_new;
struct list_head ifaces;
struct iface_rec *iface = NULL, *tmp;
struct node_rec *rec = NULL;
- uint32_t host_no = -1;
+ uint64_t host_no = (uint64_t)MAX_HOST_NO + 1;
+ uint64_t flashnode_idx = (uint64_t)MAX_FLASHNODE_IDX + 1;
struct user_param *param;
struct list_head params;
@@ -2956,7 +2962,13 @@ main(int argc, char **argv)
ISCSI_VERSION_STR);
return 0;
case 'x':
- flashnode_idx = atoi(optarg);
+ flashnode_idx = strtoull(optarg, NULL, 10);
+ if (errno) {
+ log_error("Invalid flashnode index %s. %s.",
+ optarg, strerror(errno));
+ rc = ISCSI_ERR_INVAL;
+ goto free_ifaces;
+ }
break;
case 'A':
portal_type = str_to_portal_type(optarg);
@@ -3022,7 +3034,7 @@ main(int argc, char **argv)
if (sub_mode != -1) {
switch (sub_mode) {
case MODE_CHAP:
- if (!op || !host_no) {
+ if (!op || (host_no > MAX_HOST_NO)) {
log_error("CHAP mode requires host "
"no and valid operation");
rc = ISCSI_ERR_INVAL;
@@ -3032,7 +3044,7 @@ main(int argc, char **argv)
value);
break;
case MODE_FLASHNODE:
- if (!host_no) {
+ if (host_no > MAX_HOST_NO) {
log_error("FLASHNODE mode requires host no");
rc = ISCSI_ERR_INVAL;
break;
diff --git a/usr/types.h b/usr/types.h
index 77e3f97..9d9ba86 100644
--- a/usr/types.h
+++ b/usr/types.h
@@ -10,6 +10,7 @@
#include <netinet/in.h>
#include <stdint.h>
#include <sys/types.h>
+#include <limits.h>
/*
* using the __be types allows stricter static
--
1.8.3.1

View File

@ -0,0 +1,74 @@
From 181af9ac81bccbf8e63a755d48babb2e65de1d4e Mon Sep 17 00:00:00 2001
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Date: Tue, 9 Jul 2013 08:17:15 -0400
Subject: [PATCH] iscsi tools: Print additional session info for flashnode
session
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/session_info.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/usr/session_info.c b/usr/session_info.c
index de156c6..2f48e65 100644
--- a/usr/session_info.c
+++ b/usr/session_info.c
@@ -64,20 +64,32 @@ void session_info_free_list(struct list_head *list)
}
}
+static char *get_iscsi_node_type(struct session_info *info)
+{
+ int pid = iscsi_sysfs_session_user_created(info->sid);
+
+ if (!pid)
+ return "flash";
+ else
+ return "non-flash";
+}
+
static int session_info_print_flat(void *data, struct session_info *info)
{
struct iscsi_transport *t = iscsi_sysfs_get_transport_by_sid(info->sid);
if (strchr(info->persistent_address, '.'))
- printf("%s: [%d] %s:%d,%d %s\n",
+ printf("%s: [%d] %s:%d,%d %s (%s)\n",
t ? t->name : UNKNOWN_VALUE,
info->sid, info->persistent_address,
- info->persistent_port, info->tpgt, info->targetname);
+ info->persistent_port, info->tpgt, info->targetname,
+ get_iscsi_node_type(info));
else
- printf("%s: [%d] [%s]:%d,%d %s\n",
+ printf("%s: [%d] [%s]:%d,%d %s (%s)\n",
t ? t->name : UNKNOWN_VALUE,
info->sid, info->persistent_address,
- info->persistent_port, info->tpgt, info->targetname);
+ info->persistent_port, info->tpgt, info->targetname,
+ get_iscsi_node_type(info));
return 0;
}
@@ -230,7 +242,8 @@ void session_info_print_tree(struct list_head *list, char *prefix,
list_for_each_entry(curr, list, list) {
if (!prev || strcmp(prev->targetname, curr->targetname)) {
- printf("%sTarget: %s\n", prefix, curr->targetname);
+ printf("%sTarget: %s (%s)\n", prefix, curr->targetname,
+ get_iscsi_node_type(curr));
prev = NULL;
}
@@ -278,6 +291,7 @@ void session_info_print_tree(struct list_head *list, char *prefix,
printf("%s\t\tSID: %d\n", prefix, curr->sid);
print_iscsi_state(curr->sid, prefix);
}
+
if (flags & SESSION_INFO_ISCSI_TIM) {
printf("%s\t\t*********\n", prefix);
printf("%s\t\tTimeouts:\n", prefix);
--
1.8.3.1

View File

@ -0,0 +1,369 @@
From 82c853344888c2d541d6445a08ab31cbcf1c140f Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 11 Sep 2013 17:31:39 -0700
Subject: [PATCH] iscsi tools: sync iscsi_if.h with kernel space
This patches syncs iscsi_if.h with upstream commit
commit ae542edb11c79706cd74d7bd54ebd7702965a7f3
Author: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Mon Jul 1 05:54:11 2013 -0400
[SCSI] scsi_transport_iscsi: Exporting new attrs for iscsi session
and conne
---
include/iscsi_if.h | 204 ++++++++++++++++++-------------------------------
usr/initiator.c | 12 +--
usr/initiator.h | 1 +
usr/initiator_common.c | 38 +++++----
4 files changed, 99 insertions(+), 156 deletions(-)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 20f2bc2..01d38e7 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -495,47 +495,64 @@ enum iscsi_param {
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+ ISCSI_PARAM_CHAP_IN_IDX,
+ ISCSI_PARAM_CHAP_OUT_IDX,
+
+ ISCSI_PARAM_BOOT_ROOT,
+ ISCSI_PARAM_BOOT_NIC,
+ ISCSI_PARAM_BOOT_TARGET,
+
+ ISCSI_PARAM_AUTO_SND_TGT_DISABLE,
+ ISCSI_PARAM_DISCOVERY_SESS,
+ ISCSI_PARAM_PORTAL_TYPE,
+ ISCSI_PARAM_CHAP_AUTH_EN,
+ ISCSI_PARAM_DISCOVERY_LOGOUT_EN,
+ ISCSI_PARAM_BIDI_CHAP_EN,
+ ISCSI_PARAM_DISCOVERY_AUTH_OPTIONAL,
+
+ ISCSI_PARAM_DEF_TIME2WAIT,
+ ISCSI_PARAM_DEF_TIME2RETAIN,
+ ISCSI_PARAM_MAX_SEGMENT_SIZE,
+ ISCSI_PARAM_STATSN,
+ ISCSI_PARAM_KEEPALIVE_TMO,
+ ISCSI_PARAM_LOCAL_PORT,
+ ISCSI_PARAM_TSID,
+ ISCSI_PARAM_DEF_TASKMGMT_TMO,
+
+ ISCSI_PARAM_TCP_TIMESTAMP_STAT,
+ ISCSI_PARAM_TCP_WSF_DISABLE,
+ ISCSI_PARAM_TCP_NAGLE_DISABLE,
+ ISCSI_PARAM_TCP_TIMER_SCALE,
+ ISCSI_PARAM_TCP_TIMESTAMP_EN,
+ ISCSI_PARAM_TCP_XMIT_WSF,
+ ISCSI_PARAM_TCP_RECV_WSF,
+ ISCSI_PARAM_IP_FRAGMENT_DISABLE,
+ ISCSI_PARAM_IPV4_TOS,
+ ISCSI_PARAM_IPV6_TC,
+ ISCSI_PARAM_IPV6_FLOW_LABEL,
+ ISCSI_PARAM_IS_FW_ASSIGNED_IPV6,
+
+ ISCSI_PARAM_DISCOVERY_PARENT_IDX,
+ ISCSI_PARAM_DISCOVERY_PARENT_TYPE,
/* must always be last */
ISCSI_PARAM_MAX,
};
-#define ISCSI_MAX_RECV_DLENGTH (1ULL << ISCSI_PARAM_MAX_RECV_DLENGTH)
-#define ISCSI_MAX_XMIT_DLENGTH (1ULL << ISCSI_PARAM_MAX_XMIT_DLENGTH)
-#define ISCSI_HDRDGST_EN (1ULL << ISCSI_PARAM_HDRDGST_EN)
-#define ISCSI_DATADGST_EN (1ULL << ISCSI_PARAM_DATADGST_EN)
-#define ISCSI_INITIAL_R2T_EN (1ULL << ISCSI_PARAM_INITIAL_R2T_EN)
-#define ISCSI_MAX_R2T (1ULL << ISCSI_PARAM_MAX_R2T)
-#define ISCSI_IMM_DATA_EN (1ULL << ISCSI_PARAM_IMM_DATA_EN)
-#define ISCSI_FIRST_BURST (1ULL << ISCSI_PARAM_FIRST_BURST)
-#define ISCSI_MAX_BURST (1ULL << ISCSI_PARAM_MAX_BURST)
-#define ISCSI_PDU_INORDER_EN (1ULL << ISCSI_PARAM_PDU_INORDER_EN)
-#define ISCSI_DATASEQ_INORDER_EN (1ULL << ISCSI_PARAM_DATASEQ_INORDER_EN)
-#define ISCSI_ERL (1ULL << ISCSI_PARAM_ERL)
-#define ISCSI_IFMARKER_EN (1ULL << ISCSI_PARAM_IFMARKER_EN)
-#define ISCSI_OFMARKER_EN (1ULL << ISCSI_PARAM_OFMARKER_EN)
-#define ISCSI_EXP_STATSN (1ULL << ISCSI_PARAM_EXP_STATSN)
-#define ISCSI_TARGET_NAME (1ULL << ISCSI_PARAM_TARGET_NAME)
-#define ISCSI_TPGT (1ULL << ISCSI_PARAM_TPGT)
-#define ISCSI_PERSISTENT_ADDRESS (1ULL << ISCSI_PARAM_PERSISTENT_ADDRESS)
-#define ISCSI_PERSISTENT_PORT (1ULL << ISCSI_PARAM_PERSISTENT_PORT)
-#define ISCSI_SESS_RECOVERY_TMO (1ULL << ISCSI_PARAM_SESS_RECOVERY_TMO)
-#define ISCSI_CONN_PORT (1ULL << ISCSI_PARAM_CONN_PORT)
-#define ISCSI_CONN_ADDRESS (1ULL << ISCSI_PARAM_CONN_ADDRESS)
-#define ISCSI_USERNAME (1ULL << ISCSI_PARAM_USERNAME)
-#define ISCSI_USERNAME_IN (1ULL << ISCSI_PARAM_USERNAME_IN)
-#define ISCSI_PASSWORD (1ULL << ISCSI_PARAM_PASSWORD)
-#define ISCSI_PASSWORD_IN (1ULL << ISCSI_PARAM_PASSWORD_IN)
-#define ISCSI_FAST_ABORT (1ULL << ISCSI_PARAM_FAST_ABORT)
-#define ISCSI_ABORT_TMO (1ULL << ISCSI_PARAM_ABORT_TMO)
-#define ISCSI_LU_RESET_TMO (1ULL << ISCSI_PARAM_LU_RESET_TMO)
-#define ISCSI_HOST_RESET_TMO (1ULL << ISCSI_PARAM_HOST_RESET_TMO)
-#define ISCSI_PING_TMO (1ULL << ISCSI_PARAM_PING_TMO)
-#define ISCSI_RECV_TMO (1ULL << ISCSI_PARAM_RECV_TMO)
-#define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME)
-#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
-#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
-#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
-#define ISCSI_TARGET_ALIAS (1ULL << ISCSI_PARAM_TARGET_ALIAS)
+/* iSCSI HBA params */
+enum iscsi_host_param {
+ ISCSI_HOST_PARAM_HWADDRESS,
+ ISCSI_HOST_PARAM_INITIATOR_NAME,
+ ISCSI_HOST_PARAM_NETDEV_NAME,
+ ISCSI_HOST_PARAM_IPADDRESS,
+ ISCSI_HOST_PARAM_PORT_STATE,
+ ISCSI_HOST_PARAM_PORT_SPEED,
+ ISCSI_HOST_PARAM_MAX,
+};
+
+/* portal type */
+#define PORTAL_TYPE_IPV4 "ipv4"
+#define PORTAL_TYPE_IPV6 "ipv6"
/* iSCSI Flash Target params */
enum iscsi_flashnode_param {
@@ -603,106 +620,32 @@ enum iscsi_flashnode_param {
ISCSI_FLASHNODE_MAX,
};
-#define ISCSI_FNODE_IS_FW_ASSIGNED_IPV6 \
- (1ULL << ISCSI_FLASHNODE_IS_FW_ASSIGNED_IPV6)
-#define ISCSI_FNODE_PORTAL_TYPE (1ULL << ISCSI_FLASHNODE_PORTAL_TYPE)
-#define ISCSI_FNODE_AUTO_SND_TGT_DISABLE \
- (1ULL << ISCSI_FLASHNODE_OPT_AUTO_SND_TGT_DISABLE)
-#define ISCSI_FNODE_DISCOVERY_SESS \
- (1ULL << ISCSI_FLASHNODE_OPT_DISCOVERY_SESS)
-#define ISCSI_FNODE_ENTRY_EN (1ULL << ISCSI_FLASHNODE_ENTRY_EN)
-#define ISCSI_FNODE_HDR_DGST_EN (1ULL << ISCSI_FLASHNODE_HDR_DGST_EN)
-#define ISCSI_FNODE_DATA_DGST_EN (1ULL << ISCSI_FLASHNODE_DATA_DGST_EN)
-#define ISCSI_FNODE_IMM_DATA_EN (1ULL << ISCSI_FLASHNODE_IMM_DATA_EN)
-#define ISCSI_FNODE_INITIAL_R2T_EN (1ULL << ISCSI_FLASHNODE_INITIAL_R2T_EN)
-#define ISCSI_FNODE_DATASEQ_INORDER \
- (1ULL << ISCSI_FLASHNODE_DATASEQ_INORDER)
-#define ISCSI_FNODE_PDU_INORDER (1ULL << ISCSI_FLASHNODE_PDU_INORDER)
-#define ISCSI_FNODE_CHAP_AUTH_EN (1ULL << ISCSI_FLASHNODE_CHAP_AUTH_EN)
-#define ISCSI_FNODE_SNACK_REQ_EN (1ULL << ISCSI_FLASHNODE_SNACK_REQ_EN)
-#define ISCSI_FNODE_DISCOVERY_LOGOUT_EN \
- (1ULL << ISCSI_FLASHNODE_DISCOVERY_LOGOUT_EN)
-#define ISCSI_FNODE_BIDI_CHAP_EN (1ULL << ISCSI_FLASHNODE_BIDI_CHAP_EN)
-#define ISCSI_FNODE_DISCOVERY_AUTH_OPTIONAL \
- (1ULL << ISCSI_FLASHNODE_DISCOVERY_AUTH_OPTIONAL)
-#define ISCSI_FNODE_ERL (1ULL << ISCSI_FLASHNODE_ERL)
-#define ISCSI_FNODE_TCP_TIMESTAMP_STAT \
- (1ULL << ISCSI_FLASHNODE_TCP_TIMESTAMP_STAT)
-#define ISCSI_FNODE_TCP_NAGLE_DISABLE \
- (1ULL << ISCSI_FLASHNODE_TCP_NAGLE_DISABLE)
-#define ISCSI_FNODE_TCP_WSF_DISABLE \
- (1ULL << ISCSI_FLASHNODE_TCP_WSF_DISABLE)
-#define ISCSI_FNODE_TCP_TIMER_SCALE \
- (1ULL << ISCSI_FLASHNODE_TCP_TIMER_SCALE)
-#define ISCSI_FNODE_TCP_TIMESTAMP_ENABLE \
- (1ULL << ISCSI_FLASHNODE_TCP_TIMESTAMP_ENABLE)
-#define ISCSI_FNODE_IP_FRAG_DISABLE \
- (1ULL << ISCSI_FLASHNODE_IP_FRAG_DISABLE)
-#define ISCSI_FNODE_MAX_RECV_DLENGTH \
- (1ULL << ISCSI_FLASHNODE_MAX_RECV_DLENGTH)
-#define ISCSI_FNODE_MAX_XMIT_DLENGTH \
- (1ULL << ISCSI_FLASHNODE_MAX_XMIT_DLENGTH)
-#define ISCSI_FNODE_FIRST_BURST (1ULL << ISCSI_FLASHNODE_FIRST_BURST)
-#define ISCSI_FNODE_DEF_TIME2WAIT (1ULL << ISCSI_FLASHNODE_DEF_TIME2WAIT)
-#define ISCSI_FNODE_DEF_TIME2RETAIN \
- (1ULL << ISCSI_FLASHNODE_DEF_TIME2RETAIN)
-#define ISCSI_FNODE_MAX_R2T (1ULL << ISCSI_FLASHNODE_MAX_R2T)
-#define ISCSI_FNODE_KEEPALIVE_TMO (1ULL << ISCSI_FLASHNODE_KEEPALIVE_TMO)
-#define ISCSI_FNODE_ISID (1ULL << ISCSI_FLASHNODE_ISID)
-#define ISCSI_FNODE_TSID (1ULL << ISCSI_FLASHNODE_TSID)
-#define ISCSI_FNODE_PORT (1ULL << ISCSI_FLASHNODE_PORT)
-#define ISCSI_FNODE_MAX_BURST (1ULL << ISCSI_FLASHNODE_MAX_BURST)
-#define ISCSI_FNODE_DEF_TMF_TMO (1ULL << ISCSI_FLASHNODE_DEF_TMF_TMO)
-#define ISCSI_FNODE_IPADDR (1ULL << ISCSI_FLASHNODE_IPADDR)
-#define ISCSI_FNODE_ALIAS (1ULL << ISCSI_FLASHNODE_ALIAS)
-#define ISCSI_FNODE_REDIRECT_IPADDR \
- (1ULL << ISCSI_FLASHNODE_REDIRECT_IPADDR)
-#define ISCSI_FNODE_MAX_SEGMENT_SIZE \
- (1ULL << ISCSI_FLASHNODE_MAX_SEGMENT_SIZE)
-#define ISCSI_FNODE_LOCAL_PORT (1ULL << ISCSI_FLASHNODE_LOCAL_PORT)
-#define ISCSI_FNODE_IPV4_TOS (1ULL << ISCSI_FLASHNODE_IPV4_TOS)
-#define ISCSI_FNODE_IPV6_TC (1ULL << ISCSI_FLASHNODE_IPV6_TC)
-#define ISCSI_FNODE_IPV6_FLOW_LABEL \
- (1ULL << ISCSI_FLASHNODE_IPV6_FLOW_LABEL)
-#define ISCSI_FNODE_NAME (1ULL << ISCSI_FLASHNODE_NAME)
-#define ISCSI_FNODE_TPGT (1ULL << ISCSI_FLASHNODE_TPGT)
-#define ISCSI_FNODE_LINK_LOCAL_IPV6 \
- (1ULL << ISCSI_FLASHNODE_LINK_LOCAL_IPV6)
-#define ISCSI_FNODE_DISCOVERY_PARENT_IDX \
- (1ULL << ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX)
-#define ISCSI_FNODE_DISCOVERY_PARENT_TYPE \
- (1ULL << ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE)
-#define ISCSI_FNODE_TCP_XMIT_WSF (1ULL << ISCSI_FLASHNODE_TCP_XMIT_WSF)
-#define ISCSI_FNODE_TCP_RECV_WSF (1ULL << ISCSI_FLASHNODE_TCP_RECV_WSF)
-#define ISCSI_FNODE_CHAP_IN_IDX (1ULL << ISCSI_FLASHNODE_CHAP_IN_IDX)
-#define ISCSI_FNODE_CHAP_OUT_IDX (1ULL << ISCSI_FLASHNODE_CHAP_OUT_IDX)
-#define ISCSI_FNODE_USERNAME (1ULL << ISCSI_FLASHNODE_USERNAME)
-#define ISCSI_FNODE_USERNAME_IN (1ULL << ISCSI_FLASHNODE_USERNAME_IN)
-#define ISCSI_FNODE_PASSWORD (1ULL << ISCSI_FLASHNODE_PASSWORD)
-#define ISCSI_FNODE_PASSWORD_IN (1ULL << ISCSI_FLASHNODE_PASSWORD_IN)
-#define ISCSI_FNODE_STATSN (1ULL << ISCSI_FLASHNODE_STATSN)
-#define ISCSI_FNODE_EXP_STATSN (1ULL << ISCSI_FLASHNODE_EXP_STATSN)
-#define ISCSI_FNODE_IS_BOOT_TGT (1ULL << ISCSI_FLASHNODE_IS_BOOT_TGT)
-
struct iscsi_flashnode_param_info {
uint32_t len; /* Actual length of the param */
uint16_t param; /* iscsi param value */
uint8_t value[0]; /* length sized value follows */
} __attribute__((__packed__));
-/* iSCSI HBA params */
-enum iscsi_host_param {
- ISCSI_HOST_PARAM_HWADDRESS,
- ISCSI_HOST_PARAM_INITIATOR_NAME,
- ISCSI_HOST_PARAM_NETDEV_NAME,
- ISCSI_HOST_PARAM_IPADDRESS,
- ISCSI_HOST_PARAM_MAX,
+enum iscsi_discovery_parent_type {
+ ISCSI_DISC_PARENT_UNKNOWN = 0x1,
+ ISCSI_DISC_PARENT_SENDTGT = 0x2,
+ ISCSI_DISC_PARENT_ISNS = 0x3,
};
-#define ISCSI_HOST_HWADDRESS (1ULL << ISCSI_HOST_PARAM_HWADDRESS)
-#define ISCSI_HOST_INITIATOR_NAME (1ULL << ISCSI_HOST_PARAM_INITIATOR_NAME)
-#define ISCSI_HOST_NETDEV_NAME (1ULL << ISCSI_HOST_PARAM_NETDEV_NAME)
-#define ISCSI_HOST_IPADDRESS (1ULL << ISCSI_HOST_PARAM_IPADDRESS)
+/* iSCSI port Speed */
+enum iscsi_port_speed {
+ ISCSI_PORT_SPEED_UNKNOWN = 0x1,
+ ISCSI_PORT_SPEED_10MBPS = 0x2,
+ ISCSI_PORT_SPEED_100MBPS = 0x4,
+ ISCSI_PORT_SPEED_1GBPS = 0x8,
+ ISCSI_PORT_SPEED_10GBPS = 0x10,
+};
+
+/* iSCSI port state */
+enum iscsi_port_state {
+ ISCSI_PORT_STATE_DOWN = 0x1,
+ ISCSI_PORT_STATE_UP = 0x2,
+};
/* iSCSI PING status/error code */
enum iscsi_ping_status_code {
@@ -739,7 +682,7 @@ enum iscsi_ping_status_code {
#define CAP_DIGEST_OFFLOAD 0x1000 /* offload hdr and data digests */
#define CAP_PADDING_OFFLOAD 0x2000 /* offload padding insertion, removal,
and verification */
-#define CAP_LOGIN_OFFLOAD 0x4000 /* offload normal session login */
+#define CAP_LOGIN_OFFLOAD 0x4000 /* offload session login */
/*
* These flags describes reason of stop_conn() call
@@ -807,7 +750,6 @@ enum chap_type_e {
#define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256
#define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256
-
struct iscsi_chap_rec {
uint16_t chap_tbl_idx;
enum chap_type_e chap_type;
diff --git a/usr/initiator.c b/usr/initiator.c
index a3b24b7..79d1779 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -384,17 +384,7 @@ __session_create(node_rec_t *rec, struct iscsi_transport *t)
/* setup authentication variables for the session*/
iscsi_setup_authentication(session, &rec->session.auth);
- session->param_mask = ~0ULL;
- if (!(t->caps & CAP_MULTI_R2T))
- session->param_mask &= ~ISCSI_MAX_R2T;
- if (!(t->caps & CAP_HDRDGST))
- session->param_mask &= ~ISCSI_HDRDGST_EN;
- if (!(t->caps & CAP_DATADGST))
- session->param_mask &= ~ISCSI_DATADGST_EN;
- if (!(t->caps & CAP_MARKERS)) {
- session->param_mask &= ~ISCSI_IFMARKER_EN;
- session->param_mask &= ~ISCSI_OFMARKER_EN;
- }
+ iscsi_session_init_params(session);
hostno = iscsi_sysfs_get_host_no_from_hwinfo(&rec->iface, &rc);
if (!rc) {
diff --git a/usr/initiator.h b/usr/initiator.h
index d6dc02e..680640c 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -357,5 +357,6 @@ extern int iscsi_setup_portal(struct iscsi_conn *conn, char *address, int port);
extern int iscsi_set_net_config(struct iscsi_transport *t,
iscsi_session_t *session,
struct iface_rec *iface);
+extern void iscsi_session_init_params(struct iscsi_session *session);
#endif /* INITIATOR_H */
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index eb72795..0fb7edc 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -324,12 +324,32 @@ int iscsi_host_set_params(struct iscsi_session *session)
return 0;
}
+static inline void iscsi_session_clear_param(struct iscsi_session *session,
+ int param)
+{
+ session->param_mask &= ~(1ULL << param);
+}
+
+void iscsi_session_init_params(struct iscsi_session *session)
+{
+ session->param_mask = ~0ULL;
+ if (!(session->t->caps & CAP_MULTI_R2T))
+ iscsi_session_clear_param(session, ISCSI_PARAM_MAX_R2T);
+ if (!(session->t->caps & CAP_HDRDGST))
+ iscsi_session_clear_param(session, ISCSI_PARAM_HDRDGST_EN);
+ if (!(session->t->caps & CAP_DATADGST))
+ iscsi_session_clear_param(session, ISCSI_PARAM_DATADGST_EN);
+ if (!(session->t->caps & CAP_MARKERS)) {
+ iscsi_session_clear_param(session, ISCSI_PARAM_IFMARKER_EN);
+ iscsi_session_clear_param(session, ISCSI_PARAM_OFMARKER_EN);
+ }
+}
+
#define MAX_SESSION_PARAMS 32
int iscsi_session_set_params(struct iscsi_conn *conn)
{
struct iscsi_session *session = conn->session;
- struct iscsi_transport *t = session->t;
int i, rc;
uint32_t one = 1, zero = 0;
struct connparam {
@@ -499,22 +519,12 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
},
};
- session->param_mask = ~0ULL;
- if (!(t->caps & CAP_MULTI_R2T))
- session->param_mask &= ~ISCSI_MAX_R2T;
- if (!(t->caps & CAP_HDRDGST))
- session->param_mask &= ~ISCSI_HDRDGST_EN;
- if (!(t->caps & CAP_DATADGST))
- session->param_mask &= ~ISCSI_DATADGST_EN;
- if (!(t->caps & CAP_MARKERS)) {
- session->param_mask &= ~ISCSI_IFMARKER_EN;
- session->param_mask &= ~ISCSI_OFMARKER_EN;
- }
+ iscsi_session_init_params(session);
/* some llds will send nops internally */
if (!iscsi_sysfs_session_supports_nop(session->id)) {
- session->param_mask &= ~ISCSI_PING_TMO;
- session->param_mask &= ~ISCSI_RECV_TMO;
+ iscsi_session_clear_param(session, ISCSI_PARAM_PING_TMO);
+ iscsi_session_clear_param(session, ISCSI_PARAM_RECV_TMO);
}
/* Entered full-feature phase! */
--
1.8.3.1

View File

@ -1,26 +1,29 @@
From 68ef07c23f7c0d1ea6b502c28be1152e77ff1bde Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 12 Apr 2013 10:41:15 -0700
Subject: ISCSISTART: Saved ibft boot info to the session sysfs
From 5992173f13550d75659fec1d7e1f6e87895d560a Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 11 Sep 2013 23:59:31 -0700
Subject: [PATCH] [PATCH v5 1/3] ISCSISTART: Saved ibft boot info to the
session
Patch and description from Eddie Wai:
Three new session sysfs parameters are introduced:
boot_root - holds the ibft boot root folder name
boot_nic - holds the ibft boot ethernetN name
boot_target - holds the ibft boot targetN name
This patch copies over the /sys/firmware/<boot_root>/ethernetN/targetN info
This patch copies over the /sys/firmware/<boot_root>/ethernetN/targetN
info
from the boot context to the node_rec.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
include/fw_context.h | 3 +++
include/iscsi_if.h | 4 ++++
include/iscsi_proto.h | 1 +
usr/config.h | 3 +++
usr/idbm.c | 6 ++++++
usr/initiator_common.c | 14 +++++++++++++-
utils/fwparam_ibft/fwparam_sysfs.c | 8 ++++++++
7 files changed, 38 insertions(+), 1 deletion(-)
6 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/include/fw_context.h b/include/fw_context.h
index 1640859..6563d68 100644
@ -36,21 +39,6 @@ index 1640859..6563d68 100644
/* target settings */
int target_port;
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 20f2bc2..b47dde7 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -495,6 +495,10 @@ enum iscsi_param {
ISCSI_PARAM_TGT_RESET_TMO,
ISCSI_PARAM_TARGET_ALIAS,
+
+ ISCSI_PARAM_BOOT_ROOT,
+ ISCSI_PARAM_BOOT_NIC,
+ ISCSI_PARAM_BOOT_TARGET,
/* must always be last */
ISCSI_PARAM_MAX,
};
diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h
index 1c69feb..56f757b 100644
--- a/include/iscsi_proto.h
@ -95,11 +83,11 @@ index bc06058..1e4f8c8 100644
iface_setup_from_boot_context(&rec->iface, context);
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index eb72795..544d637 100644
index 0fb7edc..e2e87a1 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -324,7 +324,7 @@ int iscsi_host_set_params(struct iscsi_session *session)
return 0;
@@ -345,7 +345,7 @@ void iscsi_session_init_params(struct iscsi_session *session)
}
}
-#define MAX_SESSION_PARAMS 32
@ -107,7 +95,7 @@ index eb72795..544d637 100644
int iscsi_session_set_params(struct iscsi_conn *conn)
{
@@ -496,6 +496,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
@@ -516,6 +516,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.param = ISCSI_PARAM_INITIATOR_NAME,
.value = session->initiator_name,
.type = ISCSI_STRING,
@ -160,5 +148,5 @@ index 3997363..2f37b59 100644
* We can live without the rest of they do not exist. If we
* failed to get them we will figure it out when we login.
--
1.8.1.4
1.8.3.1

View File

@ -1,7 +1,7 @@
From d86ca42685620ad3263da098923308a3a00ac55a Mon Sep 17 00:00:00 2001
From 487c312c96379e45648c782cee5b0d469cba80d0 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 12 Apr 2013 10:41:16 -0700
Subject: ISCSID: Added the extraction of the session boot info
Date: Fri, 23 Aug 2013 14:04:11 -0700
Subject: [PATCH] ISCSID: Added the extraction of the session boot info
This patch does the work to extract the corresponding
<boot_root>->ethernetN net params as specified from the kernel
@ -13,12 +13,12 @@ This is only populated for iscsi_tcp and bnx2i.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
usr/iscsi_sysfs.c | 40 ++++++++++++++++++++++++++++++++++++++++
usr/transport.c | 2 ++
usr/transport.c | 1 +
usr/transport.h | 1 +
3 files changed, 43 insertions(+)
3 files changed, 42 insertions(+)
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index aed10a3..79ec79d 100644
index aed10a3..56cb90c 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -674,6 +674,43 @@ free_fnode:
@ -69,25 +69,17 @@ index aed10a3..79ec79d 100644
}
}
+ if (t->template->use_boot_info && session)
+ if (session && t->template->use_boot_info)
+ iscsi_sysfs_read_boot(iface, session);
+
if (!iface_kern_id)
goto done;
diff --git a/usr/transport.c b/usr/transport.c
index 52b7674..4d030a8 100644
index 52b7674..2f38519 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -42,6 +42,7 @@
struct iscsi_transport_template iscsi_tcp = {
.name = "tcp",
+ .use_boot_info = 1,
.ep_connect = iscsi_io_tcp_connect,
.ep_poll = iscsi_io_tcp_poll,
.ep_disconnect = iscsi_io_tcp_disconnect,
@@ -77,6 +78,7 @@ struct iscsi_transport_template cxgb4i = {
@@ -77,6 +77,7 @@ struct iscsi_transport_template cxgb4i = {
struct iscsi_transport_template bnx2i = {
.name = "bnx2i",
.set_host_ip = 1,
@ -108,5 +100,5 @@ index 5dcf872..388e4b1 100644
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn);
--
1.8.1.4
1.8.3.1

View File

@ -1,7 +1,7 @@
From ec7d79ed691619b6ffa8c25f162ce62e1e25e6c1 Mon Sep 17 00:00:00 2001
From 3b4b45001b6d8412aad76a55347de42d30d694f7 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 12 Apr 2013 10:41:17 -0700
Subject: ISCSID: Added iface content override fix
Date: Fri, 23 Aug 2013 14:04:12 -0700
Subject: [PATCH] ISCSID: Added iface content override fix
Patch provided by Mike Christie.
@ -53,5 +53,5 @@ index 8f19220..d1756ef 100644
/* multiple drivers could be connected to the same portal */
--
1.8.1.4
1.8.3.1

View File

@ -0,0 +1,103 @@
From 1fa1b51356c0ea6e1d30f2d370b3b766d4230537 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@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@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

View File

@ -0,0 +1,35 @@
From 360a40f8a83e08a09b34cb12e269c793028b315e Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@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@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@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

View File

@ -0,0 +1,146 @@
From b3913c5943b6e908a1bb8ce83a2e79200d0ceed9 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@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@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@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

View File

@ -0,0 +1,53 @@
From 0c4022d865d81a0fb2fc6dcba8df72a6da753cfe Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@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@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@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

View File

@ -0,0 +1,47 @@
From 38b2993786c26a2c7bb79a42fc8c644720b4507c Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@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@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@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

View File

@ -0,0 +1,590 @@
From 062718a9579a10ea7c87e46162f80e3f57e80b67 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@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@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@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

View File

@ -0,0 +1,37 @@
From 65ce3a27da47cecf71015b16b1d186c49cbb7bcc Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@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@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@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

View File

@ -0,0 +1,84 @@
From f1ed1f7049f42ad12f5e6bf5b02de75290271c56 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@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@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@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

View File

@ -0,0 +1,46 @@
From 0a95bc409c6282b95c48ba39a16e17c3e6e26537 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:17 -0400
Subject: [PATCH] iscsi tools: Setup iface conf file with all iface attrs
exported in sysfs
Currently, iface conf file does not get populated with all the iface
attrs that are exported in corresponding sysfs entry.
This patch allows to setup conf file with all iface attrs in sysfs.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iface.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index c86892e..8580d1a 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -476,11 +476,8 @@ static int iface_setup_binding_from_kern_iface(void *data,
}
memset(&iface, 0, sizeof(struct iface_rec));
- strcpy(iface.hwaddress, hinfo->iface.hwaddress);
- strcpy(iface.transport_name, hinfo->iface.transport_name);
-
if (kern_iface) {
- iface.iface_num = kern_iface->iface_num;
+ memcpy(&iface, kern_iface, sizeof(iface));
snprintf(iface.name, sizeof(iface.name), "%s.%s.%s.%u",
kern_iface->transport_name,
@@ -492,6 +489,9 @@ static int iface_setup_binding_from_kern_iface(void *data,
hinfo->iface.transport_name, hinfo->iface.hwaddress);
}
+ strcpy(iface.hwaddress, hinfo->iface.hwaddress);
+ strcpy(iface.transport_name, hinfo->iface.transport_name);
+
memset(iface_path, 0, sizeof(iface_path));
snprintf(iface_path, PATH_MAX, "%s/%s", IFACE_CONFIG_DIR,
iface.name);
--
1.8.3.1

View File

@ -0,0 +1,65 @@
From 026c8d771c1df457cd26e7066b503cadfbbc98df Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:18 -0400
Subject: [PATCH] iscsi_if.h: Remove numbers used for network parameter
settings
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>
---
include/iscsi_if.h | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index 0284662..e837dd0 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -395,25 +395,25 @@ struct iscsi_path {
/* iSCSI network params */
enum iscsi_net_param {
ISCSI_NET_PARAM_IPV4_ADDR = 1,
- ISCSI_NET_PARAM_IPV4_SUBNET = 2,
- ISCSI_NET_PARAM_IPV4_GW = 3,
- ISCSI_NET_PARAM_IPV4_BOOTPROTO = 4,
- ISCSI_NET_PARAM_MAC = 5,
- ISCSI_NET_PARAM_IPV6_LINKLOCAL = 6,
- ISCSI_NET_PARAM_IPV6_ADDR = 7,
- ISCSI_NET_PARAM_IPV6_ROUTER = 8,
- ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG = 9,
- ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG = 10,
- ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG = 11,
- ISCSI_NET_PARAM_IFACE_ENABLE = 12,
- ISCSI_NET_PARAM_VLAN_ID = 13,
- ISCSI_NET_PARAM_VLAN_PRIORITY = 14,
- ISCSI_NET_PARAM_VLAN_ENABLED = 15,
- ISCSI_NET_PARAM_VLAN_TAG = 16,
- ISCSI_NET_PARAM_IFACE_TYPE = 17,
- ISCSI_NET_PARAM_IFACE_NAME = 18,
- ISCSI_NET_PARAM_MTU = 19,
- ISCSI_NET_PARAM_PORT = 20,
+ ISCSI_NET_PARAM_IPV4_SUBNET,
+ ISCSI_NET_PARAM_IPV4_GW,
+ ISCSI_NET_PARAM_IPV4_BOOTPROTO,
+ ISCSI_NET_PARAM_MAC,
+ ISCSI_NET_PARAM_IPV6_LINKLOCAL,
+ ISCSI_NET_PARAM_IPV6_ADDR,
+ ISCSI_NET_PARAM_IPV6_ROUTER,
+ ISCSI_NET_PARAM_IPV6_ADDR_AUTOCFG,
+ ISCSI_NET_PARAM_IPV6_LINKLOCAL_AUTOCFG,
+ ISCSI_NET_PARAM_IPV6_ROUTER_AUTOCFG,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM_VLAN_ID,
+ ISCSI_NET_PARAM_VLAN_PRIORITY,
+ ISCSI_NET_PARAM_VLAN_ENABLED,
+ ISCSI_NET_PARAM_VLAN_TAG,
+ ISCSI_NET_PARAM_IFACE_TYPE,
+ ISCSI_NET_PARAM_IFACE_NAME,
+ ISCSI_NET_PARAM_MTU,
+ ISCSI_NET_PARAM_PORT,
};
enum iscsi_conn_state {
--
1.8.3.1

View File

@ -0,0 +1,122 @@
From d1e07af2ed3aa480107213378a54bfc9a6a36c0a Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:19 -0400
Subject: [PATCH] iscsi_if.h: Additional parameters for network param settings
Added support to display and update additional network parameters
through iscsiadm
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>
---
include/iscsi_if.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index e837dd0..e59bcd0 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -320,6 +320,7 @@ enum iscsi_param_type {
ISCSI_NET_PARAM, /* iscsi_net_param */
ISCSI_FLASHNODE_PARAM, /* iscsi_flashnode_param */
ISCSI_CHAP_PARAM, /* iscsi_chap_param */
+ ISCSI_IFACE_PARAM, /* iscsi_iface_param */
};
/* structure for minimalist usecase */
@@ -392,6 +393,10 @@ struct iscsi_path {
#define ISCSI_VLAN_DISABLE 0x01
#define ISCSI_VLAN_ENABLE 0x02
+/* iscsi generic enable/disabled setting for various features */
+#define ISCSI_NET_PARAM_DISABLE 0x01
+#define ISCSI_NET_PARAM_ENABLE 0x02
+
/* iSCSI network params */
enum iscsi_net_param {
ISCSI_NET_PARAM_IPV4_ADDR = 1,
@@ -414,6 +419,80 @@ enum iscsi_net_param {
ISCSI_NET_PARAM_IFACE_NAME,
ISCSI_NET_PARAM_MTU,
ISCSI_NET_PARAM_PORT,
+ ISCSI_NET_PARAM_IPADDR_STATE,
+ ISCSI_NET_PARAM_IPV6_LINKLOCAL_STATE,
+ ISCSI_NET_PARAM_IPV6_ROUTER_STATE,
+ ISCSI_NET_PARAM_DELAYED_ACK_EN,
+ ISCSI_NET_PARAM_TCP_NAGLE_DISABLE,
+ ISCSI_NET_PARAM_TCP_WSF_DISABLE,
+ ISCSI_NET_PARAM_TCP_WSF,
+ ISCSI_NET_PARAM_TCP_TIMER_SCALE,
+ ISCSI_NET_PARAM_TCP_TIMESTAMP_EN,
+ ISCSI_NET_PARAM_CACHE_ID,
+ ISCSI_NET_PARAM_IPV4_DHCP_DNS_ADDR_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_SLP_DA_EN,
+ ISCSI_NET_PARAM_IPV4_TOS_EN,
+ ISCSI_NET_PARAM_IPV4_TOS,
+ ISCSI_NET_PARAM_IPV4_GRAT_ARP_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_ALT_CLIENT_ID,
+ ISCSI_NET_PARAM_IPV4_DHCP_REQ_VENDOR_ID_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_USE_VENDOR_ID_EN,
+ ISCSI_NET_PARAM_IPV4_DHCP_VENDOR_ID,
+ ISCSI_NET_PARAM_IPV4_DHCP_LEARN_IQN_EN,
+ ISCSI_NET_PARAM_IPV4_FRAGMENT_DISABLE,
+ ISCSI_NET_PARAM_IPV4_IN_FORWARD_EN,
+ ISCSI_NET_PARAM_IPV4_TTL,
+ ISCSI_NET_PARAM_IPV6_GRAT_NEIGHBOR_ADV_EN,
+ ISCSI_NET_PARAM_IPV6_MLD_EN,
+ ISCSI_NET_PARAM_IPV6_FLOW_LABEL,
+ ISCSI_NET_PARAM_IPV6_TRAFFIC_CLASS,
+ ISCSI_NET_PARAM_IPV6_HOP_LIMIT,
+ ISCSI_NET_PARAM_IPV6_ND_REACHABLE_TMO,
+ ISCSI_NET_PARAM_IPV6_ND_REXMIT_TIME,
+ ISCSI_NET_PARAM_IPV6_ND_STALE_TMO,
+ ISCSI_NET_PARAM_IPV6_DUP_ADDR_DETECT_CNT,
+ ISCSI_NET_PARAM_IPV6_RTR_ADV_LINK_MTU,
+ ISCSI_NET_PARAM_REDIRECT_EN,
+};
+
+enum iscsi_ipaddress_state {
+ ISCSI_IPDDRESS_STATE_UNCONFIGURED,
+ ISCSI_IPDDRESS_STATE_ACQUIRING,
+ ISCSI_IPDDRESS_STATE_TENTATIVE,
+ ISCSI_IPDDRESS_STATE_VALID,
+ ISCSI_IPDDRESS_STATE_DISABLING,
+ ISCSI_IPDDRESS_STATE_INVALID,
+ ISCSI_IPDDRESS_STATE_DEPRECATED,
+};
+
+enum iscsi_router_state {
+ ISCSI_ROUTER_STATE_UNKNOWN,
+ ISCSI_ROUTER_STATE_ADVERTISED,
+ ISCSI_ROUTER_STATE_MANUAL,
+ ISCSI_ROUTER_STATE_STALE,
+};
+
+/* iSCSI specific settings params for iface */
+enum iscsi_iface_param {
+ ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO,
+ ISCSI_IFACE_PARAM_HDRDGST_EN,
+ ISCSI_IFACE_PARAM_DATADGST_EN,
+ ISCSI_IFACE_PARAM_IMM_DATA_EN,
+ ISCSI_IFACE_PARAM_INITIAL_R2T_EN,
+ ISCSI_IFACE_PARAM_DATASEQ_INORDER_EN,
+ ISCSI_IFACE_PARAM_PDU_INORDER_EN,
+ ISCSI_IFACE_PARAM_ERL,
+ ISCSI_IFACE_PARAM_MAX_RECV_DLENGTH,
+ ISCSI_IFACE_PARAM_FIRST_BURST,
+ ISCSI_IFACE_PARAM_MAX_R2T,
+ ISCSI_IFACE_PARAM_MAX_BURST,
+ ISCSI_IFACE_PARAM_CHAP_AUTH_EN,
+ ISCSI_IFACE_PARAM_BIDI_CHAP_EN,
+ ISCSI_IFACE_PARAM_DISCOVERY_AUTH_OPTIONAL,
+ ISCSI_IFACE_PARAM_DISCOVERY_LOGOUT_EN,
+ ISCSI_IFACE_PARAM_STRICT_LOGIN_COMP_EN,
+ ISCSI_IFACE_PARAM_INITIATOR_NAME,
};
enum iscsi_conn_state {
--
1.8.3.1

View File

@ -0,0 +1,243 @@
From 466efaad99b0fc0d1181443386b823739a8b483b Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:20 -0400
Subject: [PATCH] iscsi tools: Use macro to set IPv4/IPv6 IP addresses
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/iface.c | 154 +++++++++++++++++++++++++++---------------------------------
1 file changed, 69 insertions(+), 85 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index 8580d1a..19ad5ab 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -1484,8 +1484,8 @@ static int iface_fill_router_autocfg(struct iovec *iov, struct iface_rec *iface)
}
/* IPv4 IPAddress/Subnet Mask/Gateway: 4 bytes */
-static int iface_fill_net_ipv4_addr(struct iovec *iov, struct iface_rec *iface,
- uint32_t param)
+static int iface_fill_net_ipv4_addr(struct iovec *iov, uint32_t iface_num,
+ uint16_t param, char *param_val)
{
int rc = 1;
int len;
@@ -1502,29 +1502,12 @@ static int iface_fill_net_ipv4_addr(struct iovec *iov, struct iface_rec *iface,
net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = param;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV4;
- net_param->iface_num = iface->iface_num;
+ net_param->iface_num = iface_num;
net_param->len = 4;
net_param->param_type = ISCSI_NET_PARAM;
-
- switch (param) {
- case ISCSI_NET_PARAM_IPV4_ADDR:
- rc = inet_pton(AF_INET, iface->ipaddress, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- case ISCSI_NET_PARAM_IPV4_SUBNET:
- rc = inet_pton(AF_INET, iface->subnet_mask, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- case ISCSI_NET_PARAM_IPV4_GW:
- rc = inet_pton(AF_INET, iface->gateway, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- default:
+ rc = inet_pton(AF_INET, param_val, net_param->value);
+ if (rc <= 0)
goto free;
- }
/* validate */
if (!net_param->value[0] && !net_param->value[1] &&
@@ -1539,9 +1522,19 @@ free:
return 1;
}
+#define IFACE_SET_NET_PARAM_IPV4_ADDR(iov, inum, param, ival, gcnt, \
+ lcnt) { \
+ if (strstr(ival, ".")) { \
+ if (!iface_fill_net_ipv4_addr(iov, inum, param, ival)) {\
+ (*gcnt)++; \
+ (*lcnt)++; \
+ } \
+ } \
+}
+
/* IPv6 IPAddress/LinkLocal/Router: 16 bytes */
-static int iface_fill_net_ipv6_addr(struct iovec *iov, struct iface_rec *iface,
- uint32_t param)
+static int iface_fill_net_ipv6_addr(struct iovec *iov, uint32_t iface_num,
+ uint16_t param, char *param_val)
{
int rc;
int len;
@@ -1558,30 +1551,12 @@ static int iface_fill_net_ipv6_addr(struct iovec *iov, struct iface_rec *iface,
net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
net_param->param = param;
net_param->iface_type = ISCSI_IFACE_TYPE_IPV6;
- net_param->iface_num = iface->iface_num;
+ net_param->iface_num = iface_num;
net_param->param_type = ISCSI_NET_PARAM;
net_param->len = 16;
-
- switch (param) {
- case ISCSI_NET_PARAM_IPV6_ADDR:
- rc = inet_pton(AF_INET6, iface->ipaddress, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- case ISCSI_NET_PARAM_IPV6_LINKLOCAL:
- rc = inet_pton(AF_INET6, iface->ipv6_linklocal,
- net_param->value);
- if (rc <= 0)
- goto free;
- break;
- case ISCSI_NET_PARAM_IPV6_ROUTER:
- rc = inet_pton(AF_INET6, iface->ipv6_router, net_param->value);
- if (rc <= 0)
- goto free;
- break;
- default:
+ rc = inet_pton(AF_INET6, param_val, net_param->value);
+ if (rc <= 0)
goto free;
- }
return 0;
free:
@@ -1591,6 +1566,16 @@ free:
return 1;
}
+#define IFACE_SET_NET_PARAM_IPV6_ADDR(iov, inum, param, ival, gcnt, \
+ lcnt) { \
+ if (strstr(ival, ":")) { \
+ if (!iface_fill_net_ipv6_addr(iov, inum, param, ival)) {\
+ (*gcnt)++; \
+ (*lcnt)++; \
+ } \
+ } \
+}
+
struct iface_net_config {
struct iface_rec *primary;
struct iovec *iovs;
@@ -1635,28 +1620,27 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
net_config->count++;
count++;
}
- if (!iface_fill_net_ipv4_addr(&iov[net_config->count],
- iface,
- ISCSI_NET_PARAM_IPV4_ADDR)) {
- net_config->count++;
- count++;
- }
- if (strstr(iface->subnet_mask, ".")) {
- if (!iface_fill_net_ipv4_addr(
- &iov[net_config->count], iface,
- ISCSI_NET_PARAM_IPV4_SUBNET)) {
- net_config->count++;
- count++;
- }
- }
- if (strstr(iface->gateway, ".")) {
- if (!iface_fill_net_ipv4_addr(
- &iov[net_config->count], iface,
- ISCSI_NET_PARAM_IPV4_GW)) {
- net_config->count++;
- count++;
- }
- }
+
+ IFACE_SET_NET_PARAM_IPV4_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV4_ADDR,
+ iface->ipaddress,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_NET_PARAM_IPV4_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV4_SUBNET,
+ iface->subnet_mask,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_NET_PARAM_IPV4_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV4_GW,
+ iface->gateway,
+ &net_config->count,
+ &count);
}
/*
@@ -1727,12 +1711,12 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
/* User provided IPv6 Address */
- if (!iface_fill_net_ipv6_addr(&iov[net_config->count],
- iface,
- ISCSI_NET_PARAM_IPV6_ADDR)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_NET_PARAM_IPV6_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV6_ADDR,
+ iface->ipaddress,
+ &net_config->count,
+ &count);
}
/* For LinkLocal Address */
@@ -1751,12 +1735,12 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
/* User provided Link Local Address */
- if (!iface_fill_net_ipv6_addr(&iov[net_config->count],
- iface,
- ISCSI_NET_PARAM_IPV6_LINKLOCAL)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_NET_PARAM_IPV6_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV6_LINKLOCAL,
+ iface->ipv6_linklocal,
+ &net_config->count,
+ &count);
}
/* For Router Address */
@@ -1773,12 +1757,12 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
/* User provided Router Address */
- if (!iface_fill_net_ipv6_addr(&iov[net_config->count],
- iface,
- ISCSI_NET_PARAM_IPV6_ROUTER)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_NET_PARAM_IPV6_ADDR(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_NET_PARAM_IPV6_ROUTER,
+ iface->ipv6_router,
+ &net_config->count,
+ &count);
}
/*
--
1.8.3.1

View File

@ -0,0 +1,220 @@
From 2220ee4334637946e93dca5c68889b5e3e807515 Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:21 -0400
Subject: [PATCH] iscsi tools: Use single function to enable/disable network
parameters
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 | 148 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 74 insertions(+), 74 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index 19ad5ab..292c804 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -1311,60 +1311,45 @@ static int iface_fill_vlan_id(struct iovec *iov, struct iface_rec *iface,
return 0;
}
-/* IPv4/IPv6 VLAN state: disable/enable */
-static int iface_fill_vlan_state(struct iovec *iov, struct iface_rec *iface,
- uint32_t iface_type)
+/* disable/enable parameters */
+static int iface_fill_param_state(struct iovec *iov, uint32_t iface_num,
+ uint8_t iface_type, uint16_t param,
+ uint8_t param_type, char *param_val)
{
int len;
struct iscsi_iface_param_info *net_param;
struct nlattr *attr;
+ if (!param_val[0])
+ return 1;
+
len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_VLAN_ENABLED, 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);
net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
- net_param->param = ISCSI_NET_PARAM_VLAN_ENABLED;
- net_param->iface_type = iface_type;
- net_param->iface_num = iface->iface_num;
- net_param->param_type = ISCSI_NET_PARAM;
+ net_param->iface_num = iface_num;
net_param->len = 1;
- if (strcmp(iface->vlan_state, "disable") && iface->vlan_id)
- net_param->value[0] = ISCSI_VLAN_ENABLE;
+ 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 */
- net_param->value[0] = ISCSI_VLAN_DISABLE;
+ net_param->value[0] = ISCSI_NET_PARAM_DISABLE;
return 0;
}
-/* IPv4/IPv6 Network state: disable/enable */
-static int iface_fill_net_state(struct iovec *iov, struct iface_rec *iface,
- uint32_t iface_type)
-{
- int len;
- struct iscsi_iface_param_info *net_param;
- struct nlattr *attr;
-
- len = sizeof(struct iscsi_iface_param_info) + 1;
- iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_IFACE_ENABLE, len);
- if (!(iov->iov_base))
- return 1;
-
- attr = iov->iov_base;
- iov->iov_len = NLA_ALIGN(attr->nla_len);
- net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
- net_param->param = ISCSI_NET_PARAM_IFACE_ENABLE;
- net_param->iface_type = iface_type;
- net_param->iface_num = iface->iface_num;
- net_param->param_type = ISCSI_NET_PARAM;
- net_param->len = 1;
- if (!strcmp(iface->state, "disable"))
- net_param->value[0] = ISCSI_IFACE_DISABLE;
- else /* Assume enabled */
- net_param->value[0] = ISCSI_IFACE_ENABLE;
- return 0;
+#define IFACE_SET_PARAM_STATE(iov, inum, itype, param, ptype, ival, \
+ gcnt, lcnt) { \
+ if (!iface_fill_param_state(iov, inum, itype, param, ptype, \
+ ival)) { \
+ (*gcnt)++; \
+ (*lcnt)++; \
+ } \
}
/* IPv4 Bootproto: DHCP/static */
@@ -1598,13 +1583,14 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
iptype = iface_get_iptype(iface);
if (iptype == ISCSI_IFACE_TYPE_IPV4) {
if (!strcmp(iface->state, "disable")) {
- if (!iface_fill_net_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
-
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM,
+ iface->state,
+ &net_config->count,
+ &count);
return 0;
}
@@ -1648,18 +1634,24 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
* fill state and other parameters (if any)
*/
if (count) {
- if (!iface_fill_net_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
- if (!iface_fill_vlan_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM,
+ iface->state,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_VLAN_ENABLED,
+ ISCSI_NET_PARAM,
+ iface->vlan_state,
+ &net_config->count,
+ &count);
+
if (strcmp(iface->vlan_state, "disable") &&
iface->vlan_id) {
if (!iface_fill_vlan_id(&iov[net_config->count],
@@ -1687,12 +1679,14 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
}
} else if (iptype == ISCSI_IFACE_TYPE_IPV6) {
if (!strcmp(iface->state, "disable")) {
- if (!iface_fill_net_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM,
+ iface->state,
+ &net_config->count,
+ &count);
return 0;
}
@@ -1770,18 +1764,24 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
* fill state and other parameters
*/
if (count) {
- if (!iface_fill_net_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
- if (!iface_fill_vlan_state(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_IFACE_ENABLE,
+ ISCSI_NET_PARAM,
+ iface->state,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_PARAM_STATE(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_VLAN_ENABLED,
+ ISCSI_NET_PARAM,
+ iface->vlan_state,
+ &net_config->count,
+ &count);
+
if (strcmp(iface->vlan_state, "disable") &&
iface->vlan_id) {
if (!iface_fill_vlan_id(&iov[net_config->count],
--
1.8.3.1

View File

@ -0,0 +1,215 @@
From d8991c9e1de373a1c55ad2f8ca07bb3fbda1aa5c Mon Sep 17 00:00:00 2001
From: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:22 -0400
Subject: [PATCH] iscsi tools: Use single function to set integer network
parameters
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 | 162 +++++++++++++++++++++++++++++++++---------------------------
1 file changed, 90 insertions(+), 72 deletions(-)
diff --git a/usr/iface.c b/usr/iface.c
index 292c804..6454f75 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -1223,58 +1223,68 @@ int iface_get_param_count(struct iface_rec *iface, int iface_all)
return iface_params.count;
}
-/* IPv4/IPv6 Port: 3260 or User defined */
-static int iface_fill_port(struct iovec *iov, struct iface_rec *iface,
- uint32_t iface_type)
+/* write integer parameter value */
+static int iface_fill_int_param_val(struct iovec *iov, uint32_t iface_num,
+ uint8_t iface_type, uint16_t param,
+ uint8_t param_type, uint32_t param_len,
+ uint32_t param_val)
{
int len;
struct iscsi_iface_param_info *net_param;
- uint16_t port = 3260;
struct nlattr *attr;
+ uint8_t val8 = 0;
+ uint16_t val16 = 0;
+ uint32_t val32 = 0;
+ char *val = NULL;
- len = sizeof(struct iscsi_iface_param_info) + sizeof(port);
- iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_PORT, len);
- if (!iov->iov_base)
- return 1;
- attr = iov->iov_base;
- iov->iov_len = NLA_ALIGN(attr->nla_len);
-
- net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
- net_param->param = ISCSI_NET_PARAM_PORT;
- net_param->iface_type = iface_type;
- net_param->iface_num = iface->iface_num;
- net_param->param_type = ISCSI_NET_PARAM;
- net_param->len = 2;
- if (iface->port)
- port = iface->port;
- memcpy(net_param->value, &port, net_param->len);
- return 0;
-}
-
-static int iface_fill_mtu(struct iovec *iov, struct iface_rec *iface,
- uint32_t iface_type)
-{
- int len;
- struct iscsi_iface_param_info *net_param;
- uint16_t mtu = 0;
- struct nlattr *attr;
-
- len = sizeof(struct iscsi_iface_param_info) + 2;
- iov->iov_base = iscsi_nla_alloc(ISCSI_NET_PARAM_MTU, len);
+ len = sizeof(struct iscsi_iface_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);
-
net_param = (struct iscsi_iface_param_info *)ISCSI_NLA_DATA(attr);
- net_param->param = ISCSI_NET_PARAM_MTU;
+ net_param->iface_num = iface_num;
+ net_param->len = param_len;
+ net_param->param = param;
net_param->iface_type = iface_type;
- net_param->iface_num = iface->iface_num;
- net_param->param_type = ISCSI_NET_PARAM;
- net_param->len = 2;
- mtu = iface->mtu;
- memcpy(net_param->value, &mtu, net_param->len);
+ net_param->param_type = param_type;
+ 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(net_param->value, val, param_len);
return 0;
+free:
+ free(iov->iov_base);
+ iov->iov_base = NULL;
+ iov->iov_len = 0;
+ return 1;
+}
+
+#define IFACE_SET_PARAM_INTVAL(iov, inum, itype, param, ptype, plen, \
+ ival, gcnt, lcnt) { \
+ if (ival && !iface_fill_int_param_val(iov, inum, itype, param, \
+ ptype, plen, ival)) { \
+ (*gcnt)++; \
+ (*lcnt)++; \
+ } \
}
/* IPv4/IPv6 VLAN_ID: decimal value <= 4095 */
@@ -1660,22 +1670,26 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
}
- if (iface->mtu) {
- if (!iface_fill_mtu(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
- }
- if (iface->port) {
- if (!iface_fill_port(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV4)) {
- net_config->count++;
- count++;
- }
- }
+
+ IFACE_SET_PARAM_INTVAL(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_MTU,
+ ISCSI_NET_PARAM,
+ 2,
+ iface->mtu,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_PARAM_INTVAL(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV4,
+ ISCSI_NET_PARAM_PORT,
+ ISCSI_NET_PARAM,
+ 2,
+ iface->port,
+ &net_config->count,
+ &count);
}
} else if (iptype == ISCSI_IFACE_TYPE_IPV6) {
if (!strcmp(iface->state, "disable")) {
@@ -1791,22 +1805,26 @@ static int __iface_build_net_config(void *data, struct iface_rec *iface)
count++;
}
}
- if (iface->mtu) {
- if (!iface_fill_mtu(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
- }
- if (iface->port) {
- if (!iface_fill_port(&iov[net_config->count],
- iface,
- ISCSI_IFACE_TYPE_IPV6)) {
- net_config->count++;
- count++;
- }
- }
+
+ IFACE_SET_PARAM_INTVAL(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_MTU,
+ ISCSI_NET_PARAM,
+ 2,
+ iface->mtu,
+ &net_config->count,
+ &count);
+
+ IFACE_SET_PARAM_INTVAL(&iov[net_config->count],
+ iface->iface_num,
+ ISCSI_IFACE_TYPE_IPV6,
+ ISCSI_NET_PARAM_PORT,
+ ISCSI_NET_PARAM,
+ 2,
+ iface->port,
+ &net_config->count,
+ &count);
}
}
return 0;
--
1.8.3.1

View File

@ -0,0 +1,44 @@
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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,119 @@
From 9260457c1df5f519a63744114cbdf7e50cd75ed7 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:25 -0400
Subject: [PATCH] iscsi tools: iface params should be updated for node_rec as
well.
While updating iface params, the changes should get applied to the
node records as well.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/idbm.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
diff --git a/usr/idbm.c b/usr/idbm.c
index 4428ebe..c6460ad 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -292,6 +292,96 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
__recinfo_uint16(IFACE_MTU, ri, r, iface.mtu, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_PORT, ri, r, iface.port, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID, ri, r, iface.dhcp_alt_client_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r, iface.dhcp_alt_client_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_DNS, ri, r, iface.dhcp_dns, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r, iface.dhcp_learn_iqn,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_REQ_VID, ri, r, iface.dhcp_req_vendor_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID, ri, r, iface.dhcp_vendor_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID_STR, ri, r, iface.dhcp_vendor_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, iface.dhcp_slp_da, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_FRAGMENTATION, ri, r, iface.fragmentation,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GRAT_ARP, ri, r, iface.gratuitous_arp, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_IN_FORWARD, ri, r, iface.incoming_forwarding,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TOS_STATE, ri, r, iface.tos_state, IDBM_SHOW, num,
+ 1);
+ __recinfo_uint8(IFACE_TOS, ri, r, iface.tos, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TTL, ri, r, iface.ttl, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r,
+ iface.dup_addr_detect_cnt, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, iface.flow_label, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r,
+ iface.gratuitous_neighbor_adv, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, iface.hop_limit, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_MLD, ri, r, iface.mld, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r, iface.nd_reachable_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r, iface.nd_rexmit_time,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, iface.nd_stale_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r,
+ iface.router_adv_link_mtu, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, iface.traffic_class,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DELAYED_ACK, ri, r, iface.delayed_ack, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_TCP_NAGLE, ri, r, iface.nagle, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TCP_WSF_STATE, ri, r, iface.tcp_wsf_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TCP_WSF, ri, r, iface.tcp_wsf, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TCP_TIMER_SCALE, ri, r, iface.tcp_timer_scale,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TCP_TIMESTAMP, ri, r, iface.tcp_timestamp,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_REDIRECT, ri, r, iface.redirect, IDBM_SHOW, num, 1);
+ __recinfo_uint16(IFACE_DEF_TMF_TMO, ri, r, iface.def_task_mgmt_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_HDRDGST, ri, r, iface.header_digest, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DATADGST, ri, r, iface.data_digest, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_IMM_DATA, ri, r, iface.immediate_data, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_INITIAL_R2T, ri, r, iface.initial_r2t, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DSEQ_INORDER, ri, r, iface.data_seq_inorder,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DPDU_INORDER, ri, r, iface.data_pdu_inorder,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_ERL, ri, r, iface.erl, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_MAX_RECV_DLEN, ri, r, iface.max_recv_dlength,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_FIRST_BURST, ri, r, iface.first_burst_len,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint16(IFACE_MAX_R2T, ri, r, iface.max_out_r2t, IDBM_SHOW,
+ num, 1);
+ __recinfo_uint32(IFACE_MAX_BURST, ri, r, iface.max_burst_len, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_CHAP_AUTH, ri, r, iface.chap_auth, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_BIDI_CHAP, ri, r, iface.bidi_chap, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_STRICT_LOGIN_COMP, ri, r, iface.strict_login_comp,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DISCOVERY_AUTH, ri, r, iface.discovery_auth,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DISCOVERY_LOGOUT, ri, r, iface.discovery_logout,
+ IDBM_SHOW, num, 1);
+
+
__recinfo_str(NODE_DISC_ADDR, ri, r, disc_address, IDBM_SHOW,
num, 0);
__recinfo_int(NODE_DISC_PORT, ri, r, disc_port, IDBM_SHOW,
--
1.8.3.1

View File

@ -0,0 +1,33 @@
From 75ee9d0af6e200b34e84b1e7b37971213b2fd629 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:26 -0400
Subject: [PATCH] iscsi tools: Let default type of iface be ipv4
While using iface name to determine its type if the name does not
contain iface type then assume it be to of type ipv4 by default.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iface.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/usr/iface.c b/usr/iface.c
index 87ac875..870dba0 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -450,8 +450,10 @@ int iface_get_iptype(struct iface_rec *iface)
/* try to figure out by name */
if (strstr(iface->name, "ipv4"))
return ISCSI_IFACE_TYPE_IPV4;
- else
+ else if (strstr(iface->name, "ipv6"))
return ISCSI_IFACE_TYPE_IPV6;
+ else /* assume ipv4 by default */
+ return ISCSI_IFACE_TYPE_IPV4;
} else {
if (strcmp(iface->bootproto, "dhcp") &&
!strstr(iface->ipaddress, "."))
--
1.8.3.1

View File

@ -0,0 +1,310 @@
From 4a5e9e29d7516e34e35a15c7342afbc3a1c8c176 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Fri, 18 Oct 2013 09:29:27 -0400
Subject: [PATCH] iscsi tools: Show iface params based on iface type
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/idbm.c | 250 ++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 138 insertions(+), 112 deletions(-)
diff --git a/usr/idbm.c b/usr/idbm.c
index c6460ad..1ade099 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -237,6 +237,9 @@ void
idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
{
int num = 0, i;
+ int iface_type;
+
+ iface_type = iface_get_iptype(&r->iface);
__recinfo_str(NODE_NAME, ri, r, name, IDBM_SHOW, num, 0);
__recinfo_int(NODE_TPGT, ri, r, tpgt, IDBM_SHOW, num, 0);
@@ -266,21 +269,6 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
__recinfo_str(IFACE_TRANSPORTNAME, ri, r, iface.transport_name,
IDBM_SHOW, num, 1);
__recinfo_str(IFACE_INAME, ri, r, iface.iname, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_BOOT_PROTO, ri, r, iface.bootproto, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_SUBNET_MASK, ri, r, iface.subnet_mask,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_GATEWAY, ri, r, iface.gateway, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, iface.ipv6_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r, iface.linklocal_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, iface.router_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_LINKLOCAL, ri, r, iface.ipv6_linklocal,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_ROUTER, ri, r, iface.ipv6_router, IDBM_SHOW, num,
- 1);
__recinfo_str(IFACE_STATE, ri, r, iface.state, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_VLAN_ID, ri, r, iface.vlan_id, IDBM_SHOW, num,
1);
@@ -292,50 +280,73 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
__recinfo_uint16(IFACE_MTU, ri, r, iface.mtu, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_PORT, ri, r, iface.port, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_ALT_CID, ri, r, iface.dhcp_alt_client_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r, iface.dhcp_alt_client_id,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_DNS, ri, r, iface.dhcp_dns, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r, iface.dhcp_learn_iqn,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_REQ_VID, ri, r, iface.dhcp_req_vendor_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_VID, ri, r, iface.dhcp_vendor_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_VID_STR, ri, r, iface.dhcp_vendor_id,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, iface.dhcp_slp_da, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_FRAGMENTATION, ri, r, iface.fragmentation,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_GRAT_ARP, ri, r, iface.gratuitous_arp, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_IN_FORWARD, ri, r, iface.incoming_forwarding,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_TOS_STATE, ri, r, iface.tos_state, IDBM_SHOW, num,
- 1);
- __recinfo_uint8(IFACE_TOS, ri, r, iface.tos, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TTL, ri, r, iface.ttl, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r,
- iface.dup_addr_detect_cnt, IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, iface.flow_label, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r,
- iface.gratuitous_neighbor_adv, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, iface.hop_limit, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_MLD, ri, r, iface.mld, IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r, iface.nd_reachable_tmo,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r, iface.nd_rexmit_time,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, iface.nd_stale_tmo,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r,
- iface.router_adv_link_mtu, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, iface.traffic_class,
- IDBM_SHOW, num, 1);
+ if (iface_type == ISCSI_IFACE_TYPE_IPV4) {
+ __recinfo_str(IFACE_BOOT_PROTO, ri, r, iface.bootproto,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_SUBNET_MASK, ri, r, iface.subnet_mask,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GATEWAY, ri, r, iface.gateway, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID, ri, r,
+ iface.dhcp_alt_client_id_state, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r,
+ iface.dhcp_alt_client_id, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_DNS, ri, r, iface.dhcp_dns, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r,
+ iface.dhcp_learn_iqn, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_REQ_VID, ri, r,
+ iface.dhcp_req_vendor_id_state, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_VID, ri, r, iface.dhcp_vendor_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID_STR, ri, r, iface.dhcp_vendor_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, iface.dhcp_slp_da,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_FRAGMENTATION, ri, r, iface.fragmentation,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GRAT_ARP, ri, r, iface.gratuitous_arp,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_IN_FORWARD, ri, r,
+ iface.incoming_forwarding, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TOS_STATE, ri, r, iface.tos_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TOS, ri, r, iface.tos, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TTL, ri, r, iface.ttl, IDBM_SHOW, num, 1);
+ } else if (iface_type == ISCSI_IFACE_TYPE_IPV6) {
+ __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, iface.ipv6_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r,
+ iface.linklocal_autocfg, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, iface.router_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_LINKLOCAL, ri, r, iface.ipv6_linklocal,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_ROUTER, ri, r, iface.ipv6_router,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r,
+ iface.dup_addr_detect_cnt, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, iface.flow_label,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r,
+ iface.gratuitous_neighbor_adv, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, iface.hop_limit,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_MLD, ri, r, iface.mld, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r,
+ iface.nd_reachable_tmo, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r,
+ iface.nd_rexmit_time, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, iface.nd_stale_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r,
+ iface.router_adv_link_mtu, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, iface.traffic_class,
+ IDBM_SHOW, num, 1);
+ }
+
__recinfo_str(IFACE_DELAYED_ACK, ri, r, iface.delayed_ack, IDBM_SHOW,
num, 1);
__recinfo_str(IFACE_TCP_NAGLE, ri, r, iface.nagle, IDBM_SHOW, num, 1);
@@ -515,6 +526,9 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
{
int num = 0;
+ int iface_type;
+
+ iface_type = iface_get_iptype(r);
__recinfo_str(IFACE_ISCSINAME, ri, r, name, IDBM_SHOW, num, 0);
__recinfo_str(IFACE_NETNAME, ri, r, netdev, IDBM_SHOW, num, 1);
@@ -523,19 +537,6 @@ void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
__recinfo_str(IFACE_TRANSPORTNAME, ri, r, transport_name,
IDBM_SHOW, num, 1);
__recinfo_str(IFACE_INAME, ri, r, iname, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_BOOT_PROTO, ri, r, bootproto, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_SUBNET_MASK, ri, r, subnet_mask,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_GATEWAY, ri, r, gateway, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, ipv6_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r, linklocal_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, router_autocfg,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_LINKLOCAL, ri, r, ipv6_linklocal,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_ROUTER, ri, r, ipv6_router, IDBM_SHOW, num, 1);
__recinfo_str(IFACE_STATE, ri, r, state, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_VLAN_ID, ri, r, vlan_id, IDBM_SHOW, num, 1);
__recinfo_uint8(IFACE_VLAN_PRIORITY, ri, r, vlan_priority,
@@ -544,46 +545,71 @@ void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
__recinfo_int(IFACE_NUM, ri, r, iface_num, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_MTU, ri, r, mtu, IDBM_SHOW, num, 1);
__recinfo_uint16(IFACE_PORT, ri, r, port, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_ALT_CID, ri, r, dhcp_alt_client_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r, dhcp_alt_client_id,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_DNS, ri, r, dhcp_dns, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r, dhcp_learn_iqn, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_DHCP_REQ_VID, ri, r, dhcp_req_vendor_id_state,
- IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_DHCP_VID, ri, r, dhcp_vendor_id_state, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_DHCP_VID_STR, ri, r, dhcp_vendor_id, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, dhcp_slp_da, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_FRAGMENTATION, ri, r, fragmentation, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_GRAT_ARP, ri, r, gratuitous_arp, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_IN_FORWARD, ri, r, incoming_forwarding, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_TOS_STATE, ri, r, tos_state, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TOS, ri, r, tos, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TTL, ri, r, ttl, IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r, dup_addr_detect_cnt,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, flow_label, IDBM_SHOW,
- num, 1);
- __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r, gratuitous_neighbor_adv,
- IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, hop_limit, IDBM_SHOW, num, 1);
- __recinfo_str(IFACE_MLD, ri, r, mld, IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r, nd_reachable_tmo,
- IDBM_SHOW, num, 1);
- __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r, nd_rexmit_time, IDBM_SHOW,
- num, 1);
- __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, nd_stale_tmo, IDBM_SHOW,
- num, 1);
- __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r, router_adv_link_mtu,
- IDBM_SHOW, num, 1);
- __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, traffic_class, IDBM_SHOW,
- num, 1);
+
+ if (iface_type == ISCSI_IFACE_TYPE_IPV4) {
+ __recinfo_str(IFACE_BOOT_PROTO, ri, r, bootproto, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_SUBNET_MASK, ri, r, subnet_mask, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_GATEWAY, ri, r, gateway, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID, ri, r,
+ dhcp_alt_client_id_state, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_ALT_CID_STR, ri, r, dhcp_alt_client_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_DNS, ri, r, dhcp_dns, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_DHCP_LEARN_IQN, ri, r, dhcp_learn_iqn,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_REQ_VID, ri, r,
+ dhcp_req_vendor_id_state, IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID, ri, r, dhcp_vendor_id_state,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_VID_STR, ri, r, dhcp_vendor_id,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_DHCP_SLP_DA, ri, r, dhcp_slp_da, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_FRAGMENTATION, ri, r, fragmentation,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_GRAT_ARP, ri, r, gratuitous_arp, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_IN_FORWARD, ri, r, incoming_forwarding,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_TOS_STATE, ri, r, tos_state, IDBM_SHOW,
+ num, 1);
+ __recinfo_uint8(IFACE_TOS, ri, r, tos, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TTL, ri, r, ttl, IDBM_SHOW, num, 1);
+ } else if (iface_type == ISCSI_IFACE_TYPE_IPV6) {
+ __recinfo_str(IFACE_IPV6_AUTOCFG, ri, r, ipv6_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_LINKLOCAL_AUTOCFG, ri, r, linklocal_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_ROUTER_AUTOCFG, ri, r, router_autocfg,
+ IDBM_SHOW, num, 1);
+ __recinfo_str(IFACE_LINKLOCAL, ri, r, ipv6_linklocal, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_ROUTER, ri, r, ipv6_router, IDBM_SHOW,
+ num, 1);
+ __recinfo_uint8(IFACE_DUP_ADDR_DETECT_CNT, ri, r,
+ dup_addr_detect_cnt, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_FLOW_LABEL, ri, r, flow_label, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_GRAT_NEIGHBOR_ADV, ri, r,
+ gratuitous_neighbor_adv, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_HOP_LIMIT, ri, r, hop_limit, IDBM_SHOW,
+ num, 1);
+ __recinfo_str(IFACE_MLD, ri, r, mld, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REACHABLE_TMO, ri, r,
+ nd_reachable_tmo, IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_REXMIT_TIME, ri, r, nd_rexmit_time,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_ND_STALE_TMO, ri, r, nd_stale_tmo,
+ IDBM_SHOW, num, 1);
+ __recinfo_uint32(IFACE_RTR_ADV_LINK_MTU, ri, r,
+ router_adv_link_mtu, IDBM_SHOW, num, 1);
+ __recinfo_uint8(IFACE_TRAFFIC_CLASS, ri, r, traffic_class,
+ IDBM_SHOW, num, 1);
+ }
+
__recinfo_str(IFACE_DELAYED_ACK, ri, r, delayed_ack, IDBM_SHOW, num, 1);
__recinfo_str(IFACE_TCP_NAGLE, ri, r, nagle, IDBM_SHOW, num, 1);
__recinfo_str(IFACE_TCP_WSF_STATE, ri, r, tcp_wsf_state, IDBM_SHOW,
--
1.8.3.1

View File

@ -0,0 +1,534 @@
From 072d8b931e8e03875e5220546e68d5fb2e80bcda Mon Sep 17 00:00:00 2001
From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Date: Fri, 22 Nov 2013 05:46:12 -0500
Subject: [PATCH] iscsiadm: Added document for description of iface attributes
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
sysfs-documentation | 514 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 514 insertions(+)
create mode 100644 sysfs-documentation
diff --git a/sysfs-documentation b/sysfs-documentation
new file mode 100644
index 0000000..54fc497
--- /dev/null
+++ b/sysfs-documentation
@@ -0,0 +1,514 @@
+Description of iface attributes and their valid values
+======================================================
+
+== IPv4 attributes ==
+
+ipaddress
+---------
+IP address in format XXX.XXX.XXX.XXX
+
+gateway
+-------
+IP address of the network router or gateway device in format XXX.XXX.XXX.XXX
+
+subnet
+------
+Broadcast address in format XXX.XXX.XXX.XXX
+
+bootproto
+---------
+The protocol type used to initialize interface
+
+Valid values: "dhcp" or "static"
+
+dhcp_dns_address_en
+-------------------
+Request DNS Server IP Addresses and Domain Name
+
+If bootproto is set to dhcp and dhcp_dns_address_en is enable,
+requests DNS addresses (option 6) and domain name (option 15) in its
+DHCP parameter request list.
+
+Valid values: "enable" or "disable"
+
+dhcp_slp_da_info_en
+-------------------
+Request SLP DA Information and SLP Scope
+If bootproto is set to dhcp and dhcp_slp_da_info_en is enable,
+requests SLP DA information (option 78) and SLP scope (option 79)
+in its DHCP parameter request list.
+
+Valid values: "enable" or "disable"
+
+tos_en
+------
+Enable IPv4 type of service (ToS)
+
+When tos_en is set to enable, use value set in tos when transmitting IPv4 TCP
+packets on iSCSI connections.
+
+Valid values: "enable" or "disable"
+
+tos
+---
+IPv4 Type of service (ToS)
+
+When tos_en is set to enable, use value set in tos when transmitting IPv4 TCP
+packets on iSCSI connections.
+
+Valid range: 8-bit value. [0-255]
+
+grat_arp_en
+-----------
+Enable Gratuitous ARP Requests
+
+Valid values: "enable" or "disable"
+
+dhcp_alt_client_id_en
+---------------------
+DHCP Use Alternate Client ID
+
+When dhcp_alt_client_id_en is set to enable, use the Client ID configured in
+dhcp_alt_client_id as its Client ID (DHCP option 61) in outgoing DHCP messages.
+
+Valid values: "enable" or "disable"
+
+dhcp_alt_client_id
+------------------
+DHCP Alternate Client ID
+
+When dhcp_alt_client_id_en is set to enable, use value set in dhcp_alt_client_id
+for Client ID in DHCP messages.
+
+Valid values: 11-byte Client ID
+
+dhcp_req_vendor_id_en
+---------------------
+DHCP Require Vendor ID
+
+When dhcp_req_vendor_id_en is set to enable, use value set in dhcp_vendor_id as
+its vendor ID (DHCP option 60) in outgoing DHCP messages.
+
+Valid values: "enable" or "disable"
+
+dhcp_use_vendor_id_en
+---------------------
+DHCP Use Vendor ID
+
+When dhcp_use_vendor_id_en is set to enable, use value set in dhcp_vendor_id as
+its vendor ID (DHCP option 60) in outgoing DHCP messages.
+
+Valid values: "enable" or "disable"
+
+dhcp_vendor_id
+--------------
+DHCP Vendor ID
+
+When dhcp_req_vendor_id_en or dhcp_use_vendor_id_en is set to enable,
+use value set in dhcp_vendor_id for Vendor ID in DHCP messages.
+
+Valid values: 11-byte Client ID
+
+dhcp_learn_iqn_en
+-----------------
+DHCP Learn IQN
+
+When dhcp_learn_iqn_en is set to enable, iSCSI initiator attempts to use DHCP
+to learn its (IQN) iSCSI name.
+
+Valid values: "enable" or "disable"
+
+fragment_disable
+----------------
+Fragmentation Disable.
+
+When fragment_disable is set to disable, iSCSI initiator cannot fragment IP
+datagrams.
+
+Valid values: "enable" or "disable"
+
+incoming_forwarding_en
+----------------------
+When incoming_forwarding_en is set to enable, iSCSI initiator forwards all
+incoming network traffic to the network driver, except for iSCSI TCP packets
+destined to the iSCSI initiator.
+
+Valid values: "enable" or "disable"
+
+ttl
+---
+IPv4 Time to Live (TTL)
+
+This attribute contain TTL value sent in IPv4 TCP packets transmitted on
+iSCSI connections.
+
+Valid range: 8-bit value. [0-255]
+
+== IPv6 attributes ==
+
+ipaddress
+---------
+IP address in IPv6 format.
+
+link_local_addr
+---------------
+Link local address in IPv6 format.
+
+router_addr
+-----------
+Router address in IPv6 format.
+
+ipaddr_autocfg
+--------------
+Autoconfigure IPv6 Address.
+
+Valid values: nd, dhcpv6 or disable
+qla4xxx don't support dhcpv6.
+
+link_local_autocfg
+------------------
+Autoconfigure IPv6 Link Local Address.
+
+IPv6 neighbor discovery protocol to discover Link Local Address.
+
+Valid values: auto or disable
+
+
+router_autocfg
+--------------
+Autoconfigure IPv6 Router address.
+
+IPv6 neighbor discovery protocol to discover a default router address.
+
+Valid values: auto or disable
+
+link_local_state
+----------------
+This Read-only attribute show Link Local IP address state in sysfs.
+
+Valid values: Unconfigured, Acquiring, Tentative, Valid, Disabling, Invalid,
+ Deprecated.
+
+
+router_state
+------------
+This Read-only attribute shows router state.
+
+Valid values: Unknown, Advertised, Manual, Stale.
+
+
+grat_neighbor_adv_en
+--------------------
+Enable Gratuitious Neighbor Advertisement
+
+Valid values: "enable" or "disable"
+
+mld_en
+------
+Enable IPv6 Multicast Listener Discovery
+
+Valid values: "enable" or "disable"
+
+flow_label
+----------
+This attribute specifies the default value of the Flow Label field in the
+IPv6 header of TCP packets transmitted on iSCSI connections
+
+Valid range: 20-bit value. [0-1048575]
+Value zero indicates that the traffic is not assigned to a labelled flow.
+
+traffic_class
+-------------
+This attribute specifies the IPv6 traffic class value to be used in IPv6
+TCP packets transmitted from the firmware on iSCSI connections.
+
+Valid range: 8-bit value. [0-255]
+
+hop_limit
+---------
+This attribute specifies the IPv6 hop limit value to be used in IPv6 TCP
+packets transmitted from the firmware on iSCSI connections
+
+Valid range: 8-bit value. [0-255]
+
+nd_reachable_tmo
+----------------
+This attribute specifies the time (in milliseconds) that a node assumes
+that the neighbor is reachable after confirmation.
+
+Valid range: 4-byte value. [0-4294967295]
+
+nd_rexmit_time
+--------------
+This attribute specifies the time (in milliseconds) between retransmitted
+neighbor solicitation messages.
+
+Valid range: 4-byte value. [0-4294967295]
+
+nd_stale_tmo
+------------
+This attribute specifies the time (in milliseconds) after which a stale
+neighbor or destination cache entry is discarded.
+
+Valid range: 4-byte value. [0-4294967295]
+
+dup_addr_detect_cnt
+-------------------
+This attribute specifies the IPv6 duplicate address detection count
+
+Valid range: 8-bit value. [0-255]
+ 0 - Disable
+ 1 - TryOnce
+ 2 - TryTwice, and so on
+
+router_adv_link_mtu
+-------------------
+IPv6 Router Advertised Link MTU Size.
+
+Valid range: 1280 bytes to 1500 bytes
+
+== Common ==
+enabled
+-------
+This attribute is used to enable or disable IPv4 or IPv6 protocol.
+
+Valid values: "enable" or "disable"
+
+vlan_id
+-------
+This attribute specifies 12-bit VLAN identifier (VID)
+
+Valid range: 12-bit value. [1-4094]
+
+vlan_priority
+-------------
+This attribute specifies Priority to outbound packets containing the
+specified VLAN-ID (VID)
+
+Valid range: 3-bit value. [0-7]
+
+vlan_enabled
+------------
+VLAN Tagging Enable.
+
+When this attribute is set to enable, use value set in vlan_id and
+vlan_priority to transmit IP packets, and discards IP packets that were
+received without a matching VLAN ID
+
+Valid values: "enable" or "disable"
+
+mtu
+---
+Ethernet MTU Size.
+
+This field specifies the maximum payload length in byte of an
+Ethernet frame supported by iSCSI initiator.
+
+Valid values: 576 bytes to 9000 bytes
+
+port
+----
+This attribute shows the initiator iSCSI port number.
+
+ipaddress_state
+---------------
+This Read-only attribute show IP address state.
+
+Valid values: Unconfigured, Acquiring, Tentative, Valid, Disabling, Invalid,
+ Deprecated.
+
+delayed_ack_en
+--------------
+When this attribute is set to enable, TCP delayed ACK is enabled.
+
+Valid values: "enable" or "disable"
+
+tcp_nagle_disable
+-----------------
+When this attribute is set to disable, TCP Nagle algorithm is disabled.
+
+Valid values: "enable" or "disable"
+
+tcp_wsf_disable
+---------------
+When this attribute is set to disable, TCP window scale is disabled.
+
+Valid values: "enable" or "disable"
+
+tcp_wsf
+-------
+This attribute specifies the TCP window scale factor to be negotiated
+on TCP connections.
+
+Valid range: 8-bit value. [0-255]
+
+tcp_timer_scale
+---------------
+The TCP Timer Scale is scale factor that adjusts the time interval between
+timer ticks on a TCP connection. The scale factor allows for faster time-outs
+for connections running on a very small network, versus connections running
+on a very large network.
+
+Valid range: 3-bit value. [0-7]
+
+tcp_timestamp_en
+----------------
+When this attribute is set to enable, iSCSI initiator negotiates to use time
+stamps in TCP headers
+
+Valid values: "enable" or "disable"
+
+cache_id
+--------
+This Read-only attribute is used to find the valid cache entries for the
+interface.
+
+For IPv4, ARP cache entry
+For IPv6, Neighbor cache entry
+
+redirect_en
+-----------
+For IPv4:
+When this attribute is set to enable, an ARP redirect can modify the address
+resolution protocol (ARP) table and any active connections.
+
+For IPv6:
+When this attribute is set to enable and neighbor advertisements are received,
+the connection table is examined and updated if any active connections match
+the IP address on the neighbor advertisement. This action is required for
+failover and redirect.
+
+Valid values: "enable" or "disable"
+
+def_taskmgmt_tmo
+----------------
+This attribute specifies timeout interval in seconds that iSCSI uses for
+timing out task-management commands.
+
+Valid range: 16-bit value [0-65535].
+
+header_digest
+-------------
+When this attribute is set to enable iSCSI initiator negotiates for
+HeaderDigest=CRC32 and when set to disable negotiates HeaderDigest=none.
+
+Valid values: "enable" or "disable"
+
+data_digest
+-----------
+When this attribute is set to enable iSCSI initiator negotiates for
+DataDigest=CRC32 and when set to disable negotiates DataDigest=none.
+
+Valid values: "enable" or "disable"
+
+immediate_data
+--------------
+When this attribute is set to enable iSCSI initiator negotiates for
+ImmediateData=yes and When set to disable negotiates ImmediateData=none
+
+Valid values: "enable" or "disable"
+
+initial_r2t
+-----------
+When this attribute is set to enable iSCSI initiator negotiates for
+InitialR2T=yes. When set to disable negotiates InitialR2T=no.
+
+Valid values: "enable" or "disable"
+
+data_seq_in_order
+-----------------
+When this attribute is set to enable iSCSI initiator set data sequences
+in order
+
+Valid values: "enable" or "disable"
+qla4xxx does not support out-of-order data sequences
+
+data_pdu_in_order
+-----------------
+When this attribute is set to enable iSCSI initiator set Data PDU
+in order
+
+Valid values: "enable" or "disable"
+qla4xxx does not support out-of-order Data PDUs.
+
+erl
+---
+Error Recovery Level
+
+This attribute specifies error recovery level (ERL) supported by the
+connection.
+
+Valid values: 2-bit value [0-2]
+
+max_recv_dlength
+----------------
+iSCSI Maximum Receive Data Segment Length.
+
+This attribute specifies Maximum data segment length in bytes, that receive
+in an iSCSI PDU.
+
+first_burst_len
+---------------
+iSCSI First Burst Length
+
+This attribute Specifies the maximum amount of unsolicited data an iSCSI
+initiator can send to the target during the execution of a single SCSI command,
+in bytes.
+
+max_outstanding_r2t
+-------------------
+iSCSI Maximum Outstanding R2T
+
+This attribute Specifies how many R2T PDUs per command can be outstanding
+during an iSCSI session.
+
+max_burst_len
+-------------
+This attribute Specifies the maximum length for unsolicited or immediate data
+iSCSI session can send or receive.
+
+chap_auth
+---------
+When this attribute is set to enable iSCSI session performs authentication
+during the security state of login phase.
+
+Valid values: "enable" or "disable"
+
+bidi_chap
+---------
+When this attribute is set to enable iSCSI session generates a CHAP challenge
+to any target that has issued a CHAP challenge to the iSCSI session.
+iSCSI session issues the challenge to the target after responding to the
+targets challenge. This attribute is ignored if chap_auth is set to disable.
+
+Valid values: "enable" or "disable"
+
+discovery_auth_optional
+-----------------------
+When this attribute is set to enable and the chap_auth is set to enable,
+iSCSI session does not require authentication on discovery sessions unless
+requested by the peer. When this attribute is set to disable iSCSI session
+requires CHAP authentication for a discovery session.
+
+Valid values: "enable" or "disable"
+
+discovery_logout
+----------------
+When this attribute is set to enable, iSCSI initiator initiates an iSCSI logout
+on a discovery session when discovery is complete (before closing the connection).
+When this attribute is set to disable, iSCSI initiator closes the connection when
+discovery is complete.
+
+Valid values: "enable" or "disable"
+
+strict_login_comp_en
+--------------------
+When this attribute is set to enable, iSCSI initiator enforces the iSCSI login
+negotiation rules. When this attribute is set to disable, iSCSI initiator does
+not enforce iSCSI login negotiation.
+
+Valid values: "enable" or "disable"
+
+initiator_name
+--------------
+This Read-only attribute contains the iSCSI Name string used by the firmware.
--
1.8.3.1

View File

@ -0,0 +1,524 @@
From fe6623803d1135fd382146faa847bcdf5dc6abc3 Mon Sep 17 00:00:00 2001
From: Lalit Chandivade <lalit.chandivade@qlogic.com>
Date: Fri, 22 Nov 2013 05:46:13 -0500
Subject: [PATCH] iscsi_tool: Add offload host statistics support.
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
include/iscsi_if.h | 116 ++++++++++++++++++++++++-
usr/iscsi_ipc.h | 2 +
usr/iscsiadm.c | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
usr/netlink.c | 47 +++++++++++
4 files changed, 406 insertions(+), 3 deletions(-)
diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index e59bcd0..9d15811 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -75,8 +75,8 @@ enum iscsi_uevent_e {
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_SET_CHAP,
+ ISCSI_UEVENT_GET_HOST_STATS = UEVENT_BASE + 32,
+ ISCSI_UEVENT_MAX = ISCSI_UEVENT_GET_HOST_STATS,
/* up events */
ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -251,6 +251,10 @@ struct iscsi_uevent {
uint32_t host_no;
uint32_t sid;
} logout_flashnode_sid;
+ struct msg_get_host_stats {
+ uint32_t host_no;
+ } get_host_stats;
+
} u;
union {
/* messages k -> u */
@@ -854,4 +858,112 @@ struct iscsi_chap_rec {
uint8_t password_length;
};
+#define ISCSI_HOST_STATS_CUSTOM_MAX 32
+#define ISCSI_HOST_STATS_CUSTOM_DESC_MAX 64
+struct iscsi_host_stats_custom {
+ char desc[ISCSI_HOST_STATS_CUSTOM_DESC_MAX];
+ uint64_t value;
+};
+
+/* struct iscsi_offload_host_stats: Host statistics,
+ * Include statistics for MAC, IP, TCP & iSCSI.
+ */
+struct iscsi_offload_host_stats {
+ /* MAC */
+ uint64_t mactx_frames;
+ uint64_t mactx_bytes;
+ uint64_t mactx_multicast_frames;
+ uint64_t mactx_broadcast_frames;
+ uint64_t mactx_pause_frames;
+ uint64_t mactx_control_frames;
+ uint64_t mactx_deferral;
+ uint64_t mactx_excess_deferral;
+ uint64_t mactx_late_collision;
+ uint64_t mactx_abort;
+ uint64_t mactx_single_collision;
+ uint64_t mactx_multiple_collision;
+ uint64_t mactx_collision;
+ uint64_t mactx_frames_dropped;
+ uint64_t mactx_jumbo_frames;
+ uint64_t macrx_frames;
+ uint64_t macrx_bytes;
+ uint64_t macrx_unknown_control_frames;
+ uint64_t macrx_pause_frames;
+ uint64_t macrx_control_frames;
+ uint64_t macrx_dribble;
+ uint64_t macrx_frame_length_error;
+ uint64_t macrx_jabber;
+ uint64_t macrx_carrier_sense_error;
+ uint64_t macrx_frame_discarded;
+ uint64_t macrx_frames_dropped;
+ uint64_t mac_crc_error;
+ uint64_t mac_encoding_error;
+ uint64_t macrx_length_error_large;
+ uint64_t macrx_length_error_small;
+ uint64_t macrx_multicast_frames;
+ uint64_t macrx_broadcast_frames;
+ /* IP */
+ uint64_t iptx_packets;
+ uint64_t iptx_bytes;
+ uint64_t iptx_fragments;
+ uint64_t iprx_packets;
+ uint64_t iprx_bytes;
+ uint64_t iprx_fragments;
+ uint64_t ip_datagram_reassembly;
+ uint64_t ip_invalid_address_error;
+ uint64_t ip_error_packets;
+ uint64_t ip_fragrx_overlap;
+ uint64_t ip_fragrx_outoforder;
+ uint64_t ip_datagram_reassembly_timeout;
+ uint64_t ipv6tx_packets;
+ uint64_t ipv6tx_bytes;
+ uint64_t ipv6tx_fragments;
+ uint64_t ipv6rx_packets;
+ uint64_t ipv6rx_bytes;
+ uint64_t ipv6rx_fragments;
+ uint64_t ipv6_datagram_reassembly;
+ uint64_t ipv6_invalid_address_error;
+ uint64_t ipv6_error_packets;
+ uint64_t ipv6_fragrx_overlap;
+ uint64_t ipv6_fragrx_outoforder;
+ uint64_t ipv6_datagram_reassembly_timeout;
+ /* TCP */
+ uint64_t tcptx_segments;
+ uint64_t tcptx_bytes;
+ uint64_t tcprx_segments;
+ uint64_t tcprx_byte;
+ uint64_t tcp_duplicate_ack_retx;
+ uint64_t tcp_retx_timer_expired;
+ uint64_t tcprx_duplicate_ack;
+ uint64_t tcprx_pure_ackr;
+ uint64_t tcptx_delayed_ack;
+ uint64_t tcptx_pure_ack;
+ uint64_t tcprx_segment_error;
+ uint64_t tcprx_segment_outoforder;
+ uint64_t tcprx_window_probe;
+ uint64_t tcprx_window_update;
+ uint64_t tcptx_window_probe_persist;
+ /* ECC */
+ uint64_t ecc_error_correction;
+ /* iSCSI */
+ uint64_t iscsi_pdu_tx;
+ uint64_t iscsi_data_bytes_tx;
+ uint64_t iscsi_pdu_rx;
+ uint64_t iscsi_data_bytes_rx;
+ uint64_t iscsi_io_completed;
+ uint64_t iscsi_unexpected_io_rx;
+ uint64_t iscsi_format_error;
+ uint64_t iscsi_hdr_digest_error;
+ uint64_t iscsi_data_digest_error;
+ uint64_t iscsi_sequence_error;
+ /*
+ * iSCSI Custom Host Statistics support, i.e. Transport could
+ * extend existing host statistics with its own specific statistics
+ * up to ISCSI_HOST_STATS_CUSTOM_MAX
+ */
+ uint32_t custom_length;
+ struct iscsi_host_stats_custom custom[0]
+ __attribute__ ((aligned (sizeof(uint64_t))));
+};
+
#endif
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
index a32da1c..9d26d54 100644
--- a/usr/iscsi_ipc.h
+++ b/usr/iscsi_ipc.h
@@ -161,6 +161,8 @@ struct iscsi_ipc {
uint32_t flashnode_idx);
int (*logout_flash_node_sid) (uint64_t transport_handle,
uint32_t host_no, uint32_t sid);
+ int (*get_host_stats) (uint64_t transport_handle, uint32_t host_no,
+ char *host_stats);
};
#endif /* ISCSI_IPC_H */
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 045259b..ed2c0c3 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -69,7 +69,8 @@ enum iscsiadm_mode {
MODE_FW,
MODE_PING,
MODE_CHAP,
- MODE_FLASHNODE
+ MODE_FLASHNODE,
+ MODE_HOST_STATS
};
enum iscsiadm_op {
@@ -137,6 +138,7 @@ iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P printlevel] [ -r sessionid
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 [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \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 ] ] | [ -C stats ] ]\n\
iscsiadm -k priority\n");
}
exit(status);
@@ -207,6 +209,9 @@ str_to_submode(char *str)
sub_mode = MODE_CHAP;
else if (!strcmp("flashnode", str))
sub_mode = MODE_FLASHNODE;
+ else if (!strcmp("stats", str))
+ sub_mode = MODE_HOST_STATS;
+
else
sub_mode = -1;
@@ -2025,6 +2030,232 @@ exit_flashnode_op:
return rc;
}
+static void print_host_stats(struct iscsi_offload_host_stats *host_stats)
+{
+ /* MAC */
+ printf("Host Statistics:\n"
+ "\tmactx_frames: %lld\n"
+ "\tmactx_bytes: %lld\n"
+ "\tmactx_multicast_frames: %lld\n"
+ "\tmactx_broadcast_frames: %lld\n"
+ "\tmactx_pause_frames: %lld\n"
+ "\tmactx_control_frames: %lld\n"
+ "\tmactx_deferral: %lld\n"
+ "\tmactx_excess_deferral: %lld\n"
+ "\tmactx_late_collision: %lld\n"
+ "\tmactx_abort: %lld\n"
+ "\tmactx_single_collision: %lld\n"
+ "\tmactx_multiple_collision: %lld\n"
+ "\tmactx_collision: %lld\n"
+ "\tmactx_frames_dropped: %lld\n"
+ "\tmactx_jumbo_frames: %lld\n"
+ "\tmacrx_frames: %lld\n"
+ "\tmacrx_bytes: %lld\n"
+ "\tmacrx_unknown_control_frames: %lld\n"
+ "\tmacrx_pause_frames: %lld\n"
+ "\tmacrx_control_frames: %lld\n"
+ "\tmacrx_dribble: %lld\n"
+ "\tmacrx_frame_length_error: %lld\n"
+ "\tmacrx_jabber: %lld\n"
+ "\tmacrx_carrier_sense_error: %lld\n"
+ "\tmacrx_frame_discarded: %lld\n"
+ "\tmacrx_frames_dropped: %lld\n"
+ "\tmac_crc_error: %lld\n"
+ "\tmac_encoding_error: %lld\n"
+ "\tmacrx_length_error_large: %lld\n"
+ "\tmacrx_length_error_small: %lld\n"
+ "\tmacrx_multicast_frames: %lld\n"
+ "\tmacrx_broadcast_frames: %lld\n"
+ /* IP */
+ "\tiptx_packets: %lld\n"
+ "\tiptx_bytes: %lld\n"
+ "\tiptx_fragments: %lld\n"
+ "\tiprx_packets: %lld\n"
+ "\tiprx_bytes: %lld\n"
+ "\tiprx_fragments: %lld\n"
+ "\tip_datagram_reassembly: %lld\n"
+ "\tip_invalid_address_error: %lld\n"
+ "\tip_error_packets: %lld\n"
+ "\tip_fragrx_overlap: %lld\n"
+ "\tip_fragrx_outoforder: %lld\n"
+ "\tip_datagram_reassembly_timeout: %lld\n"
+ "\tipv6tx_packets: %lld\n"
+ "\tipv6tx_bytes: %lld\n"
+ "\tipv6tx_fragments: %lld\n"
+ "\tipv6rx_packets: %lld\n"
+ "\tipv6rx_bytes: %lld\n"
+ "\tipv6rx_fragments: %lld\n"
+ "\tipv6_datagram_reassembly: %lld\n"
+ "\tipv6_invalid_address_error: %lld\n"
+ "\tipv6_error_packets: %lld\n"
+ "\tipv6_fragrx_overlap: %lld\n"
+ "\tipv6_fragrx_outoforder: %lld\n"
+ "\tipv6_datagram_reassembly_timeout: %lld\n"
+ /* TCP */
+ "\ttcptx_segments: %lld\n"
+ "\ttcptx_bytes: %lld\n"
+ "\ttcprx_segments: %lld\n"
+ "\ttcprx_byte: %lld\n"
+ "\ttcp_duplicate_ack_retx: %lld\n"
+ "\ttcp_retx_timer_expired: %lld\n"
+ "\ttcprx_duplicate_ack: %lld\n"
+ "\ttcprx_pure_ackr: %lld\n"
+ "\ttcptx_delayed_ack: %lld\n"
+ "\ttcptx_pure_ack: %lld\n"
+ "\ttcprx_segment_error: %lld\n"
+ "\ttcprx_segment_outoforder: %lld\n"
+ "\ttcprx_window_probe: %lld\n"
+ "\ttcprx_window_update: %lld\n"
+ "\ttcptx_window_probe_persist: %lld\n"
+ /* ECC */
+ "\tecc_error_correction: %lld\n"
+ /* iSCSI */
+ "\tiscsi_pdu_tx: %lld\n"
+ "\tiscsi_data_bytes_tx: %lld\n"
+ "\tiscsi_pdu_rx: %lld\n"
+ "\tiscsi_data_bytes_rx: %lld\n"
+ "\tiscsi_io_completed: %lld\n"
+ "\tiscsi_unexpected_io_rx: %lld\n"
+ "\tiscsi_format_error: %lld\n"
+ "\tiscsi_hdr_digest_error: %lld\n"
+ "\tiscsi_data_digest_error: %lld\n"
+ "\tiscsi_sequence_error: %lld\n",
+ /* MAC */
+ (unsigned long long)host_stats->mactx_frames,
+ (unsigned long long)host_stats->mactx_bytes,
+ (unsigned long long)host_stats->mactx_multicast_frames,
+ (unsigned long long)host_stats->mactx_broadcast_frames,
+ (unsigned long long)host_stats->mactx_pause_frames,
+ (unsigned long long)host_stats->mactx_control_frames,
+ (unsigned long long)host_stats->mactx_deferral,
+ (unsigned long long)host_stats->mactx_excess_deferral,
+ (unsigned long long)host_stats->mactx_late_collision,
+ (unsigned long long)host_stats->mactx_abort,
+ (unsigned long long)host_stats->mactx_single_collision,
+ (unsigned long long)host_stats->mactx_multiple_collision,
+ (unsigned long long)host_stats->mactx_collision,
+ (unsigned long long)host_stats->mactx_frames_dropped,
+ (unsigned long long)host_stats->mactx_jumbo_frames,
+ (unsigned long long)host_stats->macrx_frames,
+ (unsigned long long)host_stats->macrx_bytes,
+ (unsigned long long)host_stats->macrx_unknown_control_frames,
+ (unsigned long long)host_stats->macrx_pause_frames,
+ (unsigned long long)host_stats->macrx_control_frames,
+ (unsigned long long)host_stats->macrx_dribble,
+ (unsigned long long)host_stats->macrx_frame_length_error,
+ (unsigned long long)host_stats->macrx_jabber,
+ (unsigned long long)host_stats->macrx_carrier_sense_error,
+ (unsigned long long)host_stats->macrx_frame_discarded,
+ (unsigned long long)host_stats->macrx_frames_dropped,
+ (unsigned long long)host_stats->mac_crc_error,
+ (unsigned long long)host_stats->mac_encoding_error,
+ (unsigned long long)host_stats->macrx_length_error_large,
+ (unsigned long long)host_stats->macrx_length_error_small,
+ (unsigned long long)host_stats->macrx_multicast_frames,
+ (unsigned long long)host_stats->macrx_broadcast_frames,
+ /* IP */
+ (unsigned long long)host_stats->iptx_packets,
+ (unsigned long long)host_stats->iptx_bytes,
+ (unsigned long long)host_stats->iptx_fragments,
+ (unsigned long long)host_stats->iprx_packets,
+ (unsigned long long)host_stats->iprx_bytes,
+ (unsigned long long)host_stats->iprx_fragments,
+ (unsigned long long)host_stats->ip_datagram_reassembly,
+ (unsigned long long)host_stats->ip_invalid_address_error,
+ (unsigned long long)host_stats->ip_error_packets,
+ (unsigned long long)host_stats->ip_fragrx_overlap,
+ (unsigned long long)host_stats->ip_fragrx_outoforder,
+ (unsigned long long)host_stats->ip_datagram_reassembly_timeout,
+ (unsigned long long)host_stats->ipv6tx_packets,
+ (unsigned long long)host_stats->ipv6tx_bytes,
+ (unsigned long long)host_stats->ipv6tx_fragments,
+ (unsigned long long)host_stats->ipv6rx_packets,
+ (unsigned long long)host_stats->ipv6rx_bytes,
+ (unsigned long long)host_stats->ipv6rx_fragments,
+ (unsigned long long)host_stats->ipv6_datagram_reassembly,
+ (unsigned long long)host_stats->ipv6_invalid_address_error,
+ (unsigned long long)host_stats->ipv6_error_packets,
+ (unsigned long long)host_stats->ipv6_fragrx_overlap,
+ (unsigned long long)host_stats->ipv6_fragrx_outoforder,
+ (unsigned long long)host_stats->ipv6_datagram_reassembly_timeout,
+ /* TCP */
+ (unsigned long long)host_stats->tcptx_segments,
+ (unsigned long long)host_stats->tcptx_bytes,
+ (unsigned long long)host_stats->tcprx_segments,
+ (unsigned long long)host_stats->tcprx_byte,
+ (unsigned long long)host_stats->tcp_duplicate_ack_retx,
+ (unsigned long long)host_stats->tcp_retx_timer_expired,
+ (unsigned long long)host_stats->tcprx_duplicate_ack,
+ (unsigned long long)host_stats->tcprx_pure_ackr,
+ (unsigned long long)host_stats->tcptx_delayed_ack,
+ (unsigned long long)host_stats->tcptx_pure_ack,
+ (unsigned long long)host_stats->tcprx_segment_error,
+ (unsigned long long)host_stats->tcprx_segment_outoforder,
+ (unsigned long long)host_stats->tcprx_window_probe,
+ (unsigned long long)host_stats->tcprx_window_update,
+ (unsigned long long)host_stats->tcptx_window_probe_persist,
+ /* ECC */
+ (unsigned long long)host_stats->ecc_error_correction,
+ /* iSCSI */
+ (unsigned long long)host_stats->iscsi_pdu_tx,
+ (unsigned long long)host_stats->iscsi_data_bytes_tx,
+ (unsigned long long)host_stats->iscsi_pdu_rx,
+ (unsigned long long)host_stats->iscsi_data_bytes_rx,
+ (unsigned long long)host_stats->iscsi_io_completed,
+ (unsigned long long)host_stats->iscsi_unexpected_io_rx,
+ (unsigned long long)host_stats->iscsi_format_error,
+ (unsigned long long)host_stats->iscsi_hdr_digest_error,
+ (unsigned long long)host_stats->iscsi_data_digest_error,
+ (unsigned long long)host_stats->iscsi_sequence_error);
+}
+
+static int exec_host_stats_op(int op, int info_level, uint32_t host_no)
+{
+ struct iscsi_transport *t = NULL;
+ char *req_buf;
+ int rc = ISCSI_SUCCESS;
+ int fd = 0, buf_size = 0;
+
+ t = iscsi_sysfs_get_transport_by_hba(host_no);
+ if (!t) {
+ log_error("Could not match hostno %u to transport.", host_no);
+ rc = ISCSI_ERR_TRANS_NOT_FOUND;
+ goto exit_host_stats;
+ }
+
+ buf_size = sizeof(struct iscsi_offload_host_stats) +
+ sizeof(struct iscsi_uevent);
+ req_buf = calloc(1, buf_size);
+ if (!req_buf) {
+ log_error("Could not allocate memory for host stats request.");
+ rc = ISCSI_ERR_NOMEM;
+ goto exit_host_stats;
+ }
+
+ fd = ipc->ctldev_open();
+ if (fd < 0) {
+ rc = ISCSI_ERR_INTERNAL;
+ log_error("Netlink open failed.");
+ goto exit_host_stats;
+ }
+
+ rc = ipc->get_host_stats(t->handle, host_no, req_buf);
+ if (rc < 0) {
+ log_error("get_host_stats failed. errno=%d", errno);
+ rc = ISCSI_ERR;
+ goto exit_host_stats;
+ }
+
+ print_host_stats(req_buf + sizeof(struct iscsi_uevent));
+
+ ipc->ctldev_close();
+
+exit_host_stats:
+ if (req_buf)
+ free(req_buf);
+ return rc;
+}
+
static int verify_iface_params(struct list_head *params, struct node_rec *rec)
{
struct user_param *param;
@@ -3239,6 +3470,17 @@ main(int argc, char **argv)
index, portal_type,
&params);
break;
+ case MODE_HOST_STATS:
+ if (!host_no) {
+ log_error("STATS mode requires host no");
+ rc = ISCSI_ERR_INVAL;
+ break;
+ }
+
+ rc = exec_host_stats_op(op, info_level,
+ host_no);
+ break;
+
default:
log_error("Invalid Sub Mode");
break;
diff --git a/usr/netlink.c b/usr/netlink.c
index 151b56d..1c4b5cc 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -339,6 +339,10 @@ __kipc_call(struct iovec *iovp, int count)
} else if (ev->type == ISCSI_UEVENT_GET_CHAP) {
/* kget_chap() will read */
return 0;
+ } else if (ev->type == ISCSI_UEVENT_GET_HOST_STATS) {
+ /* kget_host_stats() will read */
+ return 0;
+
} else {
if ((rc = nlpayload_read(ctrl_fd, (void*)ev,
sizeof(*ev), 0)) < 0) {
@@ -1439,6 +1443,48 @@ klogout_flashnode_sid(uint64_t transport_handle, uint32_t host_no,
return 0;
}
+static int kget_host_stats(uint64_t transport_handle, uint32_t host_no,
+ char *host_stats)
+{
+ int rc = 0;
+ int ev_size;
+ struct iscsi_uevent ev;
+ struct iovec iov[2];
+ char nlm_ev[NLMSG_SPACE(sizeof(struct iscsi_uevent))];
+ struct nlmsghdr *nlh;
+
+ memset(&ev, 0, sizeof(struct iscsi_uevent));
+
+ ev.type = ISCSI_UEVENT_GET_HOST_STATS;
+ ev.transport_handle = transport_handle;
+ ev.u.get_host_stats.host_no = host_no;
+
+ iov[1].iov_base = &ev;
+ iov[1].iov_len = sizeof(ev);
+ rc = __kipc_call(iov, 2);
+ if (rc < 0)
+ return rc;
+
+ if ((rc = nl_read(ctrl_fd, nlm_ev,
+ NLMSG_SPACE(sizeof(struct iscsi_uevent)),
+ MSG_PEEK)) < 0) {
+ log_error("can not read nlm_ev, error %d", rc);
+ return rc;
+ }
+
+ nlh = (struct nlmsghdr *)nlm_ev;
+ ev_size = nlh->nlmsg_len - NLMSG_ALIGN(sizeof(struct nlmsghdr));
+
+ if ((rc = nlpayload_read(ctrl_fd, (void *)host_stats,
+ ev_size, 0)) < 0) {
+ log_error("can not read from NL socket, error %d", rc);
+ return rc;
+ }
+
+ return rc;
+}
+
+
static void drop_data(struct nlmsghdr *nlh)
{
int ev_size;
@@ -1737,6 +1783,7 @@ struct iscsi_ipc nl_ipc = {
.login_flash_node = klogin_flashnode,
.logout_flash_node = klogout_flashnode,
.logout_flash_node_sid = klogout_flashnode_sid,
+ .get_host_stats = kget_host_stats,
};
struct iscsi_ipc *ipc = &nl_ipc;
--
1.8.3.1

View File

@ -0,0 +1,33 @@
From d1e8e68f440bbcf5c8b716572ccb3a0904dcd35e Mon Sep 17 00:00:00 2001
From: Lalit Chandivade <lalit.chandivade@qlogic.com>
Date: Fri, 22 Nov 2013 05:46:14 -0500
Subject: [PATCH] README: Updated for host statistics.
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
README | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/README b/README
index 813548d..06d1b6f 100644
--- a/README
+++ b/README
@@ -1073,6 +1073,14 @@ To now log into targets it is the same as with sofware iscsi. See section
is free then entry of type bidi chap will be created at that index
with given username_in and password_in values.
+ Host mode with stats submode:
+
+ - Display host statistics:
+ ./iscsiadm -m host -H 6 -C stats
+
+ This will print the aggregate statistics on the host adapter port.
+ This includes MAC, TCP/IP, ECC & iSCSI statistics.
+
6. Configuration
================
--
1.8.3.1

View File

@ -0,0 +1,51 @@
From 4a3076b56834d444eb9e19fc5fa25fff3a9624ec Mon Sep 17 00:00:00 2001
From: Lalit Chandivade <lalit.chandivade@qlogic.com>
Date: Fri, 22 Nov 2013 05:46:15 -0500
Subject: [PATCH] iscsiadm.8: Updated man page for host statistics.
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
doc/iscsiadm.8 | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index 0e8149c..d59af43 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -18,6 +18,8 @@ iscsiadm \- open-iscsi administration utility
\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 \-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 ] ] | [ \-C stats ]]
+
\fBiscsiadm\fR \-k priority
.SH "DESCRIPTION"
@@ -72,12 +74,14 @@ Currently iscsiadm support ping as submode for iface. For example,
iscsiadm -m iface -I ifacename -C ping -a ipaddr -b packetsize -c count -i interval
-For host, it supports chap and flashnode as submodes. For example,
+For host, it supports chap , flashnode and stats as submodes. For example,
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
+iscsiadm -m host -H hostno -C stats
+
.TP
\fB\-d\fR, \fB\-\-debug=\fIdebug_level\fP
print debugging information. Valid values for debug_level are 0 to 8.
@@ -279,6 +283,7 @@ tuple passed in.
.TP
\fB\-s\fR, \fB\-\-stats\fR
Display session statistics.
+This option when used with host mode, displays host statistics.
.TP
\fB\-S\fR, \fB\-\-show\fR
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 505ed9d3dbc6f3d746833a2cad7fb62d9ca20c35 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Mon, 30 Dec 2013 06:14:40 -0500
Subject: [PATCH] iscsi tools: Fix the iscsiadm help options for host mode
Removing the redundant help message for host mode of iscsiadm.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
usr/iscsiadm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index ed2c0c3..3cde8d1 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -137,8 +137,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 [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \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 ] ] | [ -C stats ] ]\n\
+iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] | [ -C stats ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \n\
iscsiadm -k priority\n");
}
exit(status);
--
1.8.3.1

View File

@ -0,0 +1,31 @@
From bd91b810918df6ac09167aa37c6dc1f32bf907be Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Mon, 30 Dec 2013 06:14:41 -0500
Subject: [PATCH] Man page correction for host mode options of iscsiadm
Correct the help options of iscsiadm host mode in its man page.
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
doc/iscsiadm.8 | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index d59af43..9a945d1 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -16,9 +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 [ \-x chap_tbl_idx ] ] | [ \-C flashnode [ \-A portal_type ] [ \-x flashnode_idx ] ] ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ]
-
-\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 ] ] | [ \-C stats ]]
+\fBiscsiadm\fR \-m host [ \-P printlevel ] [ \-H hostno|MAC ] [ [ \-C chap [ \-x chap_tbl_idx ] ] | [ \-C flashnode [ \-A portal_type ] [ \-x flashnode_idx ] ] | [ \-C stats ] ] [ [ \-o operation ] [ \-n name ] [ \-v value ] ]
\fBiscsiadm\fR \-k priority
--
1.8.3.1

View File

@ -0,0 +1,75 @@
From 77245b944b7d14a4e139984c3773e994c6ef6703 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:12 -0800
Subject: [PATCH] ISCSIUIO: Added tx doorbell override mechanism
Added a new tx doorbell field in the uio path to work with new
bnx2x/cnic drivers that supports VF_RSS.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/src/unix/libs/bnx2x.c | 13 ++++++++++---
iscsiuio/src/unix/libs/bnx2x.h | 9 ++++++++-
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c
index 36fc48e..748b59d 100644
--- a/iscsiuio/src/unix/libs/bnx2x.c
+++ b/iscsiuio/src/unix/libs/bnx2x.c
@@ -900,8 +900,14 @@ static int bnx2x_open(nic_t *nic)
struct client_init_general_data *data = bp->bufs;
bp->client_id = data->client_id;
- if (data->reserved0)
- bp->cid = data->reserved0;
+ if (data->uid.cid)
+ bp->cid = data->uid.cid;
+ if (bp->version.minor >= 78 && bp->version.sub_minor >= 55 &&
+ data->uid.cid_override_key == UIO_USE_TX_DOORBELL) {
+ bp->tx_doorbell = data->uid.tx_db_off;
+ LOG_INFO(PFX "%s: tx doorbell override offset = 0x%x",
+ nic->log_name, bp->tx_doorbell);
+ }
}
LOG_INFO(PFX "%s: func 0x%x, pfid 0x%x, client_id 0x%x, cid 0x%x",
@@ -928,7 +934,8 @@ static int bnx2x_open(nic_t *nic)
USTORM_RX_PRODS_E2_OFFSET(cl_qzone_id) :
USTORM_RX_PRODS_E1X_OFFSET(bp->port, bp->client_id));
- bp->tx_doorbell = bp->cid * 0x80 + 0x40;
+ if (!bp->tx_doorbell)
+ bp->tx_doorbell = bp->cid * 0x80 + 0x40;
bp->get_rx_cons = bnx2x_get_rx_60;
bp->get_tx_cons = bnx2x_get_tx_60;
diff --git a/iscsiuio/src/unix/libs/bnx2x.h b/iscsiuio/src/unix/libs/bnx2x.h
index 0b74e44..ce55cfc 100644
--- a/iscsiuio/src/unix/libs/bnx2x.h
+++ b/iscsiuio/src/unix/libs/bnx2x.h
@@ -382,6 +382,13 @@ union eth_rx_cqe_70 {
struct eth_rx_cqe_next_page_70 next_page_cqe_70;
};
+struct uio_init_data {
+ __u32 cid;
+ __u32 tx_db_off;
+ __u32 cid_override_key;
+#define UIO_USE_TX_DOORBELL 0x017855DB
+};
+
struct client_init_general_data {
__u8 client_id;
__u8 statistics_counter_id;
@@ -394,7 +401,7 @@ struct client_init_general_data {
__u8 func_id;
__u8 cos;
__u8 traffic_type;
- __u32 reserved0;
+ struct uio_init_data uid;
};
/******************************************************************************
--
1.8.3.1

View File

@ -0,0 +1,29 @@
From df68365bef167778fb59059e78090d33a01e4e7f Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:13 -0800
Subject: [PATCH] ISCSIUIO: Added fix for the iface.subnet_mask decoding for
IPv6
Fixed a inet_pton decode error for the iface.subnet_mask for IPv6.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/src/unix/iscsid_ipc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
index e22de0d..033308d 100644
--- a/iscsiuio/src/unix/iscsid_ipc.c
+++ b/iscsiuio/src/unix/iscsid_ipc.c
@@ -274,7 +274,7 @@ static int decode_iface(struct iface_rec_decode *ird, struct iface_rec *rec)
sizeof(struct in6_addr));
/* Subnet mask priority: CIDR, then rec */
if (!ird->ipv6_subnet_mask.s6_addr)
- inet_pton(AF_INET, rec->subnet_mask,
+ inet_pton(AF_INET6, rec->subnet_mask,
&ird->ipv6_subnet_mask);
/* For LL on, ignore the IPv6 addr in the iface */
--
1.8.3.1

View File

@ -0,0 +1,41 @@
From 817a0831c54f06dda2727fe1118e7a65181eb128 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:14 -0800
Subject: [PATCH] ISCSIUIO: Added fix for the ARP cache flush mechanism
The ARP cache table wasn't being flushed correctly due to a bug
in the time stamp comparison. The same bug can also be observed
to find the oldest entry in the ARP cache table to override.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/src/uip/uip_arp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/iscsiuio/src/uip/uip_arp.c b/iscsiuio/src/uip/uip_arp.c
index f7a9594..a8de07f 100644
--- a/iscsiuio/src/uip/uip_arp.c
+++ b/iscsiuio/src/uip/uip_arp.c
@@ -112,7 +112,7 @@ void uip_arp_timer(void)
for (i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
if ((tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 &&
- arptime - tabptr->time >= UIP_ARP_MAXAGE)
+ (u8_t)(arptime - tabptr->time) >= UIP_ARP_MAXAGE)
memset(tabptr->ipaddr, 0, 4);
}
@@ -165,8 +165,8 @@ static void uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr)
c = 0;
for (i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
- if (arptime - tabptr->time > tmpage) {
- tmpage = arptime - tabptr->time;
+ if ((u8_t)(arptime - tabptr->time) > tmpage) {
+ tmpage = (u8_t)(arptime - tabptr->time);
c = i;
}
}
--
1.8.3.1

View File

@ -0,0 +1,102 @@
From eb1d2751f989b8c9031964912ef2e952916735ca Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:15 -0800
Subject: [PATCH] ISCSIUIO: Updated RELEASE note and version
old version: 0.7.8.1b
new version: 0.7.8.2
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/README | 4 ++--
iscsiuio/RELEASE.TXT | 24 ++++++++++++++++++++++--
iscsiuio/configure.ac | 4 ++--
iscsiuio/docs/iscsiuio.8 | 2 +-
4 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/iscsiuio/README b/iscsiuio/README
index e7e5fe4..a283116 100644
--- a/iscsiuio/README
+++ b/iscsiuio/README
@@ -1,6 +1,6 @@
Iscsiuio Userspace Tool
-Version 0.7.8.1b
-May 01, 2013
+Version 0.7.8.2
+Dec 10, 2013
------------------------------------------------------
This tool is to be used in conjunction with the Broadcom NetXtreme II Linux
diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT
index de70667..22628fd 100644
--- a/iscsiuio/RELEASE.TXT
+++ b/iscsiuio/RELEASE.TXT
@@ -1,7 +1,7 @@
Release Notes
Broadcom uIP Linux Driver
- Version 0.7.8.1b
- 05/01/2013
+ Version 0.7.8.2
+ 12/10/2013
Broadcom Corporation
5300 California Avenue,
@@ -10,6 +10,26 @@
Copyright (c) 2004 - 2013 Broadcom Corporation
All rights reserved
+uIP v0.7.8.2 (Dec 10, 2013)
+=======================================================
+ Fixes
+ -----
+ 1. Problem: Cont00072053 - Some hardware iSCSI paths fail during test
+ Cause: The test exercised a corner case where the ARP cache flush
+ mechanism didn't work properly
+ Change: Fixed the ARP cache flush mechanism
+ Impact: All
+
+ Enhancements
+ ------------
+ 1. Change: Added a new tx doorbell field in the uio path to work with
+ the new bnx2x/cnic drivers that supports VF_RSS
+ Impact: 10G only
+
+ 2. Change: Fixed the iface.subnet_mask decoding for IPv6
+ Impact: IPv6
+
+
uIP v0.7.8.1b (May 01, 2013)
=======================================================
Enhancements
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac
index e9a5e32..381b94d 100644
--- a/iscsiuio/configure.ac
+++ b/iscsiuio/configure.ac
@@ -11,9 +11,9 @@ dnl Benjamin Li (benli@broadcom.com)
dnl
PACKAGE=iscsiuio
-VERSION=0.7.8.1b
+VERSION=0.7.8.2
-AC_INIT(iscsiuio, 0.7.8.1b, eddie.wai@broadcom.com)
+AC_INIT(iscsiuio, 0.7.8.2, eddie.wai@broadcom.com)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_CONFIG_HEADER(config.h)
diff --git a/iscsiuio/docs/iscsiuio.8 b/iscsiuio/docs/iscsiuio.8
index ea21d78..3b50409 100644
--- a/iscsiuio/docs/iscsiuio.8
+++ b/iscsiuio/docs/iscsiuio.8
@@ -5,7 +5,7 @@
.\"
.\" bnx2.4,v 0.7.8.1b
.\"
-.TH iscsiuio 8 "05/01/2013" "Broadcom Corporation"
+.TH iscsiuio 8 "12/10/2013" "Broadcom Corporation"
.\"
.\" NAME part
.\"
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,701 @@
From 5f2f3d74b2503e313b7909a3b436071a0757e582 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Fri, 9 Aug 2013 18:32:44 -0700
Subject: [PATCH] ISCSIUIO: Removed the auto-generated COPYING file
The automake generated COPYING file in the iscsiuio folder
unintentionally suggested that the iscsiuio source might be
released as GPL licensed instead of the intended 4-clause BSD
license.
The patch is to remove the COPYING file.
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
iscsiuio/COPYING | 674 -------------------------------------------------------
1 file changed, 674 deletions(-)
delete mode 100644 iscsiuio/COPYING
diff --git a/iscsiuio/COPYING b/iscsiuio/COPYING
deleted file mode 100644
index 94a9ed0..0000000
--- a/iscsiuio/COPYING
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
--
1.8.3.1

View File

@ -1,62 +0,0 @@
From 436ac9074def43ae09d7ecc28eec6cdc77a9d0e2 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Fri, 13 Sep 2013 16:56:51 -0700
Subject: [PATCH 65/65] fix hardened build of iscsiuio
The new iscsiuio code sets CFLAGS in configure.ac, wiping out the
environment setup by rpm. Patch that out.
Also fix local build when iscsi-initiator-utils is installed, but having
the check to prevent overwriting configuration files during install look
in DESTDIR.
---
Makefile | 2 +-
iscsiuio/configure | 2 +-
iscsiuio/configure.ac | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
mode change 100644 => 100755 iscsiuio/configure
diff --git a/Makefile b/Makefile
index 02346bf..172d30e 100644
--- a/Makefile
+++ b/Makefile
@@ -123,7 +123,7 @@ install_iface: $(IFACEFILES)
$(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi/ifaces
install_etc: $(ETCFILES)
- if [ ! -f /etc/iscsi/iscsid.conf ]; then \
+ if [ ! -f $(DESTDIR)$(etcdir)/iscsi/iscsid.conf ]; then \
$(INSTALL) -d $(DESTDIR)$(etcdir)/iscsi ; \
$(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi ; \
fi
diff --git a/iscsiuio/configure b/iscsiuio/configure
old mode 100644
new mode 100755
index 2740598..cd13f92
--- a/iscsiuio/configure
+++ b/iscsiuio/configure
@@ -21288,7 +21288,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-CFLAGS="-O2 -Wall"
+CFLAGS="${CFLAGS} -O2 -Wall"
## check for --enable-debug first before checking CFLAGS before
## so that we don't mix -O and -g
# Check whether --enable-debug or --disable-debug was given.
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac
index e9a5e32..d9a6bdb 100644
--- a/iscsiuio/configure.ac
+++ b/iscsiuio/configure.ac
@@ -52,7 +52,7 @@ AC_LIBTOOL_DLOPEN
# libtool stuff
AC_PROG_LIBTOOL
-CFLAGS="-O2 -Wall"
+CFLAGS="${CFLAGS} -O2 -Wall"
## check for --enable-debug first before checking CFLAGS before
## so that we don't mix -O and -g
AC_ARG_ENABLE(debug,
--
1.8.1.4

View File

@ -0,0 +1,23 @@
From a877c9dc79ef2c759cc96db8ff5de2e5be8087d9 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Fri, 31 Jan 2014 23:28:22 -0600
Subject: [PATCH] iscsiuio: fix compilation
Add missing $(AM_CFLAGS) to lib_iscsi_uip_a_CFLAGS.
---
iscsiuio/src/uip/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/iscsiuio/src/uip/Makefile.am b/iscsiuio/src/uip/Makefile.am
index 65c1286..16170d7 100644
--- a/iscsiuio/src/uip/Makefile.am
+++ b/iscsiuio/src/uip/Makefile.am
@@ -15,4 +15,4 @@ lib_iscsi_uip_a_SOURCES = uip.c \
ipv6_ndpc.c \
ipv6.c
-lib_iscsi_uip_a_CFLAGS = -DBYTE_ORDER=@ENDIAN@
+lib_iscsi_uip_a_CFLAGS = -DBYTE_ORDER=@ENDIAN@ $(AM_CFLAGS)
--
1.8.3.1

View File

@ -0,0 +1,44 @@
From 9ef01a7d13358e96627ae1d263fea5537c4ed6f7 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Wed, 29 Jan 2014 11:21:49 +0100
Subject: [PATCH] Add missing DESTDIR
Several Makefile targets are missing DESTDIR, making it
hard for packagers.
Signed-off-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 88b3529..79bad84 100644
--- a/Makefile
+++ b/Makefile
@@ -124,7 +124,7 @@ install_iface: $(IFACEFILES)
$(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi/ifaces
install_etc: $(ETCFILES)
- if [ ! -f /etc/iscsi/iscsid.conf ]; then \
+ if [ ! -f $(DESTDIR)/etc/iscsi/iscsid.conf ]; then \
$(INSTALL) -d $(DESTDIR)$(etcdir)/iscsi ; \
$(INSTALL) -m 644 $^ $(DESTDIR)$(etcdir)/iscsi ; \
fi
@@ -137,11 +137,11 @@ install_kernel:
$(MAKE) -C kernel install_kernel
install_iname:
- if [ ! -f /etc/iscsi/initiatorname.iscsi ]; then \
+ if [ ! -f $(DESTDIR)/etc/iscsi/initiatorname.iscsi ]; then \
echo "InitiatorName=`$(DESTDIR)/sbin/iscsi-iname`" > $(DESTDIR)/etc/iscsi/initiatorname.iscsi ; \
echo "***************************************************" ; \
echo "Setting InitiatorName to `cat $(DESTDIR)/etc/iscsi/initiatorname.iscsi`" ; \
- echo "To override edit /etc/iscsi/initiatorname.iscsi" ; \
+ echo "To override edit $(DESTDIR)/etc/iscsi/initiatorname.iscsi" ; \
echo "***************************************************" ; \
fi
--
1.8.3.1

View File

@ -0,0 +1,236 @@
From ea05be3ff043efd44256283d968fa1bb9a371568 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Thu, 13 Feb 2014 12:37:09 -0600
Subject: [PATCH] iscsi tools: set non negotiated params early.
This patch has the iscsi tools pass down the non-negotiated
iscsi settings before doing iscsi login. This allows the
drivers to get info that might be neede to setup the session
early.
This patch also adds the missing discovery_sess param to
the non negotiated params.
---
usr/discovery.c | 15 +++++++++--
usr/initiator.c | 22 +++++++++++-----
usr/initiator.h | 1 +
usr/initiator_common.c | 69 ++++++++++++++++++++++++++++++++++++++++++++------
4 files changed, 91 insertions(+), 16 deletions(-)
diff --git a/usr/discovery.c b/usr/discovery.c
index afce6c0..635ec8d 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -1403,6 +1403,17 @@ redirect_reconnect:
iscsi_copy_operational_params(&session->conn[0], &config->session_conf,
&config->conn_conf);
+ if (t->caps & CAP_TEXT_NEGO) {
+ log_debug(2, "%s discovery set params\n", __FUNCTION__);
+ rc = iscsi_session_set_params(conn);
+ if (rc) {
+ log_error("Could not set iscsi params for conn %d:%d "
+ "(err %d)\n", session->id, conn->id, rc);
+ rc = ISCSI_ERR_INTERNAL;
+ goto login_failed;
+ }
+ }
+
if ((session->t->caps & CAP_LOGIN_OFFLOAD))
goto start_conn;
@@ -1509,8 +1520,8 @@ redirect_reconnect:
return 0;
start_conn:
- log_debug(2, "%s discovery set params\n", __FUNCTION__);
- rc = iscsi_session_set_params(conn);
+ log_debug(2, "%s discovery set neg params\n", __FUNCTION__);
+ rc = iscsi_session_set_neg_params(conn);
if (rc) {
log_error("Could not set iscsi params for conn %d:%d (err "
"%d)\n", session->id, conn->id, rc);
diff --git a/usr/initiator.c b/usr/initiator.c
index 79d1779..05a5b19 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1048,12 +1048,7 @@ setup_full_feature_phase(iscsi_conn_t *conn)
actor_delete(&conn->login_timer);
- if (iscsi_session_set_params(conn)) {
- iscsi_login_eh(conn, c->qtask, ISCSI_ERR_LOGIN);
- return;
- }
-
- if (iscsi_host_set_params(session)) {
+ if (iscsi_session_set_neg_params(conn)) {
iscsi_login_eh(conn, c->qtask, ISCSI_ERR_LOGIN);
return;
}
@@ -1507,6 +1502,11 @@ static void setup_offload_login_phase(iscsi_conn_t *conn)
return;
}
+ if (iscsi_session_set_neg_params(conn)) {
+ iscsi_login_eh(conn, c->qtask, ISCSI_ERR_LOGIN);
+ return;
+ }
+
if (iscsi_host_set_params(session)) {
iscsi_login_eh(conn, c->qtask, ISCSI_ERR_LOGIN);
return;
@@ -1618,6 +1618,16 @@ static void session_conn_poll(void *data)
return;
}
+ if (iscsi_session_set_params(conn)) {
+ iscsi_login_eh(conn, qtask, ISCSI_ERR_LOGIN);
+ return;
+ }
+
+ if (iscsi_host_set_params(session)) {
+ iscsi_login_eh(conn, qtask, ISCSI_ERR_LOGIN);
+ return;
+ }
+
if (iscsi_login_begin(session, c)) {
iscsi_login_eh(conn, qtask, ISCSI_ERR_LOGIN);
return;
diff --git a/usr/initiator.h b/usr/initiator.h
index 680640c..c34625b 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -344,6 +344,7 @@ extern void free_initiator(void);
extern void iscsi_initiator_init(void);
/* initiator code common to discovery and normal sessions */
+extern int iscsi_session_set_neg_params(struct iscsi_conn *conn);
extern int iscsi_session_set_params(struct iscsi_conn *conn);
extern int iscsi_host_set_params(struct iscsi_session *session);
extern int iscsi_host_set_net_params(struct iface_rec *iface,
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
index e2e87a1..109e8d7 100644
--- a/usr/initiator_common.c
+++ b/usr/initiator_common.c
@@ -345,9 +345,9 @@ void iscsi_session_init_params(struct iscsi_session *session)
}
}
-#define MAX_SESSION_PARAMS 35
+#define MAX_SESSION_NEG_PARAMS 16
-int iscsi_session_set_params(struct iscsi_conn *conn)
+int iscsi_session_set_neg_params(struct iscsi_conn *conn)
{
struct iscsi_session *session = conn->session;
int i, rc;
@@ -357,7 +357,7 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
int type;
void *value;
int conn_only;
- } conntbl[MAX_SESSION_PARAMS] = {
+ } conntbl[MAX_SESSION_NEG_PARAMS] = {
{
.param = ISCSI_PARAM_MAX_RECV_DLENGTH,
.value = &conn->max_recv_dlength,
@@ -434,15 +434,58 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.type = ISCSI_INT,
.conn_only = 1,
}, {
- .param = ISCSI_PARAM_TARGET_NAME,
- .conn_only = 0,
- .type = ISCSI_STRING,
- .value = session->target_name,
- }, {
.param = ISCSI_PARAM_TPGT,
.value = &session->portal_group_tag,
.type = ISCSI_INT,
.conn_only = 0,
+ },
+ };
+
+ iscsi_session_init_params(session);
+
+ /* Entered full-feature phase! */
+ for (i = 0; i < MAX_SESSION_NEG_PARAMS; i++) {
+ if (conn->id != 0 && !conntbl[i].conn_only)
+ continue;
+
+ if (!(session->param_mask & (1ULL << conntbl[i].param)))
+ continue;
+
+ rc = ipc->set_param(session->t->handle, session->id,
+ conn->id, conntbl[i].param, conntbl[i].value,
+ conntbl[i].type);
+ if (rc && rc != -ENOSYS) {
+ log_error("can't set operational parameter %d for "
+ "connection %d:%d, retcode %d (%d)",
+ conntbl[i].param, session->id, conn->id,
+ rc, errno);
+ return EPERM;
+ }
+
+ print_param_value(conntbl[i].param, conntbl[i].value,
+ conntbl[i].type);
+ }
+
+ return 0;
+}
+
+#define MAX_SESSION_PARAMS 20
+
+int iscsi_session_set_params(struct iscsi_conn *conn)
+{
+ struct iscsi_session *session = conn->session;
+ int i, rc;
+ struct connparam {
+ int param;
+ int type;
+ void *value;
+ int conn_only;
+ } conntbl[MAX_SESSION_PARAMS] = {
+ {
+ .param = ISCSI_PARAM_TARGET_NAME,
+ .conn_only = 0,
+ .type = ISCSI_STRING,
+ .value = session->target_name,
}, {
.param = ISCSI_PARAM_PERSISTENT_ADDRESS,
.value = session->nrec.conn[conn->id].address,
@@ -512,22 +555,32 @@ int iscsi_session_set_params(struct iscsi_conn *conn)
.param = ISCSI_PARAM_IFACE_NAME,
.value = session->nrec.iface.name,
.type = ISCSI_STRING,
+ .conn_only = 0,
}, {
.param = ISCSI_PARAM_INITIATOR_NAME,
.value = session->initiator_name,
.type = ISCSI_STRING,
+ .conn_only = 0,
}, {
.param = ISCSI_PARAM_BOOT_ROOT,
.value = session->nrec.session.boot_root,
.type = ISCSI_STRING,
+ .conn_only = 0,
}, {
.param = ISCSI_PARAM_BOOT_NIC,
.value = session->nrec.session.boot_nic,
.type = ISCSI_STRING,
+ .conn_only = 0,
}, {
.param = ISCSI_PARAM_BOOT_TARGET,
.value = session->nrec.session.boot_target,
.type = ISCSI_STRING,
+ .conn_only = 0,
+ }, {
+ .param = ISCSI_PARAM_DISCOVERY_SESS,
+ .value = &session->type,
+ .type = ISCSI_INT,
+ .conn_only = 0,
},
};
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 8de8ce551cbdb1250b696a5eedc5cff2b68e71e8 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 24 Feb 2014 03:14:17 -0500
Subject: [PATCH] iscsiadm: Fix the hostno check for stats submode of host mode
This fixes the condition where hostno value of 0 was being treated
as invalid.
Signed-off-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/iscsiadm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 3cde8d1..36617ab 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -3470,7 +3470,7 @@ main(int argc, char **argv)
&params);
break;
case MODE_HOST_STATS:
- if (!host_no) {
+ if (host_no > MAX_HOST_NO) {
log_error("STATS mode requires host no");
rc = ISCSI_ERR_INVAL;
break;
--
1.8.3.1

View File

@ -0,0 +1,31 @@
From 0e6cb00eac013c270741ee2bdb9427ccc62ad705 Mon Sep 17 00:00:00 2001
From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Date: Mon, 24 Feb 2014 03:14:18 -0500
Subject: [PATCH] iscsiadm: Fix the compile time warning
This fixes the following compile time warning message:
iscsiadm.c:2248: warning: passing argument 1 of 'print_host_stats' from incompatible pointer type
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
---
usr/iscsiadm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 36617ab..389f4b8 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -2245,7 +2245,8 @@ static int exec_host_stats_op(int op, int info_level, uint32_t host_no)
goto exit_host_stats;
}
- print_host_stats(req_buf + sizeof(struct iscsi_uevent));
+ print_host_stats((struct iscsi_offload_host_stats *)(req_buf +
+ sizeof(struct iscsi_uevent)));
ipc->ctldev_close();
--
1.8.3.1

View File

@ -32,7 +32,7 @@ index cb6ffd1..0410079 100644
static void
idbm_recinfo_discovery(discovery_rec_t *r, recinfo_t *ri)
{
@@ -1884,12 +1887,49 @@ static int idbm_rec_write_old(node_rec_t *rec)
@@ -2082,12 +2085,49 @@ static int idbm_rec_write_old(node_rec_t *rec)
FILE *f;
char *portal;
int rc = 0;

View File

@ -1,4 +1,4 @@
From 38800fb6984ca4c3ad963708c47c1946c33b6d1a Mon Sep 17 00:00:00 2001
From de47306137006436c6bc71a9a60c27287dd1a9e4 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 19 Nov 2012 16:43:15 -0800
Subject: add libiscsi
@ -43,7 +43,7 @@ Subject: add libiscsi
create mode 100644 libiscsi/tests/test_set_auth.c
diff --git a/Makefile b/Makefile
index 0b7bb98..02346bf 100644
index 93dcbbf..5e80db9 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,7 @@ user: utils/open-isns/Makefile iscsiuio/Makefile
@ -131,7 +131,7 @@ index 0000000..317a7ec
+-include .depend ../usr/.depend
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c
new file mode 100644
index 0000000..2a176e8
index 0000000..6e6846a
--- /dev/null
+++ b/libiscsi/libiscsi.c
@@ -0,0 +1,620 @@
@ -3881,10 +3881,10 @@ index afce6c0..0c93749 100644
int discovery_fw(void *data, struct iface_rec *iface,
struct list_head *rec_list)
diff --git a/usr/idbm.c b/usr/idbm.c
index 4bb9810..c84ae69 100644
index 81bce9e..bda31e2 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -1515,9 +1515,9 @@ int idbm_print_all_discovery(int info_level)
@@ -1709,9 +1709,9 @@ int idbm_print_all_discovery(int info_level)
* fn should return -1 if it skipped the rec, a ISCSI_ERR error code if
* the operation failed or 0 if fn was run successfully.
*/
@ -3898,7 +3898,7 @@ index 4bb9810..c84ae69 100644
DIR *iface_dirfd;
struct dirent *iface_dent;
diff --git a/usr/idbm.h b/usr/idbm.h
index 1e9b132..4d08b31 100644
index b89ddff..3631262 100644
--- a/usr/idbm.h
+++ b/usr/idbm.h
@@ -102,6 +102,9 @@ struct rec_op_data {
@ -3912,16 +3912,16 @@ index 1e9b132..4d08b31 100644
idbm_portal_op_fn *fn, char *targetname);
extern int idbm_for_each_node(int *found, void *data,
diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h
index b6665cb..3e7f82a 100644
index 9d26d54..d23754d 100644
--- a/usr/iscsi_ipc.h
+++ b/usr/iscsi_ipc.h
@@ -160,4 +160,6 @@ struct iscsi_ipc {
uint32_t host_no, uint32_t sid);
@@ -165,4 +165,6 @@ struct iscsi_ipc {
char *host_stats);
};
+struct iscsi_ipc *ipc;
+
#endif /* ISCSI_IPC_H */
--
1.8.1.4
1.8.3.1

View File

@ -0,0 +1,42 @@
From 95cc21cf6283ef6faaa1be7c12c9ef58d7891d25 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Fri, 13 Sep 2013 16:56:51 -0700
Subject: [PATCH] fix hardened build of iscsiuio
The new iscsiuio code sets CFLAGS in configure.ac, wiping out the
environment setup by rpm. Patch that out.
---
iscsiuio/configure | 2 +-
iscsiuio/configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/iscsiuio/configure b/iscsiuio/configure
index 444c9c0..50cfd90 100755
--- a/iscsiuio/configure
+++ b/iscsiuio/configure
@@ -22782,7 +22782,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-CFLAGS="-O2 -Wall"
+CFLAGS="${CFLAGS} -O2 -Wall"
## check for --enable-debug first before checking CFLAGS before
## so that we don't mix -O and -g
# Check whether --enable-debug was given.
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac
index 381b94d..e4af3b2 100644
--- a/iscsiuio/configure.ac
+++ b/iscsiuio/configure.ac
@@ -52,7 +52,7 @@ AC_LIBTOOL_DLOPEN
# libtool stuff
AC_PROG_LIBTOOL
-CFLAGS="-O2 -Wall"
+CFLAGS="${CFLAGS} -O2 -Wall"
## check for --enable-debug first before checking CFLAGS before
## so that we don't mix -O and -g
AC_ARG_ENABLE(debug,
--
1.8.3.1

View File

@ -0,0 +1,35 @@
From 1c0f37a8ae48daa3ae1c37cdac7c0789299180eb Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Mon, 24 Feb 2014 09:33:33 -0800
Subject: [PATCH] Revert "iscsiadm: return error when login fails"
This reverts commit fc2a8e9a2911bc76f961fe3e4a159fab9b8b9691.
Done to address RHBZ #1015563
---
usr/session_mgmt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c
index 87b8e00..3815b1d 100644
--- a/usr/session_mgmt.c
+++ b/usr/session_mgmt.c
@@ -178,12 +178,12 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec)
goto done;
}
if (session_count >= rec->session.nr_sessions) {
- log_warning("%s: %d session%s requested, but %d "
+ log_debug(1, "%s: %d session%s requested, but %d "
"already present.",
rec->iface.name, rec->session.nr_sessions,
rec->session.nr_sessions == 1 ? "" : "s",
session_count);
- rc = ISCSI_ERR_SESS_EXISTS;
+ rc = 0;
goto done;
}
--
1.8.3.1

View File

@ -0,0 +1,55 @@
From 83f291bd475f3d11abaf1f7346732f75af585ed8 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 26 Feb 2014 16:33:48 -0800
Subject: update handling of boot sessions
force start iscsiuio if needed, socket activation does not seem to be
working for recovery
---
etc/systemd/iscsi-mark-root-nodes | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes
index 157be62..d106ac6 100644
--- a/etc/systemd/iscsi-mark-root-nodes
+++ b/etc/systemd/iscsi-mark-root-nodes
@@ -1,13 +1,30 @@
#!/bin/bash
ISCSIADM=/sbin/iscsiadm
+start_iscsid=0
+start_iscsiuio=0
-$ISCSIADM -m session >/dev/null 2>&1 || exit 0
+while read t num p target flash; do
+ # strip tag number from portal, keep "ip:port"
+ portal=${p%,*}
+ transport=${t%:}
-$ISCSIADM -m session | while read t num i target; do
- ip=${i%:*}
- $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot
-done
+ $ISCSIADM -m node -p $portal -T $target -o update -n node.startup -v onboot
-systemctl start iscsid.service
+ start_iscsid=1
+
+ if [ "$transport" = bnx2i ]; then
+ start_iscsiuio=1
+ fi
+done < <( $ISCSIADM -m session )
+
+# force iscsid and iscsiuio to start if needed for
+# recovering sessions created in the initrd
+
+if [ "$start_iscsid" -eq 1 ]; then
+ systemctl --no-block start iscsid.service
+fi
+if [ "$start_iscsiuio" -eq 1 ]; then
+ systemctl --no-block start iscsiuio.service
+fi
--
1.8.3.1

View File

@ -0,0 +1,34 @@
From 969e26197c792ec5377d2c261a934a9c907e82f0 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Fri, 14 Mar 2014 09:22:21 -0700
Subject: [PATCH] update iscsi.service for boot session recovery
---
etc/systemd/iscsi.service | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service
index d5712bd..3de76c5 100644
--- a/etc/systemd/iscsi.service
+++ b/etc/systemd/iscsi.service
@@ -5,14 +5,15 @@ DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
Before=remote-fs-pre.target
-ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes
+ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes
+ConditionDirectoryNotEmpty=|/sys/class/iscsi_session
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/libexec/iscsi-mark-root-nodes
+SuccessExitStatus=21
ExecStart=/sbin/iscsiadm -m node --loginall=automatic
-ExecStop=/bin/sync
ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
ExecReload=/sbin/iscsiadm -m node --loginall=automatic
--
1.8.3.1

View File

@ -16,7 +16,7 @@ index a090522..aef0c3d 100644
* some other maintainer could merge a patch without going through us
*/
-#define ISCSI_VERSION_STR "2.0-873"
+#define ISCSI_VERSION_STR "6.2.0.873-17"
+#define ISCSI_VERSION_STR "6.2.0.873-21"
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
#endif

View File

@ -2,6 +2,6 @@
case "$2" in
up|vpn-up)
/bin/systemctl reload iscsi.service || :
/bin/systemctl --no-block reload iscsi.service || :
;;
esac

View File

@ -4,7 +4,7 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 17%{?dist}
Release: 21%{?dist}
Group: System Environment/Daemons
License: GPLv2+
URL: http://www.open-iscsi.org
@ -41,36 +41,80 @@ Patch24: 0024-Fix-discovery-error-return-without-return-value.patch
Patch25: 0025-iscsid-Fix-strlen-parameter.patch
Patch26: 0026-iscsiuio-Change-socket-bind-to-use-the-same-struct-s.patch
Patch27: 0027-Make-rescan-run-in-parallel.patch
Patch28: 0028-iscsiadm-Correctly-check-for-invalid-hostno-and-flas.patch
Patch29: 0029-iscsi-tools-Print-additional-session-info-for-flashn.patch
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
Patch42: 0042-iscsi-tools-Setup-iface-conf-file-with-all-iface-att.patch
Patch43: 0043-iscsi_if.h-Remove-numbers-used-for-network-parameter.patch
Patch44: 0044-iscsi_if.h-Additional-parameters-for-network-param-s.patch
Patch45: 0045-iscsi-tools-Use-macro-to-set-IPv4-IPv6-IP-addresses.patch
Patch46: 0046-iscsi-tools-Use-single-function-to-enable-disable-ne.patch
Patch47: 0047-iscsi-tools-Use-single-function-to-set-integer-netwo.patch
Patch48: 0048-iscsi-tools-Ignore-network-parameter-if-not-enabled-.patch
Patch49: 0049-iscsi-tools-Additional-parameters-for-network-settin.patch
Patch50: 0050-iscsi-tools-iface-params-should-be-updated-for-node_.patch
Patch51: 0051-iscsi-tools-Let-default-type-of-iface-be-ipv4.patch
Patch52: 0052-iscsi-tools-Show-iface-params-based-on-iface-type.patch
Patch53: 0053-iscsiadm-Added-document-for-description-of-iface-att.patch
Patch54: 0054-iscsi_tool-Add-offload-host-statistics-support.patch
Patch55: 0055-README-Updated-for-host-statistics.patch
Patch56: 0056-iscsiadm.8-Updated-man-page-for-host-statistics.patch
Patch57: 0057-iscsi-tools-Fix-the-iscsiadm-help-options-for-host-m.patch
Patch58: 0058-Man-page-correction-for-host-mode-options-of-iscsiad.patch
Patch59: 0059-ISCSIUIO-Added-tx-doorbell-override-mechanism.patch
Patch60: 0060-ISCSIUIO-Added-fix-for-the-iface.subnet_mask-decodin.patch
Patch61: 0061-ISCSIUIO-Added-fix-for-the-ARP-cache-flush-mechanism.patch
Patch62: 0062-ISCSIUIO-Updated-RELEASE-note-and-version.patch
Patch63: 0063-ISCSIUIO-Updated-the-configure-file-to-reflect-the-n.patch
Patch64: 0064-ISCSIUIO-Removed-the-auto-generated-COPYING-file.patch
Patch68: 0068-iscsiuio-fix-compilation.patch
Patch69: 0069-Add-missing-DESTDIR.patch
Patch70: 0070-iscsi-tools-set-non-negotiated-params-early.patch
# not (yet) upstream merged
Patch40: 0040-ISCSISTART-Saved-ibft-boot-info-to-the-session-sysfs.patch
Patch41: 0041-ISCSID-Added-the-extraction-of-the-session-boot-info.patch
Patch42: 0042-ISCSID-Added-iface-content-override-fix.patch
Patch43: 0043-idmb_rec_write-check-for-tpgt-first.patch
Patch45: 0045-idbm_rec_write-seperate-old-and-new-style-writes.patch
Patch46: 0046-idbw_rec_write-pick-tpgt-from-existing-record.patch
Patch47: 0047-iscsiuio-systemd-socket-activation-support.patch
Patch49: 0049-update-systemd-service-files-add-iscsi.service-for-s.patch
Patch50: 0050-iscsi-boot-related-service-file-updates.patch
Patch131: 0131-iscsiadm-Fix-the-hostno-check-for-stats-submode-of-h.patch
Patch132: 0132-iscsiadm-Fix-the-compile-time-warning.patch
Patch143: 0143-idmb_rec_write-check-for-tpgt-first.patch
Patch145: 0145-idbm_rec_write-seperate-old-and-new-style-writes.patch
Patch146: 0146-idbw_rec_write-pick-tpgt-from-existing-record.patch
Patch147: 0147-iscsiuio-systemd-socket-activation-support.patch
Patch149: 0149-update-systemd-service-files-add-iscsi.service-for-s.patch
Patch150: 0150-iscsi-boot-related-service-file-updates.patch
# distro specific modifications
Patch51: 0051-update-initscripts-and-docs.patch
Patch52: 0052-use-var-for-config.patch
Patch53: 0053-use-red-hat-for-name.patch
Patch54: 0054-add-libiscsi.patch
Patch55: 0055-dont-use-static.patch
Patch56: 0056-remove-the-offload-boot-supported-ifdef.patch
Patch59: 0059-iscsiuio-systemd-unit-files.patch
Patch60: 0060-use-systemctl-to-start-iscsid.patch
Patch61: 0061-resolve-565245-multilib-issues-caused-by-doxygen.patch
Patch62: 0062-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch
Patch63: 0063-fix-order-of-setting-uid-gid-and-drop-supplementary-.patch
Patch64: 0064-libiscsi-fix-incorrect-strncpy-use.patch
Patch65: 0065-fix-hardened-build-of-iscsiuio.patch
Patch66: 0066-start-socket-listeners-on-iscsiadm-command.patch
Patch151: 0151-update-initscripts-and-docs.patch
Patch152: 0152-use-var-for-config.patch
Patch153: 0153-use-red-hat-for-name.patch
Patch154: 0154-add-libiscsi.patch
Patch155: 0155-dont-use-static.patch
Patch156: 0156-remove-the-offload-boot-supported-ifdef.patch
Patch159: 0159-iscsiuio-systemd-unit-files.patch
Patch160: 0160-use-systemctl-to-start-iscsid.patch
Patch161: 0161-resolve-565245-multilib-issues-caused-by-doxygen.patch
Patch162: 0162-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch
Patch163: 0163-fix-order-of-setting-uid-gid-and-drop-supplementary-.patch
Patch164: 0164-libiscsi-fix-incorrect-strncpy-use.patch
Patch165: 0165-fix-hardened-build-of-iscsiuio.patch
Patch166: 0166-start-socket-listeners-on-iscsiadm-command.patch
Patch167: 0167-Revert-iscsiadm-return-error-when-login-fails.patch
Patch168: 0168-update-handling-of-boot-sessions.patch
Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch
# version string, needs to be updated with each build
Patch99: 0099-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
BuildRequires: flex bison python-devel doxygen kmod-devel systemd-devel
# For dir ownership
Requires: %{name}-iscsiuio >= %{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
@ -84,6 +128,16 @@ as well as the utility programs used to manage it. iSCSI is a protocol
for distributed disk access using SCSI commands sent over Internet
Protocol networks.
%package iscsiuio
Summary: Userspace configuration daemon required for some iSCSI hardware
Group: System Environment/Daemons
License: BSD
Requires: %{name} = %{version}-%{release}
%description iscsiuio
The iscsiuio configuration daemon provides network configuration help
for some iSCSI offload hardware.
%package devel
Summary: Development files for %{name}
Group: Development/Libraries
@ -123,33 +177,75 @@ developing applications that use %{name}.
%patch25 -p1
%patch26 -p1
%patch27 -p1
# pending upstream merge
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
# distro specific modifications
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
# pending upstream merge
%patch131 -p1
%patch132 -p1
%patch143 -p1
%patch145 -p1
%patch146 -p1
%patch147 -p1
%patch149 -p1
%patch150 -p1
# distro specific modifications
%patch151 -p1
%patch152 -p1
%patch153 -p1
%patch154 -p1
%patch155 -p1
%patch156 -p1
%patch159 -p1
%patch160 -p1
%patch161 -p1
%patch162 -p1
%patch163 -p1
%patch164 -p1
%patch165 -p1
%patch166 -p1
%patch167 -p1
%patch168 -p1
%patch169 -p1
# version string
%patch99 -p1
%patch199 -p1
# change exec_prefix, there's no easy way to override
%{__sed} -i -e 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile
@ -278,18 +374,28 @@ fi
%{_unitdir}/iscsi.service
%{_unitdir}/iscsid.service
%{_unitdir}/iscsid.socket
%{_unitdir}/iscsiuio.service
%{_unitdir}/iscsiuio.socket
%{_libexecdir}/iscsi-mark-root-nodes
%{_sysconfdir}/NetworkManager/dispatcher.d/04-iscsi
%{_tmpfilesdir}/iscsi.conf
%dir %{_sysconfdir}/iscsi
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/iscsi/iscsid.conf
%{_sbindir}/*
%{_sbindir}/iscsi-iname
%{_sbindir}/iscsiadm
%{_sbindir}/iscsid
%{_sbindir}/iscsistart
%{_libdir}/libiscsi.so.0
%{python_sitearch}/libiscsimodule.so
%{_mandir}/man8/*
%{_mandir}/man8/iscsi-iname.8.gz
%{_mandir}/man8/iscsiadm.8.gz
%{_mandir}/man8/iscsid.8.gz
%{_mandir}/man8/iscsistart.8.gz
%files iscsiuio
%{_sbindir}/iscsiuio
%{_unitdir}/iscsiuio.service
%{_unitdir}/iscsiuio.socket
%config(noreplace) %{_sysconfdir}/logrotate.d/iscsiuiolog
%{_mandir}/man8/iscsiuio.8.gz
%files devel
%doc libiscsi/html
@ -297,6 +403,13 @@ fi
%{_includedir}/libiscsi.h
%changelog
* Mon Apr 14 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-21
- boot session handling improvements
- split out iscsiuio into a seperate sub-package
- sync with new upstream additions
- revert change to return code when calling login_portal for sessions
that already exist, as it impacts users scripting around iscsiadm
* Tue Dec 10 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-17
- fix regression in glob use, inappropriate error code escape
- clean up dead node links from discovery when reusing tpgt