diff options
| author | Simon Rettberg | 2025-10-24 14:21:30 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2025-12-09 15:33:20 +0100 |
| commit | 1f04d1ed8865edd68d351f66452e50eb19345d7a (patch) | |
| tree | 7667f7c401640e926afa6b8f2e756787fe28f1e4 | |
| parent | [SERVER] iscsi: Cleanup commented-out code (diff) | |
| download | dnbd3-1f04d1ed8865edd68d351f66452e50eb19345d7a.tar.gz dnbd3-1f04d1ed8865edd68d351f66452e50eb19345d7a.tar.xz dnbd3-1f04d1ed8865edd68d351f66452e50eb19345d7a.zip | |
[SERVER] iscsi: Restore proper padding of DataSegment
This broke when sending ds payload was refactored to avoid copying the
buffer into the PDU's buffer before sending. iscsi_connection_pdu_create
took care of this before, but now that we send the source buffer
directly, pad the packet manually after sending the buffer contents if
required.
| -rw-r--r-- | src/server/iscsi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server/iscsi.c b/src/server/iscsi.c index 26c19eb..c1fc01f 100644 --- a/src/server/iscsi.c +++ b/src/server/iscsi.c @@ -448,6 +448,13 @@ static uint32_t iscsi_scsi_data_in_send(iscsi_connection *conn, iscsi_task *task // Set error return data_sn; } + if ( len % ISCSI_ALIGN_SIZE != 0 ) { + const size_t padding = ISCSI_ALIGN_SIZE - (len % ISCSI_ALIGN_SIZE); + if ( !sock_sendPadding( conn->client->sock, padding ) ) { + // Set error + return data_sn; + } + } } else { const off_t off = task->scsi_task.file_offset + pos; size_t padding = 0; |
