diff options
author | mav <mav@FreeBSD.org> | 2015-01-03 13:08:08 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-01-03 13:08:08 +0000 |
commit | 2952feb3ad9cd929b2aeb20e2746b63042e042df (patch) | |
tree | a5b23d1902be7132085a8641947312f3920b7e1a /usr.sbin/ctld/login.c | |
parent | 5823747ac5f8823fb07d435374acaade6456d1ef (diff) | |
download | FreeBSD-src-2952feb3ad9cd929b2aeb20e2746b63042e042df.zip FreeBSD-src-2952feb3ad9cd929b2aeb20e2746b63042e042df.tar.gz |
MFC r275864: 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.
Diffstat (limited to 'usr.sbin/ctld/login.c')
-rw-r--r-- | usr.sbin/ctld/login.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index ce6f54d..5358e4b 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); |