Skip to content

Commit 8895c66

Browse files
committed
SMB3: Minor cleanup of protocol definitions
And add one missing define (COMPRESSION_TRANSFORM_ID) and flag (TRANSFORM_FLAG_ENCRYPTED) Signed-off-by: Steve French <[email protected]>
1 parent 8f23343 commit 8895c66

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

fs/cifs/smb2pdu.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191

9292
#define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe)
9393
#define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd)
94+
#define SMB2_COMPRESSION_TRANSFORM_ID cpu_to_le32(0x424d53fc)
9495

9596
/*
9697
* SMB2 Header Definition
@@ -127,13 +128,15 @@ struct smb2_sync_pdu {
127128
#define SMB3_AES128CCM_NONCE 11
128129
#define SMB3_AES128GCM_NONCE 12
129130

131+
/* Transform flags (for 3.0 dialect this flag indicates CCM */
132+
#define TRANSFORM_FLAG_ENCRYPTED 0x0001
130133
struct smb2_transform_hdr {
131134
__le32 ProtocolId; /* 0xFD 'S' 'M' 'B' */
132135
__u8 Signature[16];
133136
__u8 Nonce[16];
134137
__le32 OriginalMessageSize;
135138
__u16 Reserved1;
136-
__le16 Flags; /* EncryptionAlgorithm */
139+
__le16 Flags; /* EncryptionAlgorithm for 3.0, enc enabled for 3.1.1 */
137140
__u64 SessionId;
138141
} __packed;
139142

@@ -207,6 +210,10 @@ struct smb2_error_context_rsp {
207210
__u8 ErrorContextData; /* ErrorDataLength long array */
208211
} __packed;
209212

213+
/* ErrorId values */
214+
#define SMB2_ERROR_ID_DEFAULT 0x00000000
215+
#define SMB2_ERROR_ID_SHARE_REDIRECT cpu_to_le32(0x72645253) /* "rdRS" */
216+
210217
/* Defines for Type field below (see MS-SMB2 2.2.2.2.2.1) */
211218
#define MOVE_DST_IPADDR_V4 cpu_to_le32(0x00000001)
212219
#define MOVE_DST_IPADDR_V6 cpu_to_le32(0x00000002)
@@ -427,7 +434,7 @@ struct smb2_logoff_rsp {
427434
struct smb2_tree_connect_req {
428435
struct smb2_sync_hdr sync_hdr;
429436
__le16 StructureSize; /* Must be 9 */
430-
__le16 Reserved; /* Flags in SMB3.1.1 */
437+
__le16 Flags; /* Reserved MBZ for dialects prior to SMB3.1.1 */
431438
__le16 PathOffset;
432439
__le16 PathLength;
433440
__u8 Buffer[1]; /* variable length */
@@ -654,7 +661,7 @@ struct smb2_tree_disconnect_rsp {
654661
| FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE)
655662
#define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE)
656663

657-
/* Impersonation Levels */
664+
/* Impersonation Levels. See MS-WPO section 9.7 and MSDN-IMPERS */
658665
#define IL_ANONYMOUS cpu_to_le32(0x00000000)
659666
#define IL_IDENTIFICATION cpu_to_le32(0x00000001)
660667
#define IL_IMPERSONATION cpu_to_le32(0x00000002)
@@ -760,7 +767,7 @@ struct create_context {
760767
#define SMB2_LEASE_HANDLE_CACHING cpu_to_le32(0x02)
761768
#define SMB2_LEASE_WRITE_CACHING cpu_to_le32(0x04)
762769

763-
#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x02)
770+
#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x00000002)
764771
#define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET cpu_to_le32(0x00000004)
765772

766773
#define SMB2_LEASE_KEY_SIZE 16

0 commit comments

Comments
 (0)