From 7a5dd7ef29360c5398941c59b3813a3f2bfd92da Mon Sep 17 00:00:00 2001 From: Sebastian Vater Date: Fri, 22 Aug 2025 17:10:40 +0200 Subject: Implemented missing actual reading payload data PDU. Finally fixed most bugs encoutered during test phase for login. --- src/server/iscsi.c | 103 +++++++++++++++++++++++++++++++++++++++-------------- src/server/iscsi.h | 86 ++++++++++++++++++++++---------------------- 2 files changed, 120 insertions(+), 69 deletions(-) diff --git a/src/server/iscsi.c b/src/server/iscsi.c index d7b13cb..cc97164 100644 --- a/src/server/iscsi.c +++ b/src/server/iscsi.c @@ -817,7 +817,7 @@ int iscsi_hashmap_put(iscsi_hashmap *map, uint8_t *key, const size_t key_size, u entry->value = value; - return 0; + return 0L; } /** @@ -872,12 +872,12 @@ int iscsi_hashmap_get_put(iscsi_hashmap *map, uint8_t *key, const size_t key_siz entry->key_size = key_size; entry->hash = hash; - return 0; + return 0L; } *out_in_value = entry->value; - return 1; + return 1L; } /** @@ -940,7 +940,7 @@ int iscsi_hashmap_put_free(iscsi_hashmap *map, uint8_t *key, const size_t key_si entry->hash = hash; entry->value = value; - return 0; + return 0L; } int err = callback( entry->key, key_size, entry->value, user_data ); @@ -964,8 +964,8 @@ int iscsi_hashmap_put_free(iscsi_hashmap *map, uint8_t *key, const size_t key_si * @param[in] key_size Number of bytes for the key, MUST * be a multiple of 8 bytes which is NOT checked, so * be careful. - * @retval TRUE The key exists. - * @retval FALSE The key does not exist. + * @retval true The key exists. + * @retval false The key does not exist. */ int iscsi_hashmap_contains(iscsi_hashmap *map, const uint8_t *key, const size_t key_size) { @@ -993,9 +993,9 @@ int iscsi_hashmap_contains(iscsi_hashmap *map, const uint8_t *key, const size_t * is stored, maybe NULL if either the key's value is NULL or * in case the key was not found. The pointer to the value itself * may NOT be NULL, so be careful. - * @retval TRUE The key has been found and its value stored + * @retval 0 The key has been found and its value stored * in the 'out_value' parameter. - * @retval FALSE The key has not been found and NULL has been + * @retval -1 The key has not been found and NULL has been * stored in the 'out_value' parameter. */ int iscsi_hashmap_get(iscsi_hashmap *map, const uint8_t *key, const size_t key_size, uint8_t **out_value) @@ -1005,7 +1005,7 @@ int iscsi_hashmap_get(iscsi_hashmap *map, const uint8_t *key, const size_t key_s *out_value = entry->value; - return entry->key != NULL; + return (entry->key != NULL) ? 0L : -1L; } /** @@ -1388,8 +1388,8 @@ iscsi_bhs_packet *iscsi_append_ds_packet(iscsi_bhs_packet *packet_data, const in return packet_data; } - const uint32_t old_pkt_size = (const uint32_t) sizeof(struct iscsi_bhs_packet) + ((uint32_t) packet_data->total_ahs_len << 2UL); - const uint32_t new_pkt_size = (uint32_t) (old_pkt_size + header_digest_size + iscsi_align(ds_len, ISCSI_ALIGN_SIZE) + data_digest_size); + const uint32_t old_pkt_size = (const uint32_t) sizeof(struct iscsi_bhs_packet) + ((uint32_t) packet_data->total_ahs_len << 2UL) + header_digest_size; + const uint32_t new_pkt_size = (uint32_t) (old_pkt_size + iscsi_align(ds_len, ISCSI_ALIGN_SIZE) + data_digest_size); packet_data = (iscsi_bhs_packet *) realloc( packet_data, new_pkt_size ); @@ -1489,7 +1489,7 @@ void iscsi_calc_header_digest(const iscsi_bhs_packet *packet_data) * according to iSCSI specs. This function cannot fail. * * @param[in] packet_data Pointer to ISCSI BHS packet to validate CRC32C for. - * @return True if CRC32C matches the stored value, false otherwise. + * @return true if CRC32C matches the stored value, false otherwise. */ int iscsi_validate_header_digest(const iscsi_bhs_packet *packet_data) { @@ -1535,7 +1535,7 @@ void iscsi_calc_data_digest(const iscsi_bhs_packet *packet_data, const int heade * @param[in] header_digest_size Length of optional header digest (0 or 4 for now) in * order to calculate correct DataSegment index. The header digest size IS NOT checked * for conforming to iSCSI specs, so be careful. - * @return True if CRC32C matches the stored value, false otherwise. + * @return true if CRC32C matches the stored value, false otherwise. */ int iscsi_validate_data_digest(const iscsi_bhs_packet *packet_data, const int header_digest_size) { @@ -1998,7 +1998,7 @@ static int iscsi_parse_text_key_value_pair(iscsi_hashmap *pairs, const uint8_t * * data amd puts the extracted data into a hash map to be used by * the iSCSI implementation. * - * @param[in] pairs Pointer to hash map that should contain all + * @param[in] key_value_pairs Pointer to hash map that should contain all * extracted keys and pairs. May NOT be NULL, so take caution. * @param[in] packet_data Pointer to first key and value pair to * be parsed. NULL is an illegal value here, so be careful. @@ -2010,7 +2010,7 @@ static int iscsi_parse_text_key_value_pair(iscsi_hashmap *pairs, const uint8_t * * @retval 0 Key and value pair was parsed successfully and was added to * hash map. */ -int iscsi_parse_key_value_pairs(iscsi_hashmap *pairs, const uint8_t *packet_data, uint len, int c_bit, uint8_t **partial_pairs) +int iscsi_parse_key_value_pairs(iscsi_hashmap *key_value_pairs, const uint8_t *packet_data, uint len, int c_bit, uint8_t **partial_pairs) { if ( len == 0 ) return 0L; // iSCSI specs don't allow zero length @@ -2026,7 +2026,7 @@ int iscsi_parse_key_value_pairs(iscsi_hashmap *pairs, const uint8_t *packet_data if ( tmp_partial_buf == NULL ) return -1L; - const int rc = iscsi_parse_text_key_value_pair( pairs, tmp_partial_buf, (uint32_t) (key_val_pair_len + strlen( (char *) *partial_pairs )) ); + const int rc = iscsi_parse_text_key_value_pair( key_value_pairs, tmp_partial_buf, (uint32_t) (key_val_pair_len + strlen( (char *) *partial_pairs )) ); free( tmp_partial_buf ); if ( rc < 0 ) @@ -2073,7 +2073,7 @@ int iscsi_parse_key_value_pairs(iscsi_hashmap *pairs, const uint8_t *packet_data int offset = 0L; while ( ((uint) offset < len) && (packet_data[offset] != '\0') ) { - const int rc = iscsi_parse_text_key_value_pair( pairs, (packet_data + offset), (len - offset) ); + const int rc = iscsi_parse_text_key_value_pair( key_value_pairs, (packet_data + offset), (len - offset) ); if ( rc < 0 ) return -1L; @@ -5701,7 +5701,7 @@ static int iscsi_connection_pdu_header_handle_snack_req(iscsi_connection *conn, static int iscsi_connection_pdu_header_handle(iscsi_connection *conn, iscsi_pdu *pdu) { if ( pdu == NULL ) - return -1L; + return ISCSI_CONNECT_PDU_READ_ERR_FATAL; const int opcode = ISCSI_GET_OPCODE(pdu->bhs_pkt->opcode); @@ -6505,7 +6505,7 @@ static int iscsi_connection_pdu_data_handle_login_req(iscsi_connection *conn, is iscsi_pdu *login_response_pdu = (iscsi_pdu *) conn->login_response_pdu; if ( login_response_pdu == NULL ) - return 0L; + return ISCSI_CONNECT_PDU_READ_OK; iscsi_hashmap *key_value_pairs = iscsi_hashmap_create( 32UL ); @@ -6519,7 +6519,7 @@ static int iscsi_connection_pdu_data_handle_login_req(iscsi_connection *conn, is if ( rc < 0 ) { iscsi_connection_pdu_login_response( conn, login_response_pdu, NULL, iscsi_connection_pdu_login_err_complete ); - return 0L; + return ISCSI_CONNECT_PDU_READ_OK; } if ( conn->state == ISCSI_CONNECT_STATE_INVALID ) { @@ -6528,7 +6528,7 @@ static int iscsi_connection_pdu_data_handle_login_req(iscsi_connection *conn, is if ( (rc == ISCSI_CONNECT_PDU_READ_ERR_LOGIN_RESPONSE) || (rc == ISCSI_CONNECT_PDU_READ_ERR_LOGIN_PARAMETER) ) { iscsi_connection_pdu_login_response( conn, login_response_pdu, key_value_pairs, iscsi_connection_pdu_login_err_complete ); - return 0L; + return ISCSI_CONNECT_PDU_READ_OK; } } @@ -6537,14 +6537,14 @@ static int iscsi_connection_pdu_data_handle_login_req(iscsi_connection *conn, is if ( rc == ISCSI_CONNECT_PDU_READ_ERR_LOGIN_RESPONSE ) { iscsi_connection_pdu_login_response( conn, login_response_pdu, key_value_pairs, iscsi_connection_pdu_login_err_complete ); - return 0L; + return ISCSI_CONNECT_PDU_READ_OK; } conn->state = ISCSI_CONNECT_STATE_RUNNING; iscsi_connection_pdu_login_response( conn, login_response_pdu, key_value_pairs, iscsi_connection_pdu_login_ok_complete ); - return 0L; + return ISCSI_CONNECT_PDU_READ_OK; } /** @@ -6853,9 +6853,56 @@ static int iscsi_connection_pdu_data_handle(iscsi_connection *conn, iscsi_pdu *p */ int iscsi_connection_pdu_data_read(iscsi_connection *conn, iscsi_pdu *pdu) { - // TODO: Implement DS read. + const uint32_t ds_len = pdu->ds_len; + uint8_t *buf = (uint8_t *) pdu->ds_cmd_data; - return 0; + if ( buf == NULL ) { + buf = (uint8_t *) iscsi_append_ds_packet( (iscsi_bhs_packet *) pdu->bhs_pkt, conn->header_digest, ds_len, conn->data_digest ); + + if ( buf == NULL ) + return ISCSI_CONNECT_PDU_READ_ERR_FATAL; + + pdu->bhs_pkt = (iscsi_bhs_packet *) buf; + pdu->ahs_pkt = (iscsi_ahs_packet *) (((iscsi_bhs_packet *) pdu->bhs_pkt) + 1); + pdu->header_digest = (iscsi_header_digest *) (((uint8_t *) pdu->bhs_pkt) + sizeof(struct iscsi_bhs_packet) + pdu->ahs_len); + pdu->ds_cmd_data = (iscsi_ds_cmd_data *) (((uint8_t *) pdu->bhs_pkt) + sizeof(struct iscsi_bhs_packet) + pdu->ahs_len + conn->header_digest); + + if ( conn->data_digest != 0 ) + pdu->data_digest = (iscsi_data_digest *) (((uint8_t *) pdu->bhs_pkt) + sizeof(struct iscsi_bhs_packet) + pdu->ahs_len + conn->header_digest + ds_len); + + pdu->data_digest_size = conn->data_digest; + } + + if ( pdu->pos < ds_len ) { + const int len = iscsi_connection_read( conn, (((uint8_t *) pdu->ds_cmd_data) + pdu->pos), (pdu->ds_len - pdu->pos) ); + + if ( len < 0 ) + return len; + + pdu->pos += len; + } + + if ( pdu->pos < ds_len ) + return ISCSI_CONNECT_PDU_READ_PROCESSED; + + if ( conn->data_digest != 0 ) { + if ( pdu->data_digest_read_len < (uint) conn->data_digest ) { + const int len = iscsi_connection_read( conn, (((uint8_t *) pdu->data_digest) + pdu->data_digest_read_len), (conn->data_digest - pdu->data_digest_read_len) ); + + if ( len < 0 ) + return len; + + pdu->data_digest_read_len += len; + + if ( pdu->data_digest_read_len < (uint) conn->data_digest ) + return ISCSI_CONNECT_PDU_READ_OK; + } + + if ( iscsi_validate_data_digest( pdu->bhs_pkt, conn->data_digest ) == 0 ) + return ISCSI_CONNECT_PDU_READ_ERR_FATAL; + } + + return ISCSI_CONNECT_PDU_READ_OK; } /** @@ -6916,8 +6963,9 @@ static int iscsi_connection_pdu_read(iscsi_connection *conn) break; } + pdu->ds_len = iscsi_get_be24(pdu->bhs_pkt->ds_len); pdu->ds_len = iscsi_align(pdu->ds_len, ISCSI_ALIGN_SIZE); - pdu->pos = pdu->ds_len; + pdu->pos = 0UL; const uint ahs_len = (uint) pdu->bhs_pkt->total_ahs_len << 2UL; @@ -6928,6 +6976,7 @@ static int iscsi_connection_pdu_read(iscsi_connection *conn) if ( pdu->ahs_pkt == NULL ) return ISCSI_CONNECT_PDU_READ_ERR_FATAL; + pdu->bhs_pkt = (iscsi_bhs_packet *) pdu->ahs_pkt; pdu->ahs_pkt = (iscsi_ahs_packet *) (((iscsi_bhs_packet *) pdu->bhs_pkt) + 1); } @@ -6952,6 +7001,8 @@ static int iscsi_connection_pdu_read(iscsi_connection *conn) if ( pdu->header_digest == NULL ) return ISCSI_CONNECT_PDU_READ_ERR_FATAL; + pdu->bhs_pkt = (iscsi_bhs_packet *) pdu->header_digest; + pdu->ahs_pkt = (iscsi_ahs_packet *) (((iscsi_bhs_packet *) pdu->bhs_pkt) + 1); pdu->header_digest = (iscsi_header_digest *) (((uint8_t *) pdu->bhs_pkt) + sizeof(struct iscsi_bhs_packet) + ahs_len); } diff --git a/src/server/iscsi.h b/src/server/iscsi.h index 1074881..29b89aa 100644 --- a/src/server/iscsi.h +++ b/src/server/iscsi.h @@ -2539,7 +2539,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * SessionType key is thus going to be offered as "Discovery", it SHOULD * be offered in the initial Login Request by the initiator. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_SESSION_TYPE "SessionType" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_SESSION_TYPE "SessionType\0\0\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Initiator name. @@ -2560,7 +2560,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * itself to the remote endpoint.\n * The InitiatorName MUST NOT be redeclared within the Login Phase. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_INITIATOR_NAME "InitiatorName" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_INITIATOR_NAME "InitiatorName\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Target name. @@ -2584,7 +2584,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * Request (which is its only use when issued by a target).\n * The TargetName MUST NOT be redeclared within the Login Phase. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_TARGET_NAME "TargetName" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_TARGET_NAME "TargetName\0\0\0\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Target address. @@ -2614,7 +2614,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * The formats for the port and portal-group-tag are the same as the one * specified in TargetPortalGroupTag. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_TARGET_ADDRESS "TargetAddress" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_TARGET_ADDRESS "TargetAddress\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Initiator alias. @@ -2637,7 +2637,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * the target's user interface in a list of initiators to which it is * connected. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_INITIATOR_ALIAS "InitiatorAlias" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_INITIATOR_ALIAS "InitiatorAlias\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Target alias. @@ -2659,7 +2659,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * authorization decisions. It can be displayed by the initiator's user * interface in a list of targets to which it is connected. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_TARGET_ALIAS "TargetAlias" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_TARGET_ALIAS "TargetAlias\0\0\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Target portal group tag. @@ -2684,7 +2684,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * legal value for the TPGT. This discrepancy currently stands * corrected in SAM4. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_TARGET_PORTAL_GROUP_TAG "TargetPortalGroupTag" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_TARGET_PORTAL_GROUP_TAG "TargetPortalGroupTag\0\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Authentication method. @@ -2746,7 +2746,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * Support for public or private extension authentication methods is * OPTIONAL. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD "AuthMethod" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD "AuthMethod\0\0\0\0\0" /** @@ -2778,7 +2778,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * encoded form) MUST NOT exceed 65536 bytes. Hex or Base64 encoding * may be used for KRB_AP_REQ and KRB_AP_REP. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_KRB_AP_REQ "KRB_AP_REQ" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_KRB_AP_REQ "KRB_AP_REQ\0\0\0\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Kerberos V5 (KRB5): KRB_AP_REP. @@ -2809,7 +2809,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * encoded form) MUST NOT exceed 65536 bytes. Hex or Base64 encoding * may be used for KRB_AP_REQ and KRB_AP_REP. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_KRB_AP_REP "KRB_AP_REP" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_KRB_AP_REP "KRB_AP_REP\0\0\0\0\0" /** @@ -2863,7 +2863,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * supported by initiators and targets. To guarantee interoperability, * targets MUST always offer "SRP-1536" as one of the proposed groups. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_U "SRP_U" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_U "SRP_U\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Secure Remote Password (SRP): SRP_GROUP. @@ -2916,7 +2916,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * supported by initiators and targets. To guarantee interoperability, * targets MUST always offer "SRP-1536" as one of the proposed groups. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_GROUP "SRP_GROUP" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_GROUP "SRP_GROUP\0\0\0\0\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Secure Remote Password (SRP): SRP_A. @@ -2969,7 +2969,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * supported by initiators and targets. To guarantee interoperability, * targets MUST always offer "SRP-1536" as one of the proposed groups. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_A "SRP_A" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_A "SRP_A\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Secure Remote Password (SRP): SRP_B. @@ -3022,7 +3022,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * supported by initiators and targets. To guarantee interoperability, * targets MUST always offer "SRP-1536" as one of the proposed groups. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_B "SRP_B" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_B "SRP_B\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Secure Remote Password (SRP): SRP_M. @@ -3075,7 +3075,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * supported by initiators and targets. To guarantee interoperability, * targets MUST always offer "SRP-1536" as one of the proposed groups. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_M "SRP_M" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_M "SRP_M\0\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Secure Remote Password (SRP): SRP_HM. @@ -3128,7 +3128,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * supported by initiators and targets. To guarantee interoperability, * targets MUST always offer "SRP-1536" as one of the proposed groups. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_HM "SRP_HM" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_SRP_SRP_HM "SRP_HM\0" /** @@ -3185,7 +3185,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * To guarantee interoperability, initiators MUST always offer it as one * of the proposed algorithms. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_A "CHAP_A" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_A "CHAP_A\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Challenge Handshake Authentication Protocol (CHAP): CHAP_I. @@ -3241,7 +3241,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * To guarantee interoperability, initiators MUST always offer it as one * of the proposed algorithms. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_I "CHAP_I" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_I "CHAP_I\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Challenge Handshake Authentication Protocol (CHAP): CHAP_C. @@ -3297,7 +3297,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * To guarantee interoperability, initiators MUST always offer it as one * of the proposed algorithms. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_C "CHAP_C" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_C "CHAP_C\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Challenge Handshake Authentication Protocol (CHAP): CHAP_N. @@ -3353,7 +3353,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * To guarantee interoperability, initiators MUST always offer it as one * of the proposed algorithms. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_N "CHAP_N" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_N "CHAP_N\0" /** * @brief Key used during SecurityNegotiation stage of Login Phase: Challenge Handshake Authentication Protocol (CHAP): CHAP_R. @@ -3409,7 +3409,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * To guarantee interoperability, initiators MUST always offer it as one * of the proposed algorithms. */ -#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_R "CHAP_R" +#define ISCSI_LOGIN_AUTH_SECURITY_TEXT_KEY_AUTH_METHOD_CHAP_CHAP_R "CHAP_R\0" /* Login/Text Operational Text Keys @@ -3527,7 +3527,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * standard-label specified.\n * Support for public or private extension digests is OPTIONAL. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_HEADER_DIGEST "HeaderDigest" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_HEADER_DIGEST "HeaderDigest\0\0\0" /** * @brief Login/Text Operational Session Text Key: Data digest. @@ -3609,7 +3609,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * standard-label specified.\n * Support for public or private extension digests is OPTIONAL. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DATA_DIGEST "DataDigest" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DATA_DIGEST "DataDigest\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: New connections. @@ -3626,7 +3626,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * The initiator and target negotiate the maximum number of connections * requested/acceptable. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_MAX_CONNECTIONS "MaxConnections" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_MAX_CONNECTIONS "MaxConnections\0" /** * @brief Login/Text Operational Session Text Key: Send targets. @@ -3790,7 +3790,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * multiple connections per session; it is communicated via the * MaxConnections text key upon login to the target. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_SEND_TARGETS "SendTargets" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_SEND_TARGETS "SendTargets\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Initial Ready To Transfer. @@ -3819,7 +3819,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * Only the first outgoing data burst (immediate data and/or separate * PDUs) can be sent unsolicited (i.e., not requiring an explicit R2T). */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_INITIAL_R2T "InitialR2T" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_INITIAL_R2T "InitialR2T\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Immediate data. @@ -3856,7 +3856,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * | Yes | No | No | No | * | Yes | Yes | No | Yes | */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_IMMEDIATE_DATA "ImmediateData" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_IMMEDIATE_DATA "ImmediateData\0\0" /** * @brief Login/Text Operational Session Text Key: Maximum receive DataSegmentLength. @@ -3879,7 +3879,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * unsolicited PDUs exceeding FirstBurstLength (or FirstBurstLength- * Immediate Data Length if immediate data were sent). */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_MAX_RECV_DS_LEN "MaxRecvDataSegmentLength" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_MAX_RECV_DS_LEN "MaxRecvDataSegmentLength\0\0\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Maximum burst length. @@ -3898,7 +3898,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * sequence consists of one or more consecutive Data-In or Data-Out PDUs * that end with a Data-In or Data-Out PDU with the F bit set to 1. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_MAX_BURST_LEN "MaxBurstLength" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_MAX_BURST_LEN "MaxBurstLength\0" /** * @brief Login/Text Operational Session Text Key: First burst length. @@ -3920,7 +3920,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * follow the command.\n * FirstBurstLength MUST NOT exceed MaxBurstLength. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_FIRST_BURST_LEN "FirstBurstLength" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_FIRST_BURST_LEN "FirstBurstLength\0\0\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Default time to wait. @@ -3940,7 +3940,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * A value of 0 indicates that logout or active task reassignment can be * attempted immediately. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DEFAULT_TIME_WAIT "DefaultTime2Wait" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DEFAULT_TIME_WAIT "DefaultTime2Wait\0\0\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Default time to retain. @@ -3962,7 +3962,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * A value of 0 indicates that connection/task state is immediately * discarded by the target. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DEFAULT_TIME_RETAIN "DefaultTime2Retain" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DEFAULT_TIME_RETAIN "DefaultTime2Retain\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Maximum outstanding Ready To Transfer. @@ -3982,7 +3982,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * PDU (with the F bit set to 1) is transferred or a sequence reception * timeout is encountered for that data sequence. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_MAX_OUTSTANDING_R2T "MaxOutstandingR2T" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_MAX_OUTSTANDING_R2T "MaxOutstandingR2T\0\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Data Protocol Data Unit (PDU) in order. @@ -4001,7 +4001,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * sequences have to be at continuously increasing addresses and * overlays are forbidden. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DATA_PDU_IN_ORDER "DataPDUInOrder" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DATA_PDU_IN_ORDER "DataPDUInOrder\0" /** * @brief Login/Text Operational Session Text Key: Data sequence in order. @@ -4031,7 +4031,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * not 0 and DataSequenceInOrder is set to Yes, then MaxOutstandingR2T * MUST be set to 1. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DATA_SEQ_IN_ORDER "DataSequenceInOrder" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_DATA_SEQ_IN_ORDER "DataSequenceInOrder\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Error recovery level. @@ -4051,7 +4051,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * In the description of recovery mechanisms, certain recovery classes * are specified. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_ERR_RECOVERY_LEVEL "ErrorRecoveryLevel" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_ERR_RECOVERY_LEVEL "ErrorRecoveryLevel\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: X reversed vendor. @@ -4074,7 +4074,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * Vendor-specific keys MUST ONLY be used in Normal sessions.\n * Support for public or private extension keys is OPTIONAL. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_PRIV_EXT_KEY_FMT "X-reversed.vendor" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_PRIV_EXT_KEY_FMT "X-reversed.vendor\0\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: Task reporting. @@ -4102,7 +4102,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * When TaskReporting is not negotiated to FastAbort, the * standard multi-task abort semantics MUST be used. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_TASK_REPORTING "TaskReporting" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_TASK_REPORTING "TaskReporting\0\0" /** * @brief Login/Text Operational Session Text Key: X Node architecture. @@ -4151,7 +4151,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * silent (the node does not transmit any key value and simply discards * any key values it receives without issuing a NotUnderstood response). */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_X_NODE_ARCH "X#NodeArchitecture" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_X_NODE_ARCH "X#NodeArchitecture\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: IFMarker (obseleted). @@ -4170,7 +4170,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * implementation MUST NOT respond with a "NotUnderstood" value for * either of these keys. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_IF_MARKER "IFMarker" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_IF_MARKER "IFMarker\0\0\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: OFMarker (obseleted). @@ -4189,7 +4189,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * implementation MUST NOT respond with a "NotUnderstood" value for * either of these keys. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_OF_MARKER "OFMarker" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_OF_MARKER "OFMarker\0\0\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: OFMarkInt (obseleted). @@ -4208,7 +4208,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * implementation MUST NOT respond with a "NotUnderstood" value for * either of these keys. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_OF_MARK_INT "OFMarkInt" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_OF_MARK_INT "OFMarkInt\0\0\0\0\0\0" /** * @brief Login/Text Operational Session Text Key: IFMarkInt (obseleted). @@ -4227,7 +4227,7 @@ typedef struct __attribute__((packed)) iscsi_isid { * implementation MUST NOT respond with a "NotUnderstood" value for * either of these keys. */ -#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_IF_MARK_INT "IFMarkInt" +#define ISCSI_LOGIN_AUTH_SESSION_TEXT_KEY_IF_MARK_INT "IFMarkInt\0\0\0\0\0\0" /// Login request Next Stage (NSG) flags: SecurityNegotiation. -- cgit v1.2.3-55-g7522