3.3.5.2.10 Verifying the Channel Sequence Number

If Connection.Dialect is equal to "2.0.2" or "2.1", or the command request does not include FileId, this section MUST be skipped.

If the SMB2_FLAGS_REPLAY_OPERATION bit is not set in the Flags field of the SMB2 Header, the server MUST do the following:

  • If ChannelSequence in the SMB2 Header is equal to Open.ChannelSequence, the server MUST increment Open.OutstandingRequestCount by 1.

  • Otherwise, if the unsigned difference using 16-bit arithmetic between ChannelSequence in the SMB2 header and Open.ChannelSequence is less than or equal to 0x7FFF, the server MUST do the following:

    • Increment Open.OutstandingPreRequestCount by Open.OutstandingRequestCount.

    • Set Open.OutstandingRequestCount to 1.

    • Set Open.ChannelSequence to ChannelSequence in the SMB2 Header.

  • Otherwise, the server MUST fail SMB2 WRITE, SET_INFO, and IOCTL requests with STATUS_FILE_NOT_AVAILABLE.

If the SMB2_FLAGS_REPLAY_OPERATION bit is set in the Flags field of the SMB2 Header, the server MUST do the following:

  • If ChannelSequence in the SMB2 Header is equal to Open.ChannelSequence and the following:

    • Open.OutstandingPreRequestCount is equal to zero, the server MUST increment Open.OutstandingRequestCount by 1. Otherwise, the server MUST fail the SMB2 WRITE, SET_INFO, and IOCTL requests with STATUS_FILE_NOT_AVAILABLE.

  • Otherwise, if the unsigned difference using 16-bit arithmetic between ChannelSequence in the SMB2 header and Open.ChannelSequence is less than or equal to 0x7FFF, the server SHOULD<263> perform the following:

    • Increment Open.OutstandingPreRequestCount by Open.OutstandingRequestCount.

    • Set Open.ChannelSequence to ChannelSequence in the SMB2 Header.

    • If Open.OutstandingPreRequestCount is equal to zero, set Open.OutstandingRequestCount to 1. Otherwise, set Open.OutstandingRequestCount to 0 and the server MUST fail the SMB2 WRITE, SET_INFO, and IOCTL requests with STATUS_FILE_NOT_AVAILABLE.

  • Otherwise, the server MUST fail SMB2 WRITE, SET_INFO, and IOCTL requests with STATUS_FILE_NOT_AVAILABLE.