diff --git a/0028-iscsiadm-Correctly-check-for-invalid-hostno-and-flas.patch b/0028-iscsiadm-Correctly-check-for-invalid-hostno-and-flas.patch new file mode 100644 index 0000000..5d45dfd --- /dev/null +++ b/0028-iscsiadm-Correctly-check-for-invalid-hostno-and-flas.patch @@ -0,0 +1,213 @@ +From 3256b93ee3025bf76757001ff3d24914c4c4af28 Mon Sep 17 00:00:00 2001 +From: Adheer Chandravanshi +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 +Signed-off-by: Vikas Chaudhary +--- + 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 + #include + #include ++#include + + /* + * using the __be types allows stricter static +-- +1.8.3.1 + diff --git a/0029-iscsi-tools-Print-additional-session-info-for-flashn.patch b/0029-iscsi-tools-Print-additional-session-info-for-flashn.patch new file mode 100644 index 0000000..7fb3fb3 --- /dev/null +++ b/0029-iscsi-tools-Print-additional-session-info-for-flashn.patch @@ -0,0 +1,74 @@ +From 181af9ac81bccbf8e63a755d48babb2e65de1d4e Mon Sep 17 00:00:00 2001 +From: Vikas Chaudhary +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 +Signed-off-by: Adheer Chandravanshi +--- + 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 + diff --git a/0030-iscsi-tools-sync-iscsi_if.h-with-kernel-space.patch b/0030-iscsi-tools-sync-iscsi_if.h-with-kernel-space.patch new file mode 100644 index 0000000..ed21d58 --- /dev/null +++ b/0030-iscsi-tools-sync-iscsi_if.h-with-kernel-space.patch @@ -0,0 +1,369 @@ +From 82c853344888c2d541d6445a08ab31cbcf1c140f Mon Sep 17 00:00:00 2001 +From: Mike Christie +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 +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 + diff --git a/0031-PATCH-v5-1-3-ISCSISTART-Saved-ibft-boot-info-to-the-.patch b/0031-PATCH-v5-1-3-ISCSISTART-Saved-ibft-boot-info-to-the-.patch new file mode 100644 index 0000000..6b15ca3 --- /dev/null +++ b/0031-PATCH-v5-1-3-ISCSISTART-Saved-ibft-boot-info-to-the-.patch @@ -0,0 +1,152 @@ +From 5992173f13550d75659fec1d7e1f6e87895d560a Mon Sep 17 00:00:00 2001 +From: Mike Christie +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//ethernetN/targetN +info +from the boot context to the node_rec. + +Signed-off-by: Eddie Wai +--- + include/fw_context.h | 3 +++ + 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 ++++++++ + 6 files changed, 34 insertions(+), 1 deletion(-) + +diff --git a/include/fw_context.h b/include/fw_context.h +index 1640859..6563d68 100644 +--- a/include/fw_context.h ++++ b/include/fw_context.h +@@ -30,6 +30,9 @@ + + struct boot_context { + struct list_head list; ++ char boot_root[BOOT_NAME_MAXLEN]; ++ char boot_nic[BOOT_NAME_MAXLEN]; ++ char boot_target[BOOT_NAME_MAXLEN]; + + /* target settings */ + int target_port; +diff --git a/include/iscsi_proto.h b/include/iscsi_proto.h +index 1c69feb..56f757b 100644 +--- a/include/iscsi_proto.h ++++ b/include/iscsi_proto.h +@@ -619,6 +619,7 @@ struct iscsi_reject { + #define KEY_MAXLEN 64 + #define VALUE_MAXLEN 255 + #define TARGET_NAME_MAXLEN VALUE_MAXLEN ++#define BOOT_NAME_MAXLEN 256 + + #define ISCSI_DEF_MAX_RECV_SEG_LEN 8192 + #define ISCSI_MIN_MAX_RECV_SEG_LEN 512 +diff --git a/usr/config.h b/usr/config.h +index 998caff..d457bdd 100644 +--- a/usr/config.h ++++ b/usr/config.h +@@ -201,6 +201,9 @@ typedef struct session_rec { + * allowed to be initiated on this record + */ + unsigned char multiple; ++ char boot_root[BOOT_NAME_MAXLEN]; ++ char boot_nic[BOOT_NAME_MAXLEN]; ++ char boot_target[BOOT_NAME_MAXLEN]; + } session_rec_t; + + #define ISCSI_TRANSPORT_NAME_MAXLEN 16 +diff --git a/usr/idbm.c b/usr/idbm.c +index bc06058..1e4f8c8 100644 +--- a/usr/idbm.c ++++ b/usr/idbm.c +@@ -2748,6 +2748,12 @@ struct node_rec *idbm_create_rec_from_boot_context(struct boot_context *context) + strlen((char *)context->chap_password); + rec->session.auth.password_in_length = + strlen((char *)context->chap_password_in); ++ strlcpy(rec->session.boot_root, context->boot_root, ++ sizeof(context->boot_root)); ++ strlcpy(rec->session.boot_nic, context->boot_nic, ++ sizeof(context->boot_nic)); ++ strlcpy(rec->session.boot_target, context->boot_target, ++ sizeof(context->boot_target)); + + iface_setup_from_boot_context(&rec->iface, context); + +diff --git a/usr/initiator_common.c b/usr/initiator_common.c +index 0fb7edc..e2e87a1 100644 +--- a/usr/initiator_common.c ++++ b/usr/initiator_common.c +@@ -345,7 +345,7 @@ void iscsi_session_init_params(struct iscsi_session *session) + } + } + +-#define MAX_SESSION_PARAMS 32 ++#define MAX_SESSION_PARAMS 35 + + 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, ++ }, { ++ .param = ISCSI_PARAM_BOOT_ROOT, ++ .value = session->nrec.session.boot_root, ++ .type = ISCSI_STRING, ++ }, { ++ .param = ISCSI_PARAM_BOOT_NIC, ++ .value = session->nrec.session.boot_nic, ++ .type = ISCSI_STRING, ++ }, { ++ .param = ISCSI_PARAM_BOOT_TARGET, ++ .value = session->nrec.session.boot_target, ++ .type = ISCSI_STRING, + }, + }; + +diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c +index 3997363..2f37b59 100644 +--- a/utils/fwparam_ibft/fwparam_sysfs.c ++++ b/utils/fwparam_ibft/fwparam_sysfs.c +@@ -200,6 +200,9 @@ static int fill_nic_context(char *subsys, char *id, + strlcpy(context->scsi_host_name, subsys, + sizeof(context->scsi_host_name)); + ++ memset(&context->boot_nic, 0, sizeof(context->boot_nic)); ++ snprintf(context->boot_nic, sizeof(context->boot_nic), "%s", id); ++ + sysfs_get_str(id, subsys, "ip-addr", context->ipaddr, + sizeof(context->ipaddr)); + sysfs_get_str(id, subsys, "vlan", context->vlan, +@@ -224,6 +227,8 @@ static void fill_initiator_context(char *subsys, struct boot_context *context) + sizeof(context->initiatorname)); + sysfs_get_str("initiator", subsys, "isid", context->isid, + sizeof(context->isid)); ++ ++ strlcpy(context->boot_root, subsys, sizeof(context->boot_root)); + } + static int fill_tgt_context(char *subsys, char *id, + struct boot_context *context) +@@ -240,6 +245,9 @@ static int fill_tgt_context(char *subsys, char *id, + if (rc) + return rc; + ++ memset(&context->boot_target, 0, sizeof(context->boot_target)); ++ snprintf(context->boot_target, sizeof(context->boot_target), "%s", id); ++ + /* + * 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.3.1 + diff --git a/0032-ISCSID-Added-the-extraction-of-the-session-boot-info.patch b/0032-ISCSID-Added-the-extraction-of-the-session-boot-info.patch new file mode 100644 index 0000000..854127c --- /dev/null +++ b/0032-ISCSID-Added-the-extraction-of-the-session-boot-info.patch @@ -0,0 +1,104 @@ +From 487c312c96379e45648c782cee5b0d469cba80d0 Mon Sep 17 00:00:00 2001 +From: Eddie Wai +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 +->ethernetN net params as specified from the kernel +session boot_nic sysfs entry based on the transport param +use_boot_info. + +This is only populated for iscsi_tcp and bnx2i. + +Signed-off-by: Eddie Wai +--- + usr/iscsi_sysfs.c | 40 ++++++++++++++++++++++++++++++++++++++++ + usr/transport.c | 1 + + usr/transport.h | 1 + + 3 files changed, 42 insertions(+) + +diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c +index aed10a3..56cb90c 100644 +--- a/usr/iscsi_sysfs.c ++++ b/usr/iscsi_sysfs.c +@@ -674,6 +674,43 @@ free_fnode: + return rc; + } + ++static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session) ++{ ++ char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN]; ++ char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN]; ++ ++ /* Extract boot info */ ++ strlcpy(boot_name, "boot_target", sizeof(boot_name)); ++ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, ++ boot_content, BOOT_NAME_MAXLEN)) ++ return -1; ++ strlcpy(boot_name, "boot_nic", sizeof(boot_name)); ++ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic, ++ BOOT_NAME_MAXLEN)) ++ return -1; ++ strlcpy(boot_name, "boot_root", sizeof(boot_name)); ++ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root, ++ BOOT_NAME_MAXLEN)) ++ return -1; ++ ++ /* If all boot_root/boot_target/boot_nic exist, then extract the ++ info from the boot nic */ ++ if (sysfs_get_str(boot_nic, boot_root, "vlan", boot_content, ++ BOOT_NAME_MAXLEN)) ++ log_debug(5, "could not read %s/%s/vlan", boot_root, boot_nic); ++ else ++ iface->vlan_id = atoi(boot_content); ++ ++ if (sysfs_get_str(boot_nic, boot_root, "subnet-mask", ++ iface->subnet_mask, NI_MAXHOST)) ++ log_debug(5, "could not read %s/%s/subnet", boot_root, ++ boot_nic); ++ ++ log_debug(5, "sysfs read boot returns %s/%s/ vlan = %d subnet = %s", ++ boot_root, boot_nic, iface->vlan_id, iface->subnet_mask); ++ return 0; ++} ++ + /* + * Read in iface settings based on host and session values. If + * session is not passed in, then the ifacename will not be set. And +@@ -802,6 +839,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no, + } + } + ++ 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..2f38519 100644 +--- a/usr/transport.c ++++ b/usr/transport.c +@@ -77,6 +77,7 @@ struct iscsi_transport_template cxgb4i = { + struct iscsi_transport_template bnx2i = { + .name = "bnx2i", + .set_host_ip = 1, ++ .use_boot_info = 1, + .ep_connect = ktransport_ep_connect, + .ep_poll = ktransport_ep_poll, + .ep_disconnect = ktransport_ep_disconnect, +diff --git a/usr/transport.h b/usr/transport.h +index 5dcf872..388e4b1 100644 +--- a/usr/transport.h ++++ b/usr/transport.h +@@ -31,6 +31,7 @@ struct iscsi_transport_template { + * the host's ip address. + */ + uint8_t set_host_ip; ++ uint8_t use_boot_info; + int (*ep_connect) (struct iscsi_conn *conn, int non_blocking); + int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms); + void (*ep_disconnect) (struct iscsi_conn *conn); +-- +1.8.3.1 + diff --git a/0033-ISCSID-Added-iface-content-override-fix.patch b/0033-ISCSID-Added-iface-content-override-fix.patch new file mode 100644 index 0000000..1b923ae --- /dev/null +++ b/0033-ISCSID-Added-iface-content-override-fix.patch @@ -0,0 +1,57 @@ +From 3b4b45001b6d8412aad76a55347de42d30d694f7 Mon Sep 17 00:00:00 2001 +From: Eddie Wai +Date: Fri, 23 Aug 2013 14:04:12 -0700 +Subject: [PATCH] ISCSID: Added iface content override fix + +Patch provided by Mike Christie. + +This patch fixes the unconditional overwrite of the iface struct +even when the corresponding iface info from the node config was +found and extracted. + +Signed-off-by: Eddie Wai +--- + usr/iscsid.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/usr/iscsid.c b/usr/iscsid.c +index 8f19220..d1756ef 100644 +--- a/usr/iscsid.c ++++ b/usr/iscsid.c +@@ -111,9 +111,7 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct session_info *info) + strlcpy(rec->name, info->targetname, TARGET_NAME_MAXLEN); + rec->conn[0].port = info->persistent_port; + strlcpy(rec->conn[0].address, info->persistent_address, NI_MAXHOST); +- memcpy(&rec->iface, &info->iface, sizeof(struct iface_rec)); + rec->tpgt = info->tpgt; +- iface_copy(&rec->iface, &info->iface); + + iscsi_sysfs_get_negotiated_session_conf(info->sid, &session_conf); + iscsi_sysfs_get_negotiated_conn_conf(info->sid, &conn_conf); +@@ -238,6 +236,7 @@ static int sync_session(void *data, struct session_info *info) + log_warning("Could not read data from db. Using default and " + "currently negotiated values\n"); + setup_rec_from_negotiated_values(&rec, info); ++ iface_copy(&rec.iface, &info->iface); + } else { + /* + * we have a valid record and iface so lets merge +@@ -251,13 +250,12 @@ static int sync_session(void *data, struct session_info *info) + memset(&sysfsrec, 0, sizeof(node_rec_t)); + setup_rec_from_negotiated_values(&sysfsrec, info); + /* +- * target, portal and iface name values have to be the same ++ * target, portal and iface values have to be the same + * or we would not have found the record, so just copy +- * CHAP and iface settings. ++ * CHAP settings. + */ + memcpy(&rec.session.auth, &sysfsrec.session.auth, + sizeof(struct iscsi_auth_config)); +- memcpy(&rec.iface, &info->iface, sizeof(rec.iface)); + } + + /* multiple drivers could be connected to the same portal */ +-- +1.8.3.1 + diff --git a/0040-ISCSISTART-Saved-ibft-boot-info-to-the-session-sysfs.patch b/0040-ISCSISTART-Saved-ibft-boot-info-to-the-session-sysfs.patch deleted file mode 100644 index f3f3a12..0000000 --- a/0040-ISCSISTART-Saved-ibft-boot-info-to-the-session-sysfs.patch +++ /dev/null @@ -1,164 +0,0 @@ -From 68ef07c23f7c0d1ea6b502c28be1152e77ff1bde Mon Sep 17 00:00:00 2001 -From: Eddie Wai -Date: Fri, 12 Apr 2013 10:41:15 -0700 -Subject: ISCSISTART: Saved ibft boot info to the session sysfs - -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//ethernetN/targetN info -from the boot context to the node_rec. - -Signed-off-by: Eddie Wai ---- - 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(-) - -diff --git a/include/fw_context.h b/include/fw_context.h -index 1640859..6563d68 100644 ---- a/include/fw_context.h -+++ b/include/fw_context.h -@@ -30,6 +30,9 @@ - - struct boot_context { - struct list_head list; -+ char boot_root[BOOT_NAME_MAXLEN]; -+ char boot_nic[BOOT_NAME_MAXLEN]; -+ char boot_target[BOOT_NAME_MAXLEN]; - - /* 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 -+++ b/include/iscsi_proto.h -@@ -619,6 +619,7 @@ struct iscsi_reject { - #define KEY_MAXLEN 64 - #define VALUE_MAXLEN 255 - #define TARGET_NAME_MAXLEN VALUE_MAXLEN -+#define BOOT_NAME_MAXLEN 256 - - #define ISCSI_DEF_MAX_RECV_SEG_LEN 8192 - #define ISCSI_MIN_MAX_RECV_SEG_LEN 512 -diff --git a/usr/config.h b/usr/config.h -index 998caff..d457bdd 100644 ---- a/usr/config.h -+++ b/usr/config.h -@@ -201,6 +201,9 @@ typedef struct session_rec { - * allowed to be initiated on this record - */ - unsigned char multiple; -+ char boot_root[BOOT_NAME_MAXLEN]; -+ char boot_nic[BOOT_NAME_MAXLEN]; -+ char boot_target[BOOT_NAME_MAXLEN]; - } session_rec_t; - - #define ISCSI_TRANSPORT_NAME_MAXLEN 16 -diff --git a/usr/idbm.c b/usr/idbm.c -index bc06058..1e4f8c8 100644 ---- a/usr/idbm.c -+++ b/usr/idbm.c -@@ -2748,6 +2748,12 @@ struct node_rec *idbm_create_rec_from_boot_context(struct boot_context *context) - strlen((char *)context->chap_password); - rec->session.auth.password_in_length = - strlen((char *)context->chap_password_in); -+ strlcpy(rec->session.boot_root, context->boot_root, -+ sizeof(context->boot_root)); -+ strlcpy(rec->session.boot_nic, context->boot_nic, -+ sizeof(context->boot_nic)); -+ strlcpy(rec->session.boot_target, context->boot_target, -+ sizeof(context->boot_target)); - - iface_setup_from_boot_context(&rec->iface, context); - -diff --git a/usr/initiator_common.c b/usr/initiator_common.c -index eb72795..544d637 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; - } - --#define MAX_SESSION_PARAMS 32 -+#define MAX_SESSION_PARAMS 35 - - int iscsi_session_set_params(struct iscsi_conn *conn) - { -@@ -496,6 +496,18 @@ int iscsi_session_set_params(struct iscsi_conn *conn) - .param = ISCSI_PARAM_INITIATOR_NAME, - .value = session->initiator_name, - .type = ISCSI_STRING, -+ }, { -+ .param = ISCSI_PARAM_BOOT_ROOT, -+ .value = session->nrec.session.boot_root, -+ .type = ISCSI_STRING, -+ }, { -+ .param = ISCSI_PARAM_BOOT_NIC, -+ .value = session->nrec.session.boot_nic, -+ .type = ISCSI_STRING, -+ }, { -+ .param = ISCSI_PARAM_BOOT_TARGET, -+ .value = session->nrec.session.boot_target, -+ .type = ISCSI_STRING, - }, - }; - -diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c -index 3997363..2f37b59 100644 ---- a/utils/fwparam_ibft/fwparam_sysfs.c -+++ b/utils/fwparam_ibft/fwparam_sysfs.c -@@ -200,6 +200,9 @@ static int fill_nic_context(char *subsys, char *id, - strlcpy(context->scsi_host_name, subsys, - sizeof(context->scsi_host_name)); - -+ memset(&context->boot_nic, 0, sizeof(context->boot_nic)); -+ snprintf(context->boot_nic, sizeof(context->boot_nic), "%s", id); -+ - sysfs_get_str(id, subsys, "ip-addr", context->ipaddr, - sizeof(context->ipaddr)); - sysfs_get_str(id, subsys, "vlan", context->vlan, -@@ -224,6 +227,8 @@ static void fill_initiator_context(char *subsys, struct boot_context *context) - sizeof(context->initiatorname)); - sysfs_get_str("initiator", subsys, "isid", context->isid, - sizeof(context->isid)); -+ -+ strlcpy(context->boot_root, subsys, sizeof(context->boot_root)); - } - static int fill_tgt_context(char *subsys, char *id, - struct boot_context *context) -@@ -240,6 +245,9 @@ static int fill_tgt_context(char *subsys, char *id, - if (rc) - return rc; - -+ memset(&context->boot_target, 0, sizeof(context->boot_target)); -+ snprintf(context->boot_target, sizeof(context->boot_target), "%s", id); -+ - /* - * 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 - diff --git a/0041-ISCSID-Added-the-extraction-of-the-session-boot-info.patch b/0041-ISCSID-Added-the-extraction-of-the-session-boot-info.patch deleted file mode 100644 index 67901d6..0000000 --- a/0041-ISCSID-Added-the-extraction-of-the-session-boot-info.patch +++ /dev/null @@ -1,112 +0,0 @@ -From d86ca42685620ad3263da098923308a3a00ac55a Mon Sep 17 00:00:00 2001 -From: Eddie Wai -Date: Fri, 12 Apr 2013 10:41:16 -0700 -Subject: ISCSID: Added the extraction of the session boot info - -This patch does the work to extract the corresponding -->ethernetN net params as specified from the kernel -session boot_nic sysfs entry based on the transport param -use_boot_info. - -This is only populated for iscsi_tcp and bnx2i. - -Signed-off-by: Eddie Wai ---- - usr/iscsi_sysfs.c | 40 ++++++++++++++++++++++++++++++++++++++++ - usr/transport.c | 2 ++ - usr/transport.h | 1 + - 3 files changed, 43 insertions(+) - -diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c -index aed10a3..79ec79d 100644 ---- a/usr/iscsi_sysfs.c -+++ b/usr/iscsi_sysfs.c -@@ -674,6 +674,43 @@ free_fnode: - return rc; - } - -+static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session) -+{ -+ char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN]; -+ char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN]; -+ -+ /* Extract boot info */ -+ strlcpy(boot_name, "boot_target", sizeof(boot_name)); -+ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, -+ boot_content, BOOT_NAME_MAXLEN)) -+ return -1; -+ strlcpy(boot_name, "boot_nic", sizeof(boot_name)); -+ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic, -+ BOOT_NAME_MAXLEN)) -+ return -1; -+ strlcpy(boot_name, "boot_root", sizeof(boot_name)); -+ if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root, -+ BOOT_NAME_MAXLEN)) -+ return -1; -+ -+ /* If all boot_root/boot_target/boot_nic exist, then extract the -+ info from the boot nic */ -+ if (sysfs_get_str(boot_nic, boot_root, "vlan", boot_content, -+ BOOT_NAME_MAXLEN)) -+ log_debug(5, "could not read %s/%s/vlan", boot_root, boot_nic); -+ else -+ iface->vlan_id = atoi(boot_content); -+ -+ if (sysfs_get_str(boot_nic, boot_root, "subnet-mask", -+ iface->subnet_mask, NI_MAXHOST)) -+ log_debug(5, "could not read %s/%s/subnet", boot_root, -+ boot_nic); -+ -+ log_debug(5, "sysfs read boot returns %s/%s/ vlan = %d subnet = %s", -+ boot_root, boot_nic, iface->vlan_id, iface->subnet_mask); -+ return 0; -+} -+ - /* - * Read in iface settings based on host and session values. If - * session is not passed in, then the ifacename will not be set. And -@@ -802,6 +839,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, int host_no, - } - } - -+ if (t->template->use_boot_info && session) -+ 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 ---- 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 = { - struct iscsi_transport_template bnx2i = { - .name = "bnx2i", - .set_host_ip = 1, -+ .use_boot_info = 1, - .ep_connect = ktransport_ep_connect, - .ep_poll = ktransport_ep_poll, - .ep_disconnect = ktransport_ep_disconnect, -diff --git a/usr/transport.h b/usr/transport.h -index 5dcf872..388e4b1 100644 ---- a/usr/transport.h -+++ b/usr/transport.h -@@ -31,6 +31,7 @@ struct iscsi_transport_template { - * the host's ip address. - */ - uint8_t set_host_ip; -+ uint8_t use_boot_info; - int (*ep_connect) (struct iscsi_conn *conn, int non_blocking); - int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms); - void (*ep_disconnect) (struct iscsi_conn *conn); --- -1.8.1.4 - diff --git a/0042-ISCSID-Added-iface-content-override-fix.patch b/0042-ISCSID-Added-iface-content-override-fix.patch deleted file mode 100644 index d41fa70..0000000 --- a/0042-ISCSID-Added-iface-content-override-fix.patch +++ /dev/null @@ -1,57 +0,0 @@ -From ec7d79ed691619b6ffa8c25f162ce62e1e25e6c1 Mon Sep 17 00:00:00 2001 -From: Eddie Wai -Date: Fri, 12 Apr 2013 10:41:17 -0700 -Subject: ISCSID: Added iface content override fix - -Patch provided by Mike Christie. - -This patch fixes the unconditional overwrite of the iface struct -even when the corresponding iface info from the node config was -found and extracted. - -Signed-off-by: Eddie Wai ---- - usr/iscsid.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/usr/iscsid.c b/usr/iscsid.c -index 8f19220..d1756ef 100644 ---- a/usr/iscsid.c -+++ b/usr/iscsid.c -@@ -111,9 +111,7 @@ setup_rec_from_negotiated_values(node_rec_t *rec, struct session_info *info) - strlcpy(rec->name, info->targetname, TARGET_NAME_MAXLEN); - rec->conn[0].port = info->persistent_port; - strlcpy(rec->conn[0].address, info->persistent_address, NI_MAXHOST); -- memcpy(&rec->iface, &info->iface, sizeof(struct iface_rec)); - rec->tpgt = info->tpgt; -- iface_copy(&rec->iface, &info->iface); - - iscsi_sysfs_get_negotiated_session_conf(info->sid, &session_conf); - iscsi_sysfs_get_negotiated_conn_conf(info->sid, &conn_conf); -@@ -238,6 +236,7 @@ static int sync_session(void *data, struct session_info *info) - log_warning("Could not read data from db. Using default and " - "currently negotiated values\n"); - setup_rec_from_negotiated_values(&rec, info); -+ iface_copy(&rec.iface, &info->iface); - } else { - /* - * we have a valid record and iface so lets merge -@@ -251,13 +250,12 @@ static int sync_session(void *data, struct session_info *info) - memset(&sysfsrec, 0, sizeof(node_rec_t)); - setup_rec_from_negotiated_values(&sysfsrec, info); - /* -- * target, portal and iface name values have to be the same -+ * target, portal and iface values have to be the same - * or we would not have found the record, so just copy -- * CHAP and iface settings. -+ * CHAP settings. - */ - memcpy(&rec.session.auth, &sysfsrec.session.auth, - sizeof(struct iscsi_auth_config)); -- memcpy(&rec.iface, &info->iface, sizeof(rec.iface)); - } - - /* multiple drivers could be connected to the same portal */ --- -1.8.1.4 - diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec index b6cf7b3..78359b6 100644 --- a/iscsi-initiator-utils.spec +++ b/iscsi-initiator-utils.spec @@ -4,7 +4,7 @@ Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils Version: 6.%{open_iscsi_version}.%{open_iscsi_build} -Release: 18%{?dist} +Release: 19%{?dist} Group: System Environment/Daemons License: GPLv2+ URL: http://www.open-iscsi.org @@ -41,10 +41,13 @@ 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 # 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 @@ -123,10 +126,13 @@ developing applications that use %{name}. %patch25 -p1 %patch26 -p1 %patch27 -p1 +%patch28 -p1 +%patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 # pending upstream merge -%patch40 -p1 -%patch41 -p1 -%patch42 -p1 %patch43 -p1 %patch45 -p1 %patch46 -p1 @@ -297,6 +303,11 @@ fi %{_includedir}/libiscsi.h %changelog +* Mon Feb 17 2014 Chris Leech - 6.2.0.873-19 +- 1007388 fixes for iscsiadm to support qla4xxx +- refresh boot session info patches to final version from upstream, + fixes context issues with later patches + * Fri Jan 24 2014 Daniel Mach - 6.2.0.873-18 - Mass rebuild 2014-01-24