fix error handling for unsupported commands
- Respond with failure for unsupported task management commands - Increase MaxRecvDataSegmentLength to 65536, to match FirstBurstLength Signed-off-by: Utkarsh Mani Tripathi <utkarsh.tripathi@mayadata.io>
This commit is contained in:
@@ -841,10 +841,8 @@ func (s *ISCSITargetDriver) iscsiExecTask(task *iscsiTask) error {
|
||||
fallthrough
|
||||
case ISCSI_TM_FUNC_TARGET_WARM_RESET, ISCSI_TM_FUNC_TARGET_COLD_RESET, ISCSI_TM_FUNC_TASK_REASSIGN:
|
||||
task.result = ISCSI_TMF_RSP_NOT_SUPPORTED
|
||||
return fmt.Errorf("The task function is not supported")
|
||||
default:
|
||||
task.result = ISCSI_TMF_RSP_REJECTED
|
||||
return fmt.Errorf("Unknown task function")
|
||||
}
|
||||
// return response to initiator
|
||||
return task.conn.buildRespPackage(OpSCSITaskResp, task)
|
||||
|
||||
@@ -184,7 +184,7 @@ func boolKeyInConv(value uint) string {
|
||||
|
||||
var sessionKeys map[string]*iscsiSessionKeys = map[string]*iscsiSessionKeys{
|
||||
// ISCSI_PARAM_MAX_RECV_DLENGTH
|
||||
"MaxRecvDataSegmentLength": {ISCSI_PARAM_MAX_RECV_DLENGTH, true, 32768, 512, 16777215, numberKeyConv, numberKeyInConv},
|
||||
"MaxRecvDataSegmentLength": {ISCSI_PARAM_MAX_RECV_DLENGTH, true, 65536, 512, 16777215, numberKeyConv, numberKeyInConv},
|
||||
// ISCSI_PARAM_HDRDGST_EN
|
||||
"HeaderDigest": {ISCSI_PARAM_HDRDGST_EN, false, DIGEST_NONE, DIGEST_NONE, DIGEST_ALL, digestKeyConv, digestKeyInConv},
|
||||
// ISCSI_PARAM_DATADGST_EN
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
)
|
||||
|
||||
func SPCIllegalOp(host int, cmd *api.SCSICommand) api.SAMStat {
|
||||
BuildSenseData(cmd, ILLEGAL_REQUEST, ASC_INVALID_FIELD_IN_CDB)
|
||||
BuildSenseData(cmd, ILLEGAL_REQUEST, ASC_INVALID_OP_CODE)
|
||||
return api.SAMStatCheckCondition
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user