These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / fs / cifs / smb2pdu.h
index 70867d5..4af5278 100644 (file)
@@ -136,9 +136,6 @@ struct smb2_transform_hdr {
        __u64  SessionId;
 } __packed;
 
-/* Encryption Algorithms */
-#define SMB2_ENCRYPTION_AES128_CCM     cpu_to_le16(0x0001)
-
 /*
  *     SMB2 flag definitions
  */
@@ -191,7 +188,10 @@ struct smb2_negotiate_req {
        __le16 Reserved;        /* MBZ */
        __le32 Capabilities;
        __u8   ClientGUID[SMB2_CLIENT_GUID_SIZE];
-       __le64 ClientStartTime; /* MBZ */
+       /* In SMB3.02 and earlier next three were MBZ le64 ClientStartTime */
+       __le32 NegotiateContextOffset; /* SMB3.1.1 only. MBZ earlier */
+       __le16 NegotiateContextCount;  /* SMB3.1.1 only. MBZ earlier */
+       __le16 Reserved2;
        __le16 Dialects[1]; /* One dialect (vers=) at a time for now */
 } __packed;
 
@@ -200,6 +200,7 @@ struct smb2_negotiate_req {
 #define SMB21_PROT_ID 0x0210
 #define SMB30_PROT_ID 0x0300
 #define SMB302_PROT_ID 0x0302
+#define SMB311_PROT_ID 0x0311
 #define BAD_PROT_ID   0xFFFF
 
 /* SecurityMode flags */
@@ -217,12 +218,38 @@ struct smb2_negotiate_req {
 #define SMB2_NT_FIND                   0x00100000
 #define SMB2_LARGE_FILES               0x00200000
 
+#define SMB311_SALT_SIZE                       32
+/* Hash Algorithm Types */
+#define SMB2_PREAUTH_INTEGRITY_SHA512  cpu_to_le16(0x0001)
+
+struct smb2_preauth_neg_context {
+       __le16  ContextType; /* 1 */
+       __le16  DataLength;
+       __le32  Reserved;
+       __le16  HashAlgorithmCount; /* 1 */
+       __le16  SaltLength;
+       __le16  HashAlgorithms; /* HashAlgorithms[0] since only one defined */
+       __u8    Salt[SMB311_SALT_SIZE];
+} __packed;
+
+/* Encryption Algorithms Ciphers */
+#define SMB2_ENCRYPTION_AES128_CCM     cpu_to_le16(0x0001)
+#define SMB2_ENCRYPTION_AES128_GCM     cpu_to_le16(0x0002)
+
+struct smb2_encryption_neg_context {
+       __le16  ContextType; /* 2 */
+       __le16  DataLength;
+       __le32  Reserved;
+       __le16  CipherCount; /* AES-128-GCM and AES-128-CCM */
+       __le16  Ciphers[2]; /* Ciphers[0] since only one used now */
+} __packed;
+
 struct smb2_negotiate_rsp {
        struct smb2_hdr hdr;
        __le16 StructureSize;   /* Must be 65 */
        __le16 SecurityMode;
        __le16 DialectRevision;
-       __le16 Reserved;        /* MBZ */
+       __le16 NegotiateContextCount;   /* Prior to SMB3.1.1 was Reserved & MBZ */
        __u8   ServerGUID[16];
        __le32 Capabilities;
        __le32 MaxTransactSize;
@@ -232,14 +259,18 @@ struct smb2_negotiate_rsp {
        __le64 ServerStartTime;
        __le16 SecurityBufferOffset;
        __le16 SecurityBufferLength;
-       __le32 Reserved2;       /* may be any value, ignore */
+       __le32 NegotiateContextOffset;  /* Pre:SMB3.1.1 was reserved/ignored */
        __u8   Buffer[1];       /* variable length GSS security buffer */
 } __packed;
 
+/* Flags */
+#define SMB2_SESSION_REQ_FLAG_BINDING          0x01
+#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA     0x04
+
 struct smb2_sess_setup_req {
        struct smb2_hdr hdr;
        __le16 StructureSize; /* Must be 25 */
-       __u8   VcNumber;
+       __u8   Flags;
        __u8   SecurityMode;
        __le32 Capabilities;
        __le32 Channel;
@@ -274,10 +305,13 @@ struct smb2_logoff_rsp {
        __le16 Reserved;
 } __packed;
 
+/* Flags/Reserved for SMB3.1.1 */
+#define SMB2_SHAREFLAG_CLUSTER_RECONNECT       0x0001
+
 struct smb2_tree_connect_req {
        struct smb2_hdr hdr;
        __le16 StructureSize;   /* Must be 9 */
-       __le16 Reserved;
+       __le16 Reserved; /* Flags in SMB3.1.1 */
        __le16 PathOffset;
        __le16 PathLength;
        __u8   Buffer[1];       /* variable length */
@@ -556,6 +590,44 @@ struct create_durable {
        } Data;
 } __packed;
 
+/* See MS-SMB2 2.2.13.2.11 */
+/* Flags */
+#define SMB2_DHANDLE_FLAG_PERSISTENT   0x00000002
+struct durable_context_v2 {
+       __le32 Timeout;
+       __le32 Flags;
+       __u64 Reserved;
+       __u8 CreateGuid[16];
+} __packed;
+
+struct create_durable_v2 {
+       struct create_context ccontext;
+       __u8   Name[8];
+       struct durable_context_v2 dcontext;
+} __packed;
+
+/* See MS-SMB2 2.2.13.2.12 */
+struct durable_reconnect_context_v2 {
+       struct {
+               __u64 PersistentFileId;
+               __u64 VolatileFileId;
+       } Fid;
+       __u8 CreateGuid[16];
+       __le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
+} __packed;
+
+/* See MS-SMB2 2.2.14.2.12 */
+struct durable_reconnect_context_v2_rsp {
+       __le32 Timeout;
+       __le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
+} __packed;
+
+struct create_durable_handle_reconnect_v2 {
+       struct create_context ccontext;
+       __u8   Name[8];
+       struct durable_reconnect_context_v2 dcontext;
+} __packed;
+
 #define COPY_CHUNK_RES_KEY_SIZE        24
 struct resume_key_req {
        char ResumeKey[COPY_CHUNK_RES_KEY_SIZE];
@@ -587,6 +659,36 @@ struct copychunk_ioctl_rsp {
        __le32 TotalBytesWritten;
 } __packed;
 
+struct fsctl_set_integrity_information_req {
+       __le16  ChecksumAlgorithm;
+       __le16  Reserved;
+       __le32  Flags;
+} __packed;
+
+struct fsctl_get_integrity_information_rsp {
+       __le16  ChecksumAlgorithm;
+       __le16  Reserved;
+       __le32  Flags;
+       __le32  ChecksumChunkSizeInBytes;
+       __le32  ClusterSizeInBytes;
+} __packed;
+
+/* Integrity ChecksumAlgorithm choices for above */
+#define        CHECKSUM_TYPE_NONE      0x0000
+#define        CHECKSUM_TYPE_CRC64     0x0002
+#define CHECKSUM_TYPE_UNCHANGED        0xFFFF  /* set only */
+
+/* Integrity flags for above */
+#define FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF  0x00000001
+
+/* See MS-SMB2 2.2.31.3 */
+struct network_resiliency_req {
+       __le32 Timeout;
+       __le32 Reserved;
+} __packed;
+/* There is no buffer for the response ie no struct network_resiliency_rsp */
+
+
 struct validate_negotiate_info_req {
        __le32 Capabilities;
        __u8   Guid[SMB2_CLIENT_GUID_SIZE];
@@ -620,6 +722,14 @@ struct compress_ioctl {
        __le16 CompressionState; /* See cifspdu.h for possible flag values */
 } __packed;
 
+struct duplicate_extents_to_file {
+       __u64 PersistentFileHandle; /* source file handle, opaque endianness */
+       __u64 VolatileFileHandle;
+       __le64 SourceFileOffset;
+       __le64 TargetFileOffset;
+       __le64 ByteCount;  /* Bytes to be copied */
+} __packed;
+
 struct smb2_ioctl_req {
        struct smb2_hdr hdr;
        __le16 StructureSize;   /* Must be 57 */