iscsid: set max_recv_data_segment_length to what we advertise

Previously we updated the conection's conn_max_recv_data_segment_length
only when we received a response containing MaxRecvDataSegmentLength
from the target.  If the target did not send MaxRecvDataSegmentLength
then we left conn_max_recv_data_segment_length at the default (i.e.,
8192).  A target could then send more data than that defult (up to our
advertised maximum), and we would drop the connection.

RFC 7143 specifies that MaxRecvDataSegmentLength is Declarative, not
negotiated.  Just set conn_max_recv_data_segment_length to our
advertised value in login_negotiate().

PR:		259355
Reviewed by:	mav
MFC after:	1 week
Fixes:		a15fbc904a ("Alike to r312190 decouple iSCSI...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32605
This commit is contained in:
Ed Maste 2021-10-21 11:09:58 -04:00
parent 548ada00e5
commit fc79cf4fea

View File

@ -403,9 +403,6 @@ login_negotiate_key(struct connection *conn, const char *name,
tmp = isl->isl_max_send_data_segment_length;
}
conn->conn_max_send_data_segment_length = tmp;
/* We received target's limit, that means it accepted our's. */
conn->conn_max_recv_data_segment_length =
isl->isl_max_recv_data_segment_length;
} else if (strcmp(name, "MaxBurstLength") == 0) {
tmp = strtoul(value, NULL, 10);
if (tmp <= 0)
@ -538,6 +535,9 @@ login_negotiate(struct connection *conn)
isl->isl_max_recv_data_segment_length);
}
conn->conn_max_recv_data_segment_length =
isl->isl_max_recv_data_segment_length;
keys_add(request_keys, "DefaultTime2Wait", "0");
keys_add(request_keys, "DefaultTime2Retain", "0");
keys_add(request_keys, "ErrorRecoveryLevel", "0");