diff options
author | mav <mav@FreeBSD.org> | 2014-12-17 15:13:21 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-12-17 15:13:21 +0000 |
commit | fe9781bb787e975c2a1cdb7bd6841ee161c31b2e (patch) | |
tree | 663cd0ad837b0a1752ce0820622db742c40e5dd8 /usr.sbin/iscsid | |
parent | df55c61fa5caaef1f237ceb37d7870b642661de3 (diff) | |
download | FreeBSD-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/iscsid')
-rw-r--r-- | usr.sbin/iscsid/discovery.c | 4 | ||||
-rw-r--r-- | usr.sbin/iscsid/login.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/iscsid/discovery.c b/usr.sbin/iscsid/discovery.c index c87d9ff..a8975d7 100644 --- a/usr.sbin/iscsid/discovery.c +++ b/usr.sbin/iscsid/discovery.c @@ -66,7 +66,7 @@ text_receive(struct connection *conn) log_errx(1, "received Text PDU with unsupported \"C\" flag"); if (ntohl(bhstr->bhstr_statsn) != conn->conn_statsn + 1) { log_errx(1, "received Text PDU with wrong StatSN: " - "is %d, should be %d", ntohl(bhstr->bhstr_statsn), + "is %u, should be %u", ntohl(bhstr->bhstr_statsn), conn->conn_statsn + 1); } conn->conn_statsn = ntohl(bhstr->bhstr_statsn); @@ -112,7 +112,7 @@ logout_receive(struct connection *conn) ntohs(bhslr->bhslr_response)); if (ntohl(bhslr->bhslr_statsn) != conn->conn_statsn + 1) { log_errx(1, "received Logout PDU with wrong StatSN: " - "is %d, should be %d", ntohl(bhslr->bhslr_statsn), + "is %u, should be %u", ntohl(bhslr->bhslr_statsn), conn->conn_statsn + 1); } conn->conn_statsn = ntohl(bhslr->bhslr_statsn); diff --git a/usr.sbin/iscsid/login.c b/usr.sbin/iscsid/login.c index afe7ebb..360b0ef 100644 --- a/usr.sbin/iscsid/login.c +++ b/usr.sbin/iscsid/login.c @@ -257,7 +257,7 @@ login_receive(struct connection *conn) * to be bug in NetBSD iSCSI target. */ log_warnx("received Login PDU with wrong StatSN: " - "is %d, should be %d", ntohl(bhslr->bhslr_statsn), + "is %u, should be %u", ntohl(bhslr->bhslr_statsn), conn->conn_statsn + 1); } conn->conn_tsih = ntohs(bhslr->bhslr_tsih); |