Print this page
NEX-17289 Minimal SMB 3.0.2 support
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-5665 SMB2 oplock leases
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-5665 SMB2 oplock leases
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-5273 SMB 3 Encryption
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-3553 SMB2/3 durable handles
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
NEX-3733 Want SMB2 Apple extensions
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-3610 CLONE NEX-3591 SMB3 signing
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
NEX-3080 SMB1 signing problem with Kerberos auth.
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-1734 SMB2 oplock break request missing a flag
SMB-79 Codenomicon: SMB2 TC: 4978 - Panic in smb_latency_add_sample
SMB-11 SMB2 message parse & dispatch
SMB-12 SMB2 Negotiate Protocol
SMB-13 SMB2 Session Setup
SMB-14 SMB2 Logoff
SMB-15 SMB2 Tree Connect
SMB-16 SMB2 Tree Disconnect
SMB-17 SMB2 Create
SMB-18 SMB2 Close
SMB-19 SMB2 Flush
SMB-20 SMB2 Read
SMB-21 SMB2 Write
SMB-22 SMB2 Lock/Unlock
SMB-23 SMB2 Ioctl
SMB-24 SMB2 Cancel
SMB-25 SMB2 Echo
SMB-26 SMB2 Query Dir
SMB-27 SMB2 Change Notify
SMB-28 SMB2 Query Info
SMB-29 SMB2 Set Info
SMB-30 SMB2 Oplocks
SMB-53 SMB2 Create Context options
(SMB2 code review cleanup 1, 2, 3)
        
*** 8,18 ****
   * source.  A copy of the CDDL is also available via the Internet at
   * http://www.illumos.org/license/CDDL.
   */
  
  /*
!  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
   */
  
  #ifndef _SMB_SMB2_H
  #define _SMB_SMB2_H
  
--- 8,18 ----
   * source.  A copy of the CDDL is also available via the Internet at
   * http://www.illumos.org/license/CDDL.
   */
  
  /*
!  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
   */
  
  #ifndef _SMB_SMB2_H
  #define _SMB_SMB2_H
  
*** 20,31 ****
--- 20,38 ----
  extern "C" {
  #endif
  
  #define SMB2_PROTOCOL_ID        { 0xFE, 'S', 'M', 'B' }
  #define SMB2_HDR_SIZE   64
+ #define SMB3_TFORM_HDR_SIZE     52
  
  /*
+  * Protocol ID as a 32-bit little-endian integer.
+  */
+ #define SMB2_PROTOCOL_MAGIC     0x424d53fe
+ #define SMB3_ENCRYPTED_MAGIC    0x424d53fd
+ 
+ /*
   * SMB2 header command codes.
   * These are uint16_t on the wire.
   */
  typedef enum {
          SMB2_NEGOTIATE = 0,
*** 147,156 ****
--- 154,168 ----
  #define SMB2_SESSION_FLAG_IS_GUEST      0x0001
  #define SMB2_SESSION_FLAG_IS_NULL       0x0002
  #define SMB2_SESSION_FLAG_ENCRYPT_DATA  0x0004
  
  /*
+  * Client wants to bind an existing session to a new connection
+  */
+ #define SMB2_SESSION_FLAG_BINDING       0x01
+ 
+ /*
   * SMB2 Tree connect, disconnect
   */
  
  /* SMB2 sharetype flags */
  #define SMB2_SHARE_TYPE_DISK            0x1
*** 183,199 ****
  
  /*
   * SMB2 Create (open)
   */
  
! /* SMB2 requested oplock levels */
  #define SMB2_OPLOCK_LEVEL_NONE                          0x00
  #define SMB2_OPLOCK_LEVEL_II                            0x01
  #define SMB2_OPLOCK_LEVEL_EXCLUSIVE                     0x08
  #define SMB2_OPLOCK_LEVEL_BATCH                         0x09
  #define SMB2_OPLOCK_LEVEL_LEASE                         0xFF
  
  /* SMB2 impersonation levels */
  #define SMB2_IMPERSONATION_ANONYMOUS                    0x00
  #define SMB2_IMPERSONATION_IDENTIFICATION               0x01
  #define SMB2_IMPERSONATION_IMPERSONATION                0x02
  #define SMB2_IMPERSONATION_DELEGATE                     0x03
--- 195,227 ----
  
  /*
   * SMB2 Create (open)
   */
  
! /*
!  * SMB2 requested oplock levels
!  * Corresponds to ntifs.h OPLOCK_LEVEL_... but NOT the same!
!  */
  #define SMB2_OPLOCK_LEVEL_NONE                          0x00
  #define SMB2_OPLOCK_LEVEL_II                            0x01
  #define SMB2_OPLOCK_LEVEL_EXCLUSIVE                     0x08
  #define SMB2_OPLOCK_LEVEL_BATCH                         0x09
  #define SMB2_OPLOCK_LEVEL_LEASE                         0xFF
  
+ /*
+  * SMB2 create request lease "type"
+  * Note: Same as ntifs.h OPLOCK_LEVEL_CACHE...
+  */
+ #define SMB2_LEASE_NONE                                 0x00
+ #define SMB2_LEASE_READ_CACHING                         0x01
+ #define SMB2_LEASE_HANDLE_CACHING                       0x02
+ #define SMB2_LEASE_WRITE_CACHING                        0x04
+ 
+ /* SMB2 create lease flags */
+ #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS               0x00000002
+ #define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET            0x00000004
+ 
  /* SMB2 impersonation levels */
  #define SMB2_IMPERSONATION_ANONYMOUS                    0x00
  #define SMB2_IMPERSONATION_IDENTIFICATION               0x01
  #define SMB2_IMPERSONATION_IMPERSONATION                0x02
  #define SMB2_IMPERSONATION_DELEGATE                     0x03
*** 255,288 ****
   * The client is requesting that the server return a 32-byte
   * opaque BLOB that uniquely identifies the file being opened
   * on disk. No data is passed to the server by the client.
   */
  
  #define SMB2_CREATE_REQUEST_LEASE               0x52714c73 /* ("RqLs") */
  /*
   * The client is requesting that the server return a lease.
   * This value is only supported for the SMB 2.1 and 3.0 dialects.
   */
  
! /* SMB2 create request lease */
! #define SMB2_LEASE_NONE                         0x00
! #define SMB2_LEASE_READ_CACHING                 0x01
! #define SMB2_LEASE_HANDLE_CACHING               0x02
! #define SMB2_LEASE_WRITE_CACHING                0x04
  
- /* SMB2 lease break notification flags */
- #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED  0x01
- 
  /*
   * SMB2 Close
   */
  #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB        0x0001
  
  /*
   * SMB2 Write
   */
  #define SMB2_WRITEFLAG_WRITE_THROUGH            0x00000001
  
  /*
   * SMB2 Lock Request
   */
  
--- 283,334 ----
   * The client is requesting that the server return a 32-byte
   * opaque BLOB that uniquely identifies the file being opened
   * on disk. No data is passed to the server by the client.
   */
  
+ #define SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2   0x44483251 /* ("DH2Q") */
+ /*
+  * The client is requesting the open to be durable.
+  * This value is only supported for the SMB 3.x dialect family.
+  */
+ 
+ #define SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 0x44483243 /* ("DH2C") */
+ /*
+  * The client is requesting to reconnect to a
+  * durable open after being disconnected.
+  * This value is only supported for the SMB 3.x dialect family.
+  */
+ 
+ #define SMB2_DHANDLE_FLAG_PERSISTENT    0x00000002
+ /* A persistent handle is requested. */
+ 
  #define SMB2_CREATE_REQUEST_LEASE               0x52714c73 /* ("RqLs") */
  /*
   * The client is requesting that the server return a lease.
   * This value is only supported for the SMB 2.1 and 3.0 dialects.
   */
  
! #define SMB2_CREATE_CTX_AAPL                    0x4141504c /* ("AAPL") */
! /*
!  * Client is MacOS X looking for MacOS-specific extensions.
!  */
  
  /*
   * SMB2 Close
   */
  #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB        0x0001
  
  /*
+  * SMB2 Read
+  */
+ #define SMB2_READFLAG_READ_UNBUFFERED           0x00000001
+ 
+ /*
   * SMB2 Write
   */
  #define SMB2_WRITEFLAG_WRITE_THROUGH            0x00000001
+ #define SMB2_WRITEFLAG_WRITE_UNBUFFERED         0x00000002
  
  /*
   * SMB2 Lock Request
   */
  
*** 362,371 ****
--- 408,420 ----
  /*
   * SMB2 Change Nofity Request
   */
  #define SMB2_WATCH_TREE                 0x00000001
  
+ /* SMB2 Oplock Break: lease break notification flags */
+ #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED  0x01
+ 
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* _SMB_SMB2_H */