summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld/login.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-12-17 15:13:21 +0000
committermav <mav@FreeBSD.org>2014-12-17 15:13:21 +0000
commitfe9781bb787e975c2a1cdb7bd6841ee161c31b2e (patch)
tree663cd0ad837b0a1752ce0820622db742c40e5dd8 /usr.sbin/ctld/login.c
parentdf55c61fa5caaef1f237ceb37d7870b642661de3 (diff)
downloadFreeBSD-src-fe9781bb787e975c2a1cdb7bd6841ee161c31b2e.zip
FreeBSD-src-fe9781bb787e975c2a1cdb7bd6841ee161c31b2e.tar.gz
Make sequence numbers checks more strict.
While we don't support MCS, hole in received sequence numbers may mean only PDU loss. While we don't support lost PDU recovery, terminate the connection to avoid stuck commands. While there, improve handling of sequence numbers wrap after 2^32 PDUs. MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/ctld/login.c')
-rw-r--r--usr.sbin/ctld/login.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c
index fc41f51..7add09b 100644
--- a/usr.sbin/ctld/login.c
+++ b/usr.sbin/ctld/login.c
@@ -127,17 +127,17 @@ login_receive(struct connection *conn, bool initial)
log_errx(1, "received Login PDU with unsupported "
"Version-min 0x%x", bhslr->bhslr_version_min);
}
- if (ntohl(bhslr->bhslr_cmdsn) < conn->conn_cmdsn) {
+ if (ISCSI_SNLT(ntohl(bhslr->bhslr_cmdsn), conn->conn_cmdsn)) {
login_send_error(request, 0x02, 0x05);
log_errx(1, "received Login PDU with decreasing CmdSN: "
- "was %d, is %d", conn->conn_cmdsn,
+ "was %u, is %u", conn->conn_cmdsn,
ntohl(bhslr->bhslr_cmdsn));
}
if (initial == false &&
ntohl(bhslr->bhslr_expstatsn) != conn->conn_statsn) {
login_send_error(request, 0x02, 0x05);
log_errx(1, "received Login PDU with wrong ExpStatSN: "
- "is %d, should be %d", ntohl(bhslr->bhslr_expstatsn),
+ "is %u, should be %u", ntohl(bhslr->bhslr_expstatsn),
conn->conn_statsn);
}
conn->conn_cmdsn = ntohl(bhslr->bhslr_cmdsn);
OpenPOWER on IntegriCloud