Module Name:    src
Committed By:   martin
Date:           Sun Jan 14 15:30:45 UTC 2024

Modified Files:
        src/external/bsd/iscsi/dist/src/lib [netbsd-10]: protocol.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.42.1 src/external/bsd/iscsi/dist/src/lib/protocol.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/iscsi/dist/src/lib/protocol.c
diff -u src/external/bsd/iscsi/dist/src/lib/protocol.c:1.4 src/external/bsd/iscsi/dist/src/lib/protocol.c:1.4.42.1
--- src/external/bsd/iscsi/dist/src/lib/protocol.c:1.4	Sat Sep 29 07:18:21 2012
+++ src/external/bsd/iscsi/dist/src/lib/protocol.c	Sun Jan 14 15:30:45 2024
@@ -920,8 +920,8 @@ iscsi_logout_rsp_decap(uint8_t *header, 
 	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));

Reply via email to