Pull up following revision(s) (requested by riastradh in ticket #545):

external/bsd/iscsi/dist/src/lib/protocol.c: revision 1.5

libiscsi: Fix types of Time2Wait and Time2Retain in logout decap.

According to https://www.rfc-editor.org/rfc/rfc7143#section-11.15,
these are both 2-byte quantities.  Loading 4-byte quantities and
passing them through ISCSI_NTOHS might have worked by accident on
x86, but it's not gonna fly on big-endian.  (Fortunately sparc64 is
not just big-endian but also strict-alignment so it caught this
problem!)

XXX Is there an upstream for this code?  doc/3RDPARTY doesn't cite
any easily-followed references.

PR port-sparc64/57784
This commit is contained in:
martin 2024-01-14 15:30:45 +00:00
parent 58c7525707
commit 3b9bfdde54
1 changed files with 2 additions and 2 deletions

View File

@ -920,8 +920,8 @@ iscsi_logout_rsp_decap(uint8_t *header, iscsi_logout_rsp_args_t * rsp)
rsp->StatSN = ISCSI_NTOHL(*((uint32_t *) (void *) (header + 24))); /* StatSN */
rsp->ExpCmdSN = ISCSI_NTOHL(*((uint32_t *) (void *) (header + 28))); /* ExpCmdSN */
rsp->MaxCmdSN = ISCSI_NTOHL(*((uint32_t *) (void *) (header + 32))); /* MaxCmdSN */
rsp->Time2Wait = ISCSI_NTOHS(*((uint32_t *) (void *) (header + 40))); /* Time2Wait */
rsp->Time2Retain = ISCSI_NTOHS(*((uint32_t *) (void *) (header + 42))); /* Time2Retain */
rsp->Time2Wait = ISCSI_NTOHS(*((uint16_t *) (void *) (header + 40))); /* Time2Wait */
rsp->Time2Retain = ISCSI_NTOHS(*((uint16_t *) (void *) (header + 42))); /* Time2Retain */
errmsg = NULL;
(void) memset(zeros, 0x0, sizeof(zeros));