Negotiate InitialR2T during login. Default to offer No, but update
and accept what Target responds. Store the result of the negotiated setting in the iscsi context so we can use it later to determine how to send solicited/unsolicited data.
This commit is contained in:
@@ -60,9 +60,11 @@ iscsi_create_context(const char *initiator_name)
|
||||
iscsi->next_phase = ISCSI_PDU_LOGIN_NSG_OPNEG;
|
||||
iscsi->secneg_phase = ISCSI_LOGIN_SECNEG_PHASE_OFFER_CHAP;
|
||||
|
||||
iscsi->max_burst_length = 262144;
|
||||
iscsi->first_burst_length = 262144;
|
||||
iscsi->max_burst_length = 262144;
|
||||
iscsi->first_burst_length = 262144;
|
||||
iscsi->max_recv_data_segment_length = 262144;
|
||||
iscsi->want_initial_r2t = ISCSI_INITIAL_R2T_NO;
|
||||
iscsi->use_initial_r2t = ISCSI_INITIAL_R2T_NO;
|
||||
|
||||
return iscsi;
|
||||
}
|
||||
|
||||
13
lib/login.c
13
lib/login.c
@@ -195,12 +195,15 @@ iscsi_login_add_initialr2t(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
str = (char *)"InitialR2T=Yes";
|
||||
asprintf(&str, "InitialR2T=%s", iscsi->want_initial_r2t == ISCSI_INITIAL_R2T_NO ?
|
||||
"No" : "Yes");
|
||||
if (iscsi_pdu_add_data(iscsi, pdu, (unsigned char *)str, strlen(str)+1)
|
||||
!= 0) {
|
||||
iscsi_set_error(iscsi, "Out-of-memory: pdu add data failed.");
|
||||
free(str);
|
||||
return -1;
|
||||
}
|
||||
free(str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -931,6 +934,14 @@ iscsi_process_login_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu,
|
||||
iscsi->first_burst_length = strtol((char *)ptr + 17, NULL, 10);
|
||||
}
|
||||
|
||||
if (!strncmp((char *)ptr, "InitialR2T=", 11)) {
|
||||
if (!strcmp((char *)ptr + 11, "No")) {
|
||||
iscsi->use_initial_r2t = ISCSI_INITIAL_R2T_NO;
|
||||
} else {
|
||||
iscsi->use_initial_r2t = ISCSI_INITIAL_R2T_YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (!strncmp((char *)ptr, "MaxBurstLength=", 15)) {
|
||||
iscsi->max_burst_length = strtol((char *)ptr + 15, NULL, 10);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user