blob: c5c32610aafe26d61997abf2b2ceedb0c10be859 [file] [log] [blame]
Namjae Jeone2f34482021-03-16 10:49:09 +09001/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2016 Namjae Jeon <linkinjeon@kernel.org>
4 * Copyright (C) 2018 Samsung Electronics Co., Ltd.
5 */
6
7#ifndef _SMB2PDU_H
8#define _SMB2PDU_H
9
10#include "ntlmssp.h"
11#include "smbacl.h"
12
13/*
14 * Note that, due to trying to use names similar to the protocol specifications,
15 * there are many mixed case field names in the structures below. Although
16 * this does not match typical Linux kernel style, it is necessary to be
17 * able to match against the protocol specfication.
18 *
19 * SMB2 commands
20 * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses
21 * (ie no useful data other than the SMB error code itself) and are marked such.
22 * Knowing this helps avoid response buffer allocations and copy in some cases.
23 */
24
25/* List of commands in host endian */
26#define SMB2_NEGOTIATE_HE 0x0000
27#define SMB2_SESSION_SETUP_HE 0x0001
28#define SMB2_LOGOFF_HE 0x0002 /* trivial request/resp */
29#define SMB2_TREE_CONNECT_HE 0x0003
30#define SMB2_TREE_DISCONNECT_HE 0x0004 /* trivial req/resp */
31#define SMB2_CREATE_HE 0x0005
32#define SMB2_CLOSE_HE 0x0006
33#define SMB2_FLUSH_HE 0x0007 /* trivial resp */
34#define SMB2_READ_HE 0x0008
35#define SMB2_WRITE_HE 0x0009
36#define SMB2_LOCK_HE 0x000A
37#define SMB2_IOCTL_HE 0x000B
38#define SMB2_CANCEL_HE 0x000C
39#define SMB2_ECHO_HE 0x000D
40#define SMB2_QUERY_DIRECTORY_HE 0x000E
41#define SMB2_CHANGE_NOTIFY_HE 0x000F
42#define SMB2_QUERY_INFO_HE 0x0010
43#define SMB2_SET_INFO_HE 0x0011
44#define SMB2_OPLOCK_BREAK_HE 0x0012
45
46/* The same list in little endian */
47#define SMB2_NEGOTIATE cpu_to_le16(SMB2_NEGOTIATE_HE)
48#define SMB2_SESSION_SETUP cpu_to_le16(SMB2_SESSION_SETUP_HE)
49#define SMB2_LOGOFF cpu_to_le16(SMB2_LOGOFF_HE)
50#define SMB2_TREE_CONNECT cpu_to_le16(SMB2_TREE_CONNECT_HE)
51#define SMB2_TREE_DISCONNECT cpu_to_le16(SMB2_TREE_DISCONNECT_HE)
52#define SMB2_CREATE cpu_to_le16(SMB2_CREATE_HE)
53#define SMB2_CLOSE cpu_to_le16(SMB2_CLOSE_HE)
54#define SMB2_FLUSH cpu_to_le16(SMB2_FLUSH_HE)
55#define SMB2_READ cpu_to_le16(SMB2_READ_HE)
56#define SMB2_WRITE cpu_to_le16(SMB2_WRITE_HE)
57#define SMB2_LOCK cpu_to_le16(SMB2_LOCK_HE)
58#define SMB2_IOCTL cpu_to_le16(SMB2_IOCTL_HE)
59#define SMB2_CANCEL cpu_to_le16(SMB2_CANCEL_HE)
60#define SMB2_ECHO cpu_to_le16(SMB2_ECHO_HE)
61#define SMB2_QUERY_DIRECTORY cpu_to_le16(SMB2_QUERY_DIRECTORY_HE)
62#define SMB2_CHANGE_NOTIFY cpu_to_le16(SMB2_CHANGE_NOTIFY_HE)
63#define SMB2_QUERY_INFO cpu_to_le16(SMB2_QUERY_INFO_HE)
64#define SMB2_SET_INFO cpu_to_le16(SMB2_SET_INFO_HE)
65#define SMB2_OPLOCK_BREAK cpu_to_le16(SMB2_OPLOCK_BREAK_HE)
66
67/*Create Action Flags*/
68#define FILE_SUPERSEDED 0x00000000
69#define FILE_OPENED 0x00000001
70#define FILE_CREATED 0x00000002
71#define FILE_OVERWRITTEN 0x00000003
72
73/*
74 * Size of the session key (crypto key encrypted with the password
75 */
76#define SMB2_NTLMV2_SESSKEY_SIZE 16
77#define SMB2_SIGNATURE_SIZE 16
78#define SMB2_HMACSHA256_SIZE 32
79#define SMB2_CMACAES_SIZE 16
Namjae Jeon5a0ca772021-05-06 11:43:37 +090080#define SMB3_GCM128_CRYPTKEY_SIZE 16
81#define SMB3_GCM256_CRYPTKEY_SIZE 32
82
83/*
84 * Size of the smb3 encryption/decryption keys
85 */
86#define SMB3_ENC_DEC_KEY_SIZE 32
Namjae Jeone2f34482021-03-16 10:49:09 +090087
88/*
89 * Size of the smb3 signing key
90 */
91#define SMB3_SIGN_KEY_SIZE 16
92
93#define CIFS_CLIENT_CHALLENGE_SIZE 8
94#define SMB_SERVER_CHALLENGE_SIZE 8
95
96/* SMB2 Max Credits */
97#define SMB2_MAX_CREDITS 8192
98
99#define SMB2_CLIENT_GUID_SIZE 16
100#define SMB2_CREATE_GUID_SIZE 16
101
102/* Maximum buffer size value we can send with 1 credit */
103#define SMB2_MAX_BUFFER_SIZE 65536
104
105#define NUMBER_OF_SMB2_COMMANDS 0x0013
106
107/* BB FIXME - analyze following length BB */
108#define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */
109
110#define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe) /* 'B''M''S' */
111#define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd)
112
113#define SMB21_DEFAULT_IOSIZE (1024 * 1024)
114#define SMB3_DEFAULT_IOSIZE (4 * 1024 * 1024)
115#define SMB3_DEFAULT_TRANS_SIZE (1024 * 1024)
116
117/*
118 * SMB2 Header Definition
119 *
120 * "MBZ" : Must be Zero
121 * "BB" : BugBug, Something to check/review/analyze later
122 * "PDU" : "Protocol Data Unit" (ie a network "frame")
123 *
124 */
125
126#define __SMB2_HEADER_STRUCTURE_SIZE 64
127#define SMB2_HEADER_STRUCTURE_SIZE \
128 cpu_to_le16(__SMB2_HEADER_STRUCTURE_SIZE)
129
130struct smb2_hdr {
131 __be32 smb2_buf_length; /* big endian on wire */
132 /*
133 * length is only two or three bytes - with
134 * one or two byte type preceding it that MBZ
135 */
136 __le32 ProtocolId; /* 0xFE 'S' 'M' 'B' */
137 __le16 StructureSize; /* 64 */
138 __le16 CreditCharge; /* MBZ */
139 __le32 Status; /* Error from server */
140 __le16 Command;
141 __le16 CreditRequest; /* CreditResponse */
142 __le32 Flags;
143 __le32 NextCommand;
144 __le64 MessageId;
145 union {
146 struct {
147 __le32 ProcessId;
148 __le32 TreeId;
149 } __packed SyncId;
150 __le64 AsyncId;
151 } __packed Id;
152 __le64 SessionId;
153 __u8 Signature[16];
154} __packed;
155
156struct smb2_pdu {
157 struct smb2_hdr hdr;
158 __le16 StructureSize2; /* size of wct area (varies, request specific) */
159} __packed;
160
Namjae Jeon5a0ca772021-05-06 11:43:37 +0900161#define SMB3_AES_CCM_NONCE 11
162#define SMB3_AES_GCM_NONCE 12
Namjae Jeone2f34482021-03-16 10:49:09 +0900163
164struct smb2_transform_hdr {
165 __be32 smb2_buf_length; /* big endian on wire */
166 /*
167 * length is only two or three bytes - with
168 * one or two byte type preceding it that MBZ
169 */
170 __le32 ProtocolId; /* 0xFD 'S' 'M' 'B' */
171 __u8 Signature[16];
172 __u8 Nonce[16];
173 __le32 OriginalMessageSize;
174 __u16 Reserved1;
175 __le16 Flags; /* EncryptionAlgorithm */
176 __le64 SessionId;
177} __packed;
178
179/*
180 * SMB2 flag definitions
181 */
182#define SMB2_FLAGS_SERVER_TO_REDIR cpu_to_le32(0x00000001)
183#define SMB2_FLAGS_ASYNC_COMMAND cpu_to_le32(0x00000002)
184#define SMB2_FLAGS_RELATED_OPERATIONS cpu_to_le32(0x00000004)
185#define SMB2_FLAGS_SIGNED cpu_to_le32(0x00000008)
186#define SMB2_FLAGS_DFS_OPERATIONS cpu_to_le32(0x10000000)
187#define SMB2_FLAGS_REPLAY_OPERATIONS cpu_to_le32(0x20000000)
188
189/*
190 * Definitions for SMB2 Protocol Data Units (network frames)
191 *
192 * See MS-SMB2.PDF specification for protocol details.
193 * The Naming convention is the lower case version of the SMB2
194 * command code name for the struct. Note that structures must be packed.
195 *
196 */
197
198#define SMB2_ERROR_STRUCTURE_SIZE2 9
199#define SMB2_ERROR_STRUCTURE_SIZE2_LE cpu_to_le16(SMB2_ERROR_STRUCTURE_SIZE2)
200
201struct smb2_err_rsp {
202 struct smb2_hdr hdr;
203 __le16 StructureSize;
204 __u8 ErrorContextCount;
205 __u8 Reserved;
206 __le32 ByteCount; /* even if zero, at least one byte follows */
207 __u8 ErrorData[1]; /* variable length */
208} __packed;
209
210struct smb2_negotiate_req {
211 struct smb2_hdr hdr;
212 __le16 StructureSize; /* Must be 36 */
213 __le16 DialectCount;
214 __le16 SecurityMode;
215 __le16 Reserved; /* MBZ */
216 __le32 Capabilities;
217 __u8 ClientGUID[SMB2_CLIENT_GUID_SIZE];
218 /* In SMB3.02 and earlier next three were MBZ le64 ClientStartTime */
219 __le32 NegotiateContextOffset; /* SMB3.1.1 only. MBZ earlier */
220 __le16 NegotiateContextCount; /* SMB3.1.1 only. MBZ earlier */
221 __le16 Reserved2;
222 __le16 Dialects[1]; /* One dialect (vers=) at a time for now */
223} __packed;
224
225/* SecurityMode flags */
226#define SMB2_NEGOTIATE_SIGNING_ENABLED_LE cpu_to_le16(0x0001)
227#define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002
228#define SMB2_NEGOTIATE_SIGNING_REQUIRED_LE cpu_to_le16(0x0002)
229/* Capabilities flags */
230#define SMB2_GLOBAL_CAP_DFS 0x00000001
231#define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */
232#define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */
233#define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */
234#define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */
235#define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */
236#define SMB2_GLOBAL_CAP_ENCRYPTION 0x00000040 /* New to SMB3 */
237/* Internal types */
238#define SMB2_NT_FIND 0x00100000
239#define SMB2_LARGE_FILES 0x00200000
240
241#define SMB311_SALT_SIZE 32
242/* Hash Algorithm Types */
243#define SMB2_PREAUTH_INTEGRITY_SHA512 cpu_to_le16(0x0001)
244
245#define PREAUTH_HASHVALUE_SIZE 64
246
247struct preauth_integrity_info {
248 /* PreAuth integrity Hash ID */
249 __le16 Preauth_HashId;
250 /* PreAuth integrity Hash Value */
251 __u8 Preauth_HashValue[PREAUTH_HASHVALUE_SIZE];
252};
253
254/* offset is sizeof smb2_negotiate_rsp - 4 but rounded up to 8 bytes. */
255#ifdef CONFIG_SMB_SERVER_KERBEROS5
256/* sizeof(struct smb2_negotiate_rsp) - 4 =
257 * header(64) + response(64) + GSS_LENGTH(96) + GSS_PADDING(0)
258 */
259#define OFFSET_OF_NEG_CONTEXT 0xe0
260#else
261/* sizeof(struct smb2_negotiate_rsp) - 4 =
262 * header(64) + response(64) + GSS_LENGTH(74) + GSS_PADDING(6)
263 */
264#define OFFSET_OF_NEG_CONTEXT 0xd0
265#endif
266
267#define SMB2_PREAUTH_INTEGRITY_CAPABILITIES cpu_to_le16(1)
268#define SMB2_ENCRYPTION_CAPABILITIES cpu_to_le16(2)
269#define SMB2_COMPRESSION_CAPABILITIES cpu_to_le16(3)
270#define SMB2_NETNAME_NEGOTIATE_CONTEXT_ID cpu_to_le16(5)
271#define SMB2_POSIX_EXTENSIONS_AVAILABLE cpu_to_le16(0x100)
272
273struct smb2_neg_context {
274 __le16 ContextType;
275 __le16 DataLength;
276 __le32 Reserved;
277 /* Followed by array of data */
278} __packed;
279
280struct smb2_preauth_neg_context {
281 __le16 ContextType; /* 1 */
282 __le16 DataLength;
283 __le32 Reserved;
284 __le16 HashAlgorithmCount; /* 1 */
285 __le16 SaltLength;
286 __le16 HashAlgorithms; /* HashAlgorithms[0] since only one defined */
287 __u8 Salt[SMB311_SALT_SIZE];
288} __packed;
289
290/* Encryption Algorithms Ciphers */
291#define SMB2_ENCRYPTION_AES128_CCM cpu_to_le16(0x0001)
292#define SMB2_ENCRYPTION_AES128_GCM cpu_to_le16(0x0002)
Namjae Jeon5a0ca772021-05-06 11:43:37 +0900293#define SMB2_ENCRYPTION_AES256_CCM cpu_to_le16(0x0003)
294#define SMB2_ENCRYPTION_AES256_GCM cpu_to_le16(0x0004)
Namjae Jeone2f34482021-03-16 10:49:09 +0900295
296struct smb2_encryption_neg_context {
297 __le16 ContextType; /* 2 */
298 __le16 DataLength;
299 __le32 Reserved;
Namjae Jeon5a0ca772021-05-06 11:43:37 +0900300 /* CipherCount usally 2, but can be 3 when AES256-GCM enabled */
301 __le16 CipherCount; /* AES-128-GCM and AES-128-CCM by default */
302 __le16 Ciphers[1];
Namjae Jeone2f34482021-03-16 10:49:09 +0900303} __packed;
304
305#define SMB3_COMPRESS_NONE cpu_to_le16(0x0000)
306#define SMB3_COMPRESS_LZNT1 cpu_to_le16(0x0001)
307#define SMB3_COMPRESS_LZ77 cpu_to_le16(0x0002)
308#define SMB3_COMPRESS_LZ77_HUFF cpu_to_le16(0x0003)
309
310struct smb2_compression_ctx {
311 __le16 ContextType; /* 3 */
312 __le16 DataLength;
313 __le32 Reserved;
314 __le16 CompressionAlgorithmCount;
315 __u16 Padding;
316 __le32 Reserved1;
317 __le16 CompressionAlgorithms[1];
318} __packed;
319
320#define POSIX_CTXT_DATA_LEN 16
321struct smb2_posix_neg_context {
322 __le16 ContextType; /* 0x100 */
323 __le16 DataLength;
324 __le32 Reserved;
325 __u8 Name[16]; /* POSIX ctxt GUID 93AD25509CB411E7B42383DE968BCD7C */
326} __packed;
327
328struct smb2_netname_neg_context {
329 __le16 ContextType; /* 0x100 */
330 __le16 DataLength;
331 __le32 Reserved;
332 __le16 NetName[0]; /* hostname of target converted to UCS-2 */
333} __packed;
334
335struct smb2_negotiate_rsp {
336 struct smb2_hdr hdr;
337 __le16 StructureSize; /* Must be 65 */
338 __le16 SecurityMode;
339 __le16 DialectRevision;
340 __le16 NegotiateContextCount; /* Prior to SMB3.1.1 was Reserved & MBZ */
341 __u8 ServerGUID[16];
342 __le32 Capabilities;
343 __le32 MaxTransactSize;
344 __le32 MaxReadSize;
345 __le32 MaxWriteSize;
346 __le64 SystemTime; /* MBZ */
347 __le64 ServerStartTime;
348 __le16 SecurityBufferOffset;
349 __le16 SecurityBufferLength;
350 __le32 NegotiateContextOffset; /* Pre:SMB3.1.1 was reserved/ignored */
351 __u8 Buffer[1]; /* variable length GSS security buffer */
352} __packed;
353
354/* Flags */
355#define SMB2_SESSION_REQ_FLAG_BINDING 0x01
356#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04
357
358#define SMB2_SESSION_EXPIRED (0)
Namjae Jeon64b39f42021-03-30 14:25:35 +0900359#define SMB2_SESSION_IN_PROGRESS BIT(0)
360#define SMB2_SESSION_VALID BIT(1)
Namjae Jeone2f34482021-03-16 10:49:09 +0900361
362/* Flags */
363#define SMB2_SESSION_REQ_FLAG_BINDING 0x01
364#define SMB2_SESSION_REQ_FLAG_ENCRYPT_DATA 0x04
365
366struct smb2_sess_setup_req {
367 struct smb2_hdr hdr;
368 __le16 StructureSize; /* Must be 25 */
369 __u8 Flags;
370 __u8 SecurityMode;
371 __le32 Capabilities;
372 __le32 Channel;
373 __le16 SecurityBufferOffset;
374 __le16 SecurityBufferLength;
375 __le64 PreviousSessionId;
376 __u8 Buffer[1]; /* variable length GSS security buffer */
377} __packed;
378
379/* Flags/Reserved for SMB3.1.1 */
380#define SMB2_SHAREFLAG_CLUSTER_RECONNECT 0x0001
381
382/* Currently defined SessionFlags */
383#define SMB2_SESSION_FLAG_IS_GUEST_LE cpu_to_le16(0x0001)
384#define SMB2_SESSION_FLAG_IS_NULL_LE cpu_to_le16(0x0002)
385#define SMB2_SESSION_FLAG_ENCRYPT_DATA_LE cpu_to_le16(0x0004)
386struct smb2_sess_setup_rsp {
387 struct smb2_hdr hdr;
388 __le16 StructureSize; /* Must be 9 */
389 __le16 SessionFlags;
390 __le16 SecurityBufferOffset;
391 __le16 SecurityBufferLength;
392 __u8 Buffer[1]; /* variable length GSS security buffer */
393} __packed;
394
395struct smb2_logoff_req {
396 struct smb2_hdr hdr;
397 __le16 StructureSize; /* Must be 4 */
398 __le16 Reserved;
399} __packed;
400
401struct smb2_logoff_rsp {
402 struct smb2_hdr hdr;
403 __le16 StructureSize; /* Must be 4 */
404 __le16 Reserved;
405} __packed;
406
407struct smb2_tree_connect_req {
408 struct smb2_hdr hdr;
409 __le16 StructureSize; /* Must be 9 */
410 __le16 Reserved; /* Flags in SMB3.1.1 */
411 __le16 PathOffset;
412 __le16 PathLength;
413 __u8 Buffer[1]; /* variable length */
414} __packed;
415
416struct smb2_tree_connect_rsp {
417 struct smb2_hdr hdr;
418 __le16 StructureSize; /* Must be 16 */
419 __u8 ShareType; /* see below */
420 __u8 Reserved;
421 __le32 ShareFlags; /* see below */
422 __le32 Capabilities; /* see below */
423 __le32 MaximalAccess;
424} __packed;
425
426/* Possible ShareType values */
427#define SMB2_SHARE_TYPE_DISK 0x01
428#define SMB2_SHARE_TYPE_PIPE 0x02
429#define SMB2_SHARE_TYPE_PRINT 0x03
430
431/*
432 * Possible ShareFlags - exactly one and only one of the first 4 caching flags
433 * must be set (any of the remaining, SHI1005, flags may be set individually
434 * or in combination.
435 */
436#define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000
437#define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010
438#define SMB2_SHAREFLAG_VDO_CACHING 0x00000020
439#define SMB2_SHAREFLAG_NO_CACHING 0x00000030
440#define SHI1005_FLAGS_DFS 0x00000001
441#define SHI1005_FLAGS_DFS_ROOT 0x00000002
442#define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100
443#define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200
444#define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400
445#define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800
446#define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000
447#define SHI1005_FLAGS_ENABLE_HASH 0x00002000
448
449/* Possible share capabilities */
450#define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008)
451
452struct smb2_tree_disconnect_req {
453 struct smb2_hdr hdr;
454 __le16 StructureSize; /* Must be 4 */
455 __le16 Reserved;
456} __packed;
457
458struct smb2_tree_disconnect_rsp {
459 struct smb2_hdr hdr;
460 __le16 StructureSize; /* Must be 4 */
461 __le16 Reserved;
462} __packed;
463
464#define ATTR_READONLY_LE cpu_to_le32(ATTR_READONLY)
465#define ATTR_HIDDEN_LE cpu_to_le32(ATTR_HIDDEN)
466#define ATTR_SYSTEM_LE cpu_to_le32(ATTR_SYSTEM)
467#define ATTR_DIRECTORY_LE cpu_to_le32(ATTR_DIRECTORY)
468#define ATTR_ARCHIVE_LE cpu_to_le32(ATTR_ARCHIVE)
469#define ATTR_NORMAL_LE cpu_to_le32(ATTR_NORMAL)
470#define ATTR_TEMPORARY_LE cpu_to_le32(ATTR_TEMPORARY)
471#define ATTR_SPARSE_FILE_LE cpu_to_le32(ATTR_SPARSE)
472#define ATTR_REPARSE_POINT_LE cpu_to_le32(ATTR_REPARSE)
473#define ATTR_COMPRESSED_LE cpu_to_le32(ATTR_COMPRESSED)
474#define ATTR_OFFLINE_LE cpu_to_le32(ATTR_OFFLINE)
475#define ATTR_NOT_CONTENT_INDEXED_LE cpu_to_le32(ATTR_NOT_CONTENT_INDEXED)
476#define ATTR_ENCRYPTED_LE cpu_to_le32(ATTR_ENCRYPTED)
477#define ATTR_INTEGRITY_STREAML_LE cpu_to_le32(0x00008000)
478#define ATTR_NO_SCRUB_DATA_LE cpu_to_le32(0x00020000)
479#define ATTR_MASK_LE cpu_to_le32(0x00007FB7)
480
481/* Oplock levels */
482#define SMB2_OPLOCK_LEVEL_NONE 0x00
483#define SMB2_OPLOCK_LEVEL_II 0x01
484#define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08
485#define SMB2_OPLOCK_LEVEL_BATCH 0x09
486#define SMB2_OPLOCK_LEVEL_LEASE 0xFF
487/* Non-spec internal type */
488#define SMB2_OPLOCK_LEVEL_NOCHANGE 0x99
489
490/* Desired Access Flags */
491#define FILE_READ_DATA_LE cpu_to_le32(0x00000001)
492#define FILE_LIST_DIRECTORY_LE cpu_to_le32(0x00000001)
493#define FILE_WRITE_DATA_LE cpu_to_le32(0x00000002)
494#define FILE_ADD_FILE_LE cpu_to_le32(0x00000002)
495#define FILE_APPEND_DATA_LE cpu_to_le32(0x00000004)
496#define FILE_ADD_SUBDIRECTORY_LE cpu_to_le32(0x00000004)
497#define FILE_READ_EA_LE cpu_to_le32(0x00000008)
498#define FILE_WRITE_EA_LE cpu_to_le32(0x00000010)
499#define FILE_EXECUTE_LE cpu_to_le32(0x00000020)
500#define FILE_TRAVERSE_LE cpu_to_le32(0x00000020)
501#define FILE_DELETE_CHILD_LE cpu_to_le32(0x00000040)
502#define FILE_READ_ATTRIBUTES_LE cpu_to_le32(0x00000080)
503#define FILE_WRITE_ATTRIBUTES_LE cpu_to_le32(0x00000100)
504#define FILE_DELETE_LE cpu_to_le32(0x00010000)
505#define FILE_READ_CONTROL_LE cpu_to_le32(0x00020000)
506#define FILE_WRITE_DAC_LE cpu_to_le32(0x00040000)
507#define FILE_WRITE_OWNER_LE cpu_to_le32(0x00080000)
508#define FILE_SYNCHRONIZE_LE cpu_to_le32(0x00100000)
509#define FILE_ACCESS_SYSTEM_SECURITY_LE cpu_to_le32(0x01000000)
510#define FILE_MAXIMAL_ACCESS_LE cpu_to_le32(0x02000000)
511#define FILE_GENERIC_ALL_LE cpu_to_le32(0x10000000)
512#define FILE_GENERIC_EXECUTE_LE cpu_to_le32(0x20000000)
513#define FILE_GENERIC_WRITE_LE cpu_to_le32(0x40000000)
514#define FILE_GENERIC_READ_LE cpu_to_le32(0x80000000)
515#define DESIRED_ACCESS_MASK cpu_to_le32(0xF21F01FF)
516
517/* ShareAccess Flags */
518#define FILE_SHARE_READ_LE cpu_to_le32(0x00000001)
519#define FILE_SHARE_WRITE_LE cpu_to_le32(0x00000002)
520#define FILE_SHARE_DELETE_LE cpu_to_le32(0x00000004)
521#define FILE_SHARE_ALL_LE cpu_to_le32(0x00000007)
522
523/* CreateDisposition Flags */
524#define FILE_SUPERSEDE_LE cpu_to_le32(0x00000000)
525#define FILE_OPEN_LE cpu_to_le32(0x00000001)
526#define FILE_CREATE_LE cpu_to_le32(0x00000002)
527#define FILE_OPEN_IF_LE cpu_to_le32(0x00000003)
528#define FILE_OVERWRITE_LE cpu_to_le32(0x00000004)
529#define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005)
530#define FILE_CREATE_MASK_LE cpu_to_le32(0x00000007)
531
532#define FILE_READ_DESIRED_ACCESS_LE (FILE_READ_DATA_LE | \
533 FILE_READ_EA_LE | \
534 FILE_GENERIC_READ_LE)
535#define FILE_WRITE_DESIRE_ACCESS_LE (FILE_WRITE_DATA_LE | \
536 FILE_APPEND_DATA_LE | \
537 FILE_WRITE_EA_LE | \
538 FILE_WRITE_ATTRIBUTES_LE | \
539 FILE_GENERIC_WRITE_LE)
540
541/* Impersonation Levels */
542#define IL_ANONYMOUS_LE cpu_to_le32(0x00000000)
543#define IL_IDENTIFICATION_LE cpu_to_le32(0x00000001)
544#define IL_IMPERSONATION_LE cpu_to_le32(0x00000002)
545#define IL_DELEGATE_LE cpu_to_le32(0x00000003)
546
547/* Create Context Values */
548#define SMB2_CREATE_EA_BUFFER "ExtA" /* extended attributes */
549#define SMB2_CREATE_SD_BUFFER "SecD" /* security descriptor */
550#define SMB2_CREATE_DURABLE_HANDLE_REQUEST "DHnQ"
551#define SMB2_CREATE_DURABLE_HANDLE_RECONNECT "DHnC"
552#define SMB2_CREATE_ALLOCATION_SIZE "AlSi"
553#define SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST "MxAc"
554#define SMB2_CREATE_TIMEWARP_REQUEST "TWrp"
555#define SMB2_CREATE_QUERY_ON_DISK_ID "QFid"
556#define SMB2_CREATE_REQUEST_LEASE "RqLs"
557#define SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 "DH2Q"
558#define SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 "DH2C"
559#define SMB2_CREATE_APP_INSTANCE_ID "\x45\xBC\xA6\x6A\xEF\xA7\xF7\x4A\x90\x08\xFA\x46\x2E\x14\x4D\x74"
560 #define SMB2_CREATE_APP_INSTANCE_VERSION "\xB9\x82\xD0\xB7\x3B\x56\x07\x4F\xA0\x7B\x52\x4A\x81\x16\xA0\x10"
561#define SVHDX_OPEN_DEVICE_CONTEXT 0x83CE6F1AD851E0986E34401CC9BCFCE9
562#define SMB2_CREATE_TAG_POSIX "\x93\xAD\x25\x50\x9C\xB4\x11\xE7\xB4\x23\x83\xDE\x96\x8B\xCD\x7C"
563
564struct smb2_create_req {
565 struct smb2_hdr hdr;
566 __le16 StructureSize; /* Must be 57 */
567 __u8 SecurityFlags;
568 __u8 RequestedOplockLevel;
569 __le32 ImpersonationLevel;
570 __le64 SmbCreateFlags;
571 __le64 Reserved;
572 __le32 DesiredAccess;
573 __le32 FileAttributes;
574 __le32 ShareAccess;
575 __le32 CreateDisposition;
576 __le32 CreateOptions;
577 __le16 NameOffset;
578 __le16 NameLength;
579 __le32 CreateContextsOffset;
580 __le32 CreateContextsLength;
581 __u8 Buffer[0];
582} __packed;
583
584struct smb2_create_rsp {
585 struct smb2_hdr hdr;
586 __le16 StructureSize; /* Must be 89 */
587 __u8 OplockLevel;
588 __u8 Reserved;
589 __le32 CreateAction;
590 __le64 CreationTime;
591 __le64 LastAccessTime;
592 __le64 LastWriteTime;
593 __le64 ChangeTime;
594 __le64 AllocationSize;
595 __le64 EndofFile;
596 __le32 FileAttributes;
597 __le32 Reserved2;
598 __le64 PersistentFileId;
599 __le64 VolatileFileId;
600 __le32 CreateContextsOffset;
601 __le32 CreateContextsLength;
602 __u8 Buffer[1];
603} __packed;
604
605struct create_context {
606 __le32 Next;
607 __le16 NameOffset;
608 __le16 NameLength;
609 __le16 Reserved;
610 __le16 DataOffset;
611 __le32 DataLength;
612 __u8 Buffer[0];
613} __packed;
614
615struct create_durable_req_v2 {
616 struct create_context ccontext;
617 __u8 Name[8];
618 __le32 Timeout;
619 __le32 Flags;
620 __u8 Reserved[8];
621 __u8 CreateGuid[16];
622} __packed;
623
624struct create_durable_reconn_req {
625 struct create_context ccontext;
626 __u8 Name[8];
627 union {
628 __u8 Reserved[16];
629 struct {
630 __le64 PersistentFileId;
631 __le64 VolatileFileId;
632 } Fid;
633 } Data;
634} __packed;
635
636struct create_durable_reconn_v2_req {
637 struct create_context ccontext;
638 __u8 Name[8];
639 struct {
640 __le64 PersistentFileId;
641 __le64 VolatileFileId;
642 } Fid;
643 __u8 CreateGuid[16];
644 __le32 Flags;
645} __packed;
646
647struct create_app_inst_id {
648 struct create_context ccontext;
649 __u8 Name[8];
650 __u8 Reserved[8];
651 __u8 AppInstanceId[16];
652} __packed;
653
654struct create_app_inst_id_vers {
655 struct create_context ccontext;
656 __u8 Name[8];
657 __u8 Reserved[2];
658 __u8 Padding[4];
659 __le64 AppInstanceVersionHigh;
660 __le64 AppInstanceVersionLow;
661} __packed;
662
663struct create_mxac_req {
664 struct create_context ccontext;
665 __u8 Name[8];
666 __le64 Timestamp;
667} __packed;
668
669struct create_alloc_size_req {
670 struct create_context ccontext;
671 __u8 Name[8];
672 __le64 AllocationSize;
673} __packed;
674
675struct create_posix {
676 struct create_context ccontext;
677 __u8 Name[16];
678 __le32 Mode;
679 __u32 Reserved;
680} __packed;
681
682struct create_durable_rsp {
683 struct create_context ccontext;
684 __u8 Name[8];
685 union {
686 __u8 Reserved[8];
687 __u64 data;
688 } Data;
689} __packed;
690
691struct create_durable_v2_rsp {
692 struct create_context ccontext;
693 __u8 Name[8];
694 __le32 Timeout;
695 __le32 Flags;
696} __packed;
697
698struct create_mxac_rsp {
699 struct create_context ccontext;
700 __u8 Name[8];
701 __le32 QueryStatus;
702 __le32 MaximalAccess;
703} __packed;
704
705struct create_disk_id_rsp {
706 struct create_context ccontext;
707 __u8 Name[8];
708 __le64 DiskFileId;
709 __le64 VolumeId;
710 __u8 Reserved[16];
711} __packed;
712
713/* equivalent of the contents of SMB3.1.1 POSIX open context response */
714struct create_posix_rsp {
715 struct create_context ccontext;
716 __u8 Name[16];
717 __le32 nlink;
718 __le32 reparse_tag;
719 __le32 mode;
720 u8 SidBuffer[40];
721} __packed;
722
723#define SMB2_LEASE_NONE_LE cpu_to_le32(0x00)
724#define SMB2_LEASE_READ_CACHING_LE cpu_to_le32(0x01)
725#define SMB2_LEASE_HANDLE_CACHING_LE cpu_to_le32(0x02)
726#define SMB2_LEASE_WRITE_CACHING_LE cpu_to_le32(0x04)
727
728#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE cpu_to_le32(0x02)
729
730struct lease_context {
731 __le64 LeaseKeyLow;
732 __le64 LeaseKeyHigh;
733 __le32 LeaseState;
734 __le32 LeaseFlags;
735 __le64 LeaseDuration;
736} __packed;
737
738struct create_lease {
739 struct create_context ccontext;
740 __u8 Name[8];
741 struct lease_context lcontext;
742} __packed;
743
744/* Currently defined values for close flags */
745#define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001)
746struct smb2_close_req {
747 struct smb2_hdr hdr;
748 __le16 StructureSize; /* Must be 24 */
749 __le16 Flags;
750 __le32 Reserved;
751 __le64 PersistentFileId;
752 __le64 VolatileFileId;
753} __packed;
754
755struct smb2_close_rsp {
756 struct smb2_hdr hdr;
757 __le16 StructureSize; /* 60 */
758 __le16 Flags;
759 __le32 Reserved;
760 __le64 CreationTime;
761 __le64 LastAccessTime;
762 __le64 LastWriteTime;
763 __le64 ChangeTime;
764 __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
765 __le64 EndOfFile;
766 __le32 Attributes;
767} __packed;
768
769struct smb2_flush_req {
770 struct smb2_hdr hdr;
771 __le16 StructureSize; /* Must be 24 */
772 __le16 Reserved1;
773 __le32 Reserved2;
774 __le64 PersistentFileId;
775 __le64 VolatileFileId;
776} __packed;
777
778struct smb2_flush_rsp {
779 struct smb2_hdr hdr;
780 __le16 StructureSize;
781 __le16 Reserved;
782} __packed;
783
784struct smb2_buffer_desc_v1 {
785 __le64 offset;
786 __le32 token;
787 __le32 length;
788} __packed;
789
790#define SMB2_CHANNEL_NONE cpu_to_le32(0x00000000)
791#define SMB2_CHANNEL_RDMA_V1 cpu_to_le32(0x00000001)
792#define SMB2_CHANNEL_RDMA_V1_INVALIDATE cpu_to_le32(0x00000002)
793
794struct smb2_read_req {
795 struct smb2_hdr hdr;
796 __le16 StructureSize; /* Must be 49 */
797 __u8 Padding; /* offset from start of SMB2 header to place read */
798 __u8 Reserved;
799 __le32 Length;
800 __le64 Offset;
801 __le64 PersistentFileId;
802 __le64 VolatileFileId;
803 __le32 MinimumCount;
804 __le32 Channel; /* Reserved MBZ */
805 __le32 RemainingBytes;
806 __le16 ReadChannelInfoOffset; /* Reserved MBZ */
807 __le16 ReadChannelInfoLength; /* Reserved MBZ */
808 __u8 Buffer[1];
809} __packed;
810
811struct smb2_read_rsp {
812 struct smb2_hdr hdr;
813 __le16 StructureSize; /* Must be 17 */
814 __u8 DataOffset;
815 __u8 Reserved;
816 __le32 DataLength;
817 __le32 DataRemaining;
818 __u32 Reserved2;
819 __u8 Buffer[1];
820} __packed;
821
822/* For write request Flags field below the following flag is defined: */
823#define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001
824
825struct smb2_write_req {
826 struct smb2_hdr hdr;
827 __le16 StructureSize; /* Must be 49 */
828 __le16 DataOffset; /* offset from start of SMB2 header to write data */
829 __le32 Length;
830 __le64 Offset;
831 __le64 PersistentFileId;
832 __le64 VolatileFileId;
833 __le32 Channel; /* Reserved MBZ */
834 __le32 RemainingBytes;
835 __le16 WriteChannelInfoOffset; /* Reserved MBZ */
836 __le16 WriteChannelInfoLength; /* Reserved MBZ */
837 __le32 Flags;
838 __u8 Buffer[1];
839} __packed;
840
841struct smb2_write_rsp {
842 struct smb2_hdr hdr;
843 __le16 StructureSize; /* Must be 17 */
844 __u8 DataOffset;
845 __u8 Reserved;
846 __le32 DataLength;
847 __le32 DataRemaining;
848 __u32 Reserved2;
849 __u8 Buffer[1];
850} __packed;
851
852#define SMB2_0_IOCTL_IS_FSCTL 0x00000001
853
854struct smb2_ioctl_req {
855 struct smb2_hdr hdr;
856 __le16 StructureSize; /* Must be 57 */
857 __le16 Reserved; /* offset from start of SMB2 header to write data */
858 __le32 CntCode;
859 __le64 PersistentFileId;
860 __le64 VolatileFileId;
861 __le32 InputOffset; /* Reserved MBZ */
862 __le32 InputCount;
863 __le32 MaxInputResponse;
864 __le32 OutputOffset;
865 __le32 OutputCount;
866 __le32 MaxOutputResponse;
867 __le32 Flags;
868 __le32 Reserved2;
869 __u8 Buffer[1];
870} __packed;
871
872struct smb2_ioctl_rsp {
873 struct smb2_hdr hdr;
874 __le16 StructureSize; /* Must be 49 */
875 __le16 Reserved; /* offset from start of SMB2 header to write data */
876 __le32 CntCode;
877 __le64 PersistentFileId;
878 __le64 VolatileFileId;
879 __le32 InputOffset; /* Reserved MBZ */
880 __le32 InputCount;
881 __le32 OutputOffset;
882 __le32 OutputCount;
883 __le32 Flags;
884 __le32 Reserved2;
885 __u8 Buffer[1];
886} __packed;
887
888struct validate_negotiate_info_req {
889 __le32 Capabilities;
890 __u8 Guid[SMB2_CLIENT_GUID_SIZE];
891 __le16 SecurityMode;
892 __le16 DialectCount;
893 __le16 Dialects[1]; /* dialect (someday maybe list) client asked for */
894} __packed;
895
896struct validate_negotiate_info_rsp {
897 __le32 Capabilities;
898 __u8 Guid[SMB2_CLIENT_GUID_SIZE];
899 __le16 SecurityMode;
900 __le16 Dialect; /* Dialect in use for the connection */
901} __packed;
902
903struct smb_sockaddr_in {
904 __be16 Port;
905 __be32 IPv4address;
906 __u8 Reserved[8];
907} __packed;
908
909struct smb_sockaddr_in6 {
910 __be16 Port;
911 __be32 FlowInfo;
912 __u8 IPv6address[16];
913 __be32 ScopeId;
914} __packed;
915
916#define INTERNETWORK 0x0002
917#define INTERNETWORKV6 0x0017
918
919struct sockaddr_storage_rsp {
920 __le16 Family;
921 union {
922 struct smb_sockaddr_in addr4;
923 struct smb_sockaddr_in6 addr6;
924 };
925} __packed;
926
927#define RSS_CAPABLE 0x00000001
928#define RDMA_CAPABLE 0x00000002
929
930struct network_interface_info_ioctl_rsp {
931 __le32 Next; /* next interface. zero if this is last one */
932 __le32 IfIndex;
933 __le32 Capability; /* RSS or RDMA Capable */
934 __le32 Reserved;
935 __le64 LinkSpeed;
936 char SockAddr_Storage[128];
937} __packed;
938
939struct file_object_buf_type1_ioctl_rsp {
940 __u8 ObjectId[16];
941 __u8 BirthVolumeId[16];
942 __u8 BirthObjectId[16];
943 __u8 DomainId[16];
944} __packed;
945
946struct resume_key_ioctl_rsp {
947 __le64 ResumeKey[3];
948 __le32 ContextLength;
949 __u8 Context[4]; /* ignored, Windows sets to 4 bytes of zero */
950} __packed;
951
952struct copychunk_ioctl_req {
953 __le64 ResumeKey[3];
954 __le32 ChunkCount;
955 __le32 Reserved;
956 __u8 Chunks[1]; /* array of srv_copychunk */
957} __packed;
958
959struct srv_copychunk {
960 __le64 SourceOffset;
961 __le64 TargetOffset;
962 __le32 Length;
963 __le32 Reserved;
964} __packed;
965
966struct copychunk_ioctl_rsp {
967 __le32 ChunksWritten;
968 __le32 ChunkBytesWritten;
969 __le32 TotalBytesWritten;
970} __packed;
971
972struct file_sparse {
973 __u8 SetSparse;
974} __packed;
975
976struct file_zero_data_information {
977 __le64 FileOffset;
978 __le64 BeyondFinalZero;
979} __packed;
980
981struct file_allocated_range_buffer {
982 __le64 file_offset;
983 __le64 length;
984} __packed;
985
986struct reparse_data_buffer {
987 __le32 ReparseTag;
988 __le16 ReparseDataLength;
989 __u16 Reserved;
990 __u8 DataBuffer[]; /* Variable Length */
991} __packed;
992
993/* Completion Filter flags for Notify */
994#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
995#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
996#define FILE_NOTIFY_CHANGE_NAME 0x00000003
997#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
998#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
999#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
1000#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
1001#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
1002#define FILE_NOTIFY_CHANGE_EA 0x00000080
1003#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
1004#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
1005#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
1006#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
1007
1008/* Flags */
1009#define SMB2_WATCH_TREE 0x0001
1010
1011struct smb2_notify_req {
1012 struct smb2_hdr hdr;
1013 __le16 StructureSize; /* Must be 32 */
1014 __le16 Flags;
1015 __le32 OutputBufferLength;
1016 __le64 PersistentFileId;
1017 __le64 VolatileFileId;
1018 __u32 CompletionFileter;
1019 __u32 Reserved;
1020} __packed;
1021
1022struct smb2_notify_rsp {
1023 struct smb2_hdr hdr;
1024 __le16 StructureSize; /* Must be 9 */
1025 __le16 OutputBufferOffset;
1026 __le32 OutputBufferLength;
1027 __u8 Buffer[1];
1028} __packed;
1029
1030/* SMB2 Notify Action Flags */
1031#define FILE_ACTION_ADDED 0x00000001
1032#define FILE_ACTION_REMOVED 0x00000002
1033#define FILE_ACTION_MODIFIED 0x00000003
1034#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
1035#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
1036#define FILE_ACTION_ADDED_STREAM 0x00000006
1037#define FILE_ACTION_REMOVED_STREAM 0x00000007
1038#define FILE_ACTION_MODIFIED_STREAM 0x00000008
1039#define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
1040
1041#define SMB2_LOCKFLAG_SHARED 0x0001
1042#define SMB2_LOCKFLAG_EXCLUSIVE 0x0002
1043#define SMB2_LOCKFLAG_UNLOCK 0x0004
1044#define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010
1045#define SMB2_LOCKFLAG_MASK 0x0007
1046
1047struct smb2_lock_element {
1048 __le64 Offset;
1049 __le64 Length;
1050 __le32 Flags;
1051 __le32 Reserved;
1052} __packed;
1053
1054struct smb2_lock_req {
1055 struct smb2_hdr hdr;
1056 __le16 StructureSize; /* Must be 48 */
1057 __le16 LockCount;
1058 __le32 Reserved;
1059 __le64 PersistentFileId;
1060 __le64 VolatileFileId;
1061 /* Followed by at least one */
1062 struct smb2_lock_element locks[1];
1063} __packed;
1064
1065struct smb2_lock_rsp {
1066 struct smb2_hdr hdr;
1067 __le16 StructureSize; /* Must be 4 */
1068 __le16 Reserved;
1069} __packed;
1070
1071struct smb2_echo_req {
1072 struct smb2_hdr hdr;
1073 __le16 StructureSize; /* Must be 4 */
1074 __u16 Reserved;
1075} __packed;
1076
1077struct smb2_echo_rsp {
1078 struct smb2_hdr hdr;
1079 __le16 StructureSize; /* Must be 4 */
1080 __u16 Reserved;
1081} __packed;
1082
1083/* search (query_directory) Flags field */
1084#define SMB2_RESTART_SCANS 0x01
1085#define SMB2_RETURN_SINGLE_ENTRY 0x02
1086#define SMB2_INDEX_SPECIFIED 0x04
1087#define SMB2_REOPEN 0x10
1088
1089struct smb2_query_directory_req {
1090 struct smb2_hdr hdr;
1091 __le16 StructureSize; /* Must be 33 */
1092 __u8 FileInformationClass;
1093 __u8 Flags;
1094 __le32 FileIndex;
1095 __le64 PersistentFileId;
1096 __le64 VolatileFileId;
1097 __le16 FileNameOffset;
1098 __le16 FileNameLength;
1099 __le32 OutputBufferLength;
1100 __u8 Buffer[1];
1101} __packed;
1102
1103struct smb2_query_directory_rsp {
1104 struct smb2_hdr hdr;
1105 __le16 StructureSize; /* Must be 9 */
1106 __le16 OutputBufferOffset;
1107 __le32 OutputBufferLength;
1108 __u8 Buffer[1];
1109} __packed;
1110
1111/* Possible InfoType values */
1112#define SMB2_O_INFO_FILE 0x01
1113#define SMB2_O_INFO_FILESYSTEM 0x02
1114#define SMB2_O_INFO_SECURITY 0x03
1115#define SMB2_O_INFO_QUOTA 0x04
1116
1117/* Security info type additionalinfo flags. See MS-SMB2 (2.2.37) or MS-DTYP */
1118#define OWNER_SECINFO 0x00000001
1119#define GROUP_SECINFO 0x00000002
1120#define DACL_SECINFO 0x00000004
1121#define SACL_SECINFO 0x00000008
1122#define LABEL_SECINFO 0x00000010
1123#define ATTRIBUTE_SECINFO 0x00000020
1124#define SCOPE_SECINFO 0x00000040
1125#define BACKUP_SECINFO 0x00010000
1126#define UNPROTECTED_SACL_SECINFO 0x10000000
1127#define UNPROTECTED_DACL_SECINFO 0x20000000
1128#define PROTECTED_SACL_SECINFO 0x40000000
1129#define PROTECTED_DACL_SECINFO 0x80000000
1130
1131struct smb2_query_info_req {
1132 struct smb2_hdr hdr;
1133 __le16 StructureSize; /* Must be 41 */
1134 __u8 InfoType;
1135 __u8 FileInfoClass;
1136 __le32 OutputBufferLength;
1137 __le16 InputBufferOffset;
1138 __u16 Reserved;
1139 __le32 InputBufferLength;
1140 __le32 AdditionalInformation;
1141 __le32 Flags;
1142 __le64 PersistentFileId;
1143 __le64 VolatileFileId;
1144 __u8 Buffer[1];
1145} __packed;
1146
1147struct smb2_query_info_rsp {
1148 struct smb2_hdr hdr;
1149 __le16 StructureSize; /* Must be 9 */
1150 __le16 OutputBufferOffset;
1151 __le32 OutputBufferLength;
1152 __u8 Buffer[1];
1153} __packed;
1154
1155struct smb2_set_info_req {
1156 struct smb2_hdr hdr;
1157 __le16 StructureSize; /* Must be 33 */
1158 __u8 InfoType;
1159 __u8 FileInfoClass;
1160 __le32 BufferLength;
1161 __le16 BufferOffset;
1162 __u16 Reserved;
1163 __le32 AdditionalInformation;
1164 __le64 PersistentFileId;
1165 __le64 VolatileFileId;
1166 __u8 Buffer[1];
1167} __packed;
1168
1169struct smb2_set_info_rsp {
1170 struct smb2_hdr hdr;
1171 __le16 StructureSize; /* Must be 2 */
1172} __packed;
1173
Namjae Jeone2f34482021-03-16 10:49:09 +09001174/* FILE Info response size */
1175#define FILE_DIRECTORY_INFORMATION_SIZE 1
1176#define FILE_FULL_DIRECTORY_INFORMATION_SIZE 2
1177#define FILE_BOTH_DIRECTORY_INFORMATION_SIZE 3
1178#define FILE_BASIC_INFORMATION_SIZE 40
1179#define FILE_STANDARD_INFORMATION_SIZE 24
1180#define FILE_INTERNAL_INFORMATION_SIZE 8
1181#define FILE_EA_INFORMATION_SIZE 4
1182#define FILE_ACCESS_INFORMATION_SIZE 4
1183#define FILE_NAME_INFORMATION_SIZE 9
1184#define FILE_RENAME_INFORMATION_SIZE 10
1185#define FILE_LINK_INFORMATION_SIZE 11
1186#define FILE_NAMES_INFORMATION_SIZE 12
1187#define FILE_DISPOSITION_INFORMATION_SIZE 13
1188#define FILE_POSITION_INFORMATION_SIZE 14
1189#define FILE_FULL_EA_INFORMATION_SIZE 15
1190#define FILE_MODE_INFORMATION_SIZE 4
1191#define FILE_ALIGNMENT_INFORMATION_SIZE 4
1192#define FILE_ALL_INFORMATION_SIZE 104
1193#define FILE_ALLOCATION_INFORMATION_SIZE 19
1194#define FILE_END_OF_FILE_INFORMATION_SIZE 20
1195#define FILE_ALTERNATE_NAME_INFORMATION_SIZE 8
1196#define FILE_STREAM_INFORMATION_SIZE 32
1197#define FILE_PIPE_INFORMATION_SIZE 23
1198#define FILE_PIPE_LOCAL_INFORMATION_SIZE 24
1199#define FILE_PIPE_REMOTE_INFORMATION_SIZE 25
1200#define FILE_MAILSLOT_QUERY_INFORMATION_SIZE 26
1201#define FILE_MAILSLOT_SET_INFORMATION_SIZE 27
1202#define FILE_COMPRESSION_INFORMATION_SIZE 16
1203#define FILE_OBJECT_ID_INFORMATION_SIZE 29
1204/* Number 30 not defined in documents */
1205#define FILE_MOVE_CLUSTER_INFORMATION_SIZE 31
1206#define FILE_QUOTA_INFORMATION_SIZE 32
1207#define FILE_REPARSE_POINT_INFORMATION_SIZE 33
1208#define FILE_NETWORK_OPEN_INFORMATION_SIZE 56
1209#define FILE_ATTRIBUTE_TAG_INFORMATION_SIZE 8
1210
Namjae Jeone2f34482021-03-16 10:49:09 +09001211/* FS Info response size */
1212#define FS_DEVICE_INFORMATION_SIZE 8
1213#define FS_ATTRIBUTE_INFORMATION_SIZE 16
1214#define FS_VOLUME_INFORMATION_SIZE 24
1215#define FS_SIZE_INFORMATION_SIZE 24
1216#define FS_FULL_SIZE_INFORMATION_SIZE 32
1217#define FS_SECTOR_SIZE_INFORMATION_SIZE 28
1218#define FS_OBJECT_ID_INFORMATION_SIZE 64
1219#define FS_CONTROL_INFORMATION_SIZE 48
1220#define FS_POSIX_INFORMATION_SIZE 56
1221
1222/* FS_ATTRIBUTE_File_System_Name */
1223#define FS_TYPE_SUPPORT_SIZE 44
1224struct fs_type_info {
1225 char *fs_name;
1226 long magic_number;
1227} __packed;
1228
1229struct smb2_oplock_break {
1230 struct smb2_hdr hdr;
1231 __le16 StructureSize; /* Must be 24 */
1232 __u8 OplockLevel;
1233 __u8 Reserved;
1234 __le32 Reserved2;
1235 __le64 PersistentFid;
1236 __le64 VolatileFid;
1237} __packed;
1238
1239#define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED cpu_to_le32(0x01)
1240
1241struct smb2_lease_break {
1242 struct smb2_hdr hdr;
1243 __le16 StructureSize; /* Must be 44 */
1244 __le16 Reserved;
1245 __le32 Flags;
1246 __u8 LeaseKey[16];
1247 __le32 CurrentLeaseState;
1248 __le32 NewLeaseState;
1249 __le32 BreakReason;
1250 __le32 AccessMaskHint;
1251 __le32 ShareMaskHint;
1252} __packed;
1253
1254struct smb2_lease_ack {
1255 struct smb2_hdr hdr;
1256 __le16 StructureSize; /* Must be 36 */
1257 __le16 Reserved;
1258 __le32 Flags;
1259 __u8 LeaseKey[16];
1260 __le32 LeaseState;
1261 __le64 LeaseDuration;
1262} __packed;
1263
1264/*
1265 * PDU infolevel structure definitions
1266 * BB consider moving to a different header
1267 */
1268
1269/* File System Information Classes */
1270#define FS_VOLUME_INFORMATION 1 /* Query */
1271#define FS_LABEL_INFORMATION 2 /* Set */
1272#define FS_SIZE_INFORMATION 3 /* Query */
1273#define FS_DEVICE_INFORMATION 4 /* Query */
1274#define FS_ATTRIBUTE_INFORMATION 5 /* Query */
1275#define FS_CONTROL_INFORMATION 6 /* Query, Set */
1276#define FS_FULL_SIZE_INFORMATION 7 /* Query */
1277#define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */
1278#define FS_DRIVER_PATH_INFORMATION 9 /* Query */
1279#define FS_SECTOR_SIZE_INFORMATION 11 /* SMB3 or later. Query */
1280#define FS_POSIX_INFORMATION 100 /* SMB3.1.1 POSIX. Query */
1281
1282struct smb2_fs_full_size_info {
1283 __le64 TotalAllocationUnits;
1284 __le64 CallerAvailableAllocationUnits;
1285 __le64 ActualAvailableAllocationUnits;
1286 __le32 SectorsPerAllocationUnit;
1287 __le32 BytesPerSector;
1288} __packed;
1289
1290#define SSINFO_FLAGS_ALIGNED_DEVICE 0x00000001
1291#define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002
1292#define SSINFO_FLAGS_NO_SEEK_PENALTY 0x00000004
1293#define SSINFO_FLAGS_TRIM_ENABLED 0x00000008
1294
1295/* sector size info struct */
1296struct smb3_fs_ss_info {
1297 __le32 LogicalBytesPerSector;
1298 __le32 PhysicalBytesPerSectorForAtomicity;
1299 __le32 PhysicalBytesPerSectorForPerf;
1300 __le32 FSEffPhysicalBytesPerSectorForAtomicity;
1301 __le32 Flags;
1302 __le32 ByteOffsetForSectorAlignment;
1303 __le32 ByteOffsetForPartitionAlignment;
1304} __packed;
1305
1306/* File System Control Information */
1307struct smb2_fs_control_info {
1308 __le64 FreeSpaceStartFiltering;
1309 __le64 FreeSpaceThreshold;
1310 __le64 FreeSpaceStopFiltering;
1311 __le64 DefaultQuotaThreshold;
1312 __le64 DefaultQuotaLimit;
1313 __le32 FileSystemControlFlags;
1314 __le32 Padding;
1315} __packed;
1316
1317/* partial list of QUERY INFO levels */
1318#define FILE_DIRECTORY_INFORMATION 1
1319#define FILE_FULL_DIRECTORY_INFORMATION 2
1320#define FILE_BOTH_DIRECTORY_INFORMATION 3
1321#define FILE_BASIC_INFORMATION 4
1322#define FILE_STANDARD_INFORMATION 5
1323#define FILE_INTERNAL_INFORMATION 6
1324#define FILE_EA_INFORMATION 7
1325#define FILE_ACCESS_INFORMATION 8
1326#define FILE_NAME_INFORMATION 9
1327#define FILE_RENAME_INFORMATION 10
1328#define FILE_LINK_INFORMATION 11
1329#define FILE_NAMES_INFORMATION 12
1330#define FILE_DISPOSITION_INFORMATION 13
1331#define FILE_POSITION_INFORMATION 14
1332#define FILE_FULL_EA_INFORMATION 15
1333#define FILE_MODE_INFORMATION 16
1334#define FILE_ALIGNMENT_INFORMATION 17
1335#define FILE_ALL_INFORMATION 18
1336#define FILE_ALLOCATION_INFORMATION 19
1337#define FILE_END_OF_FILE_INFORMATION 20
1338#define FILE_ALTERNATE_NAME_INFORMATION 21
1339#define FILE_STREAM_INFORMATION 22
1340#define FILE_PIPE_INFORMATION 23
1341#define FILE_PIPE_LOCAL_INFORMATION 24
1342#define FILE_PIPE_REMOTE_INFORMATION 25
1343#define FILE_MAILSLOT_QUERY_INFORMATION 26
1344#define FILE_MAILSLOT_SET_INFORMATION 27
1345#define FILE_COMPRESSION_INFORMATION 28
1346#define FILE_OBJECT_ID_INFORMATION 29
1347/* Number 30 not defined in documents */
1348#define FILE_MOVE_CLUSTER_INFORMATION 31
1349#define FILE_QUOTA_INFORMATION 32
1350#define FILE_REPARSE_POINT_INFORMATION 33
1351#define FILE_NETWORK_OPEN_INFORMATION 34
1352#define FILE_ATTRIBUTE_TAG_INFORMATION 35
1353#define FILE_TRACKING_INFORMATION 36
1354#define FILEID_BOTH_DIRECTORY_INFORMATION 37
1355#define FILEID_FULL_DIRECTORY_INFORMATION 38
1356#define FILE_VALID_DATA_LENGTH_INFORMATION 39
1357#define FILE_SHORT_NAME_INFORMATION 40
1358#define FILE_SFIO_RESERVE_INFORMATION 44
1359#define FILE_SFIO_VOLUME_INFORMATION 45
1360#define FILE_HARD_LINK_INFORMATION 46
1361#define FILE_NORMALIZED_NAME_INFORMATION 48
1362#define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50
1363#define FILE_STANDARD_LINK_INFORMATION 54
1364
1365#define OP_BREAK_STRUCT_SIZE_20 24
1366#define OP_BREAK_STRUCT_SIZE_21 36
1367
1368struct smb2_file_access_info {
1369 __le32 AccessFlags;
1370} __packed;
1371
1372struct smb2_file_alignment_info {
1373 __le32 AlignmentRequirement;
1374} __packed;
1375
1376struct smb2_file_internal_info {
1377 __le64 IndexNumber;
1378} __packed; /* level 6 Query */
1379
1380struct smb2_file_rename_info { /* encoding of request for level 10 */
1381 __u8 ReplaceIfExists; /* 1 = replace existing target with new */
1382 /* 0 = fail if target already exists */
1383 __u8 Reserved[7];
1384 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
1385 __le32 FileNameLength;
1386 char FileName[0]; /* New name to be assigned */
1387} __packed; /* level 10 Set */
1388
1389struct smb2_file_link_info { /* encoding of request for level 11 */
1390 __u8 ReplaceIfExists; /* 1 = replace existing link with new */
1391 /* 0 = fail if link already exists */
1392 __u8 Reserved[7];
1393 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
1394 __le32 FileNameLength;
1395 char FileName[0]; /* Name to be assigned to new link */
1396} __packed; /* level 11 Set */
1397
1398/*
1399 * This level 18, although with struct with same name is different from cifs
1400 * level 0x107. Level 0x107 has an extra u64 between AccessFlags and
1401 * CurrentByteOffset.
1402 */
1403struct smb2_file_all_info { /* data block encoding of response to level 18 */
1404 __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */
1405 __le64 LastAccessTime;
1406 __le64 LastWriteTime;
1407 __le64 ChangeTime;
1408 __le32 Attributes;
1409 __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */
1410 __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
1411 __le64 EndOfFile; /* size ie offset to first free byte in file */
1412 __le32 NumberOfLinks; /* hard links */
1413 __u8 DeletePending;
1414 __u8 Directory;
1415 __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */
1416 __le64 IndexNumber;
1417 __le32 EASize;
1418 __le32 AccessFlags;
1419 __le64 CurrentByteOffset;
1420 __le32 Mode;
1421 __le32 AlignmentRequirement;
1422 __le32 FileNameLength;
1423 char FileName[1];
1424} __packed; /* level 18 Query */
1425
1426struct smb2_file_alt_name_info {
1427 __le32 FileNameLength;
1428 char FileName[0];
1429} __packed;
1430
1431struct smb2_file_stream_info {
1432 __le32 NextEntryOffset;
1433 __le32 StreamNameLength;
1434 __le64 StreamSize;
1435 __le64 StreamAllocationSize;
1436 char StreamName[0];
1437} __packed;
1438
1439struct smb2_file_eof_info { /* encoding of request for level 10 */
1440 __le64 EndOfFile; /* new end of file value */
1441} __packed; /* level 20 Set */
1442
1443struct smb2_file_ntwrk_info {
1444 __le64 CreationTime;
1445 __le64 LastAccessTime;
1446 __le64 LastWriteTime;
1447 __le64 ChangeTime;
1448 __le64 AllocationSize;
1449 __le64 EndOfFile;
1450 __le32 Attributes;
1451 __le32 Reserved;
1452} __packed;
1453
1454struct smb2_file_standard_info {
1455 __le64 AllocationSize;
1456 __le64 EndOfFile;
1457 __le32 NumberOfLinks; /* hard links */
1458 __u8 DeletePending;
1459 __u8 Directory;
1460 __le16 Reserved;
1461} __packed; /* level 18 Query */
1462
1463struct smb2_file_ea_info {
1464 __le32 EASize;
1465} __packed;
1466
1467struct smb2_file_alloc_info {
1468 __le64 AllocationSize;
1469} __packed;
1470
1471struct smb2_file_disposition_info {
1472 __u8 DeletePending;
1473} __packed;
1474
1475struct smb2_file_pos_info {
1476 __le64 CurrentByteOffset;
1477} __packed;
1478
1479#define FILE_MODE_INFO_MASK cpu_to_le32(0x0000103e)
1480
1481struct smb2_file_mode_info {
1482 __le32 Mode;
1483} __packed;
1484
1485#define COMPRESSION_FORMAT_NONE 0x0000
1486#define COMPRESSION_FORMAT_LZNT1 0x0002
1487
1488struct smb2_file_comp_info {
1489 __le64 CompressedFileSize;
1490 __le16 CompressionFormat;
1491 __u8 CompressionUnitShift;
1492 __u8 ChunkShift;
1493 __u8 ClusterShift;
1494 __u8 Reserved[3];
1495} __packed;
1496
1497struct smb2_file_attr_tag_info {
1498 __le32 FileAttributes;
1499 __le32 ReparseTag;
1500} __packed;
1501
1502#define SL_RESTART_SCAN 0x00000001
1503#define SL_RETURN_SINGLE_ENTRY 0x00000002
1504#define SL_INDEX_SPECIFIED 0x00000004
1505
1506struct smb2_ea_info_req {
1507 __le32 NextEntryOffset;
1508 __u8 EaNameLength;
1509 char name[1];
1510} __packed; /* level 15 Query */
1511
1512struct smb2_ea_info {
1513 __le32 NextEntryOffset;
1514 __u8 Flags;
1515 __u8 EaNameLength;
1516 __le16 EaValueLength;
1517 char name[1];
1518 /* optionally followed by value */
1519} __packed; /* level 15 Query */
1520
1521struct create_ea_buf_req {
1522 struct create_context ccontext;
1523 __u8 Name[8];
1524 struct smb2_ea_info ea;
1525} __packed;
1526
1527struct create_sd_buf_req {
1528 struct create_context ccontext;
1529 __u8 Name[8];
1530 struct smb_ntsd ntsd;
1531} __packed;
1532
1533/* Find File infolevels */
1534#define SMB_FIND_FILE_POSIX_INFO 0x064
1535
1536/* Level 100 query info */
1537struct smb311_posix_qinfo {
1538 __le64 CreationTime;
1539 __le64 LastAccessTime;
1540 __le64 LastWriteTime;
1541 __le64 ChangeTime;
1542 __le64 EndOfFile;
1543 __le64 AllocationSize;
1544 __le32 DosAttributes;
1545 __le64 Inode;
1546 __le32 DeviceId;
1547 __le32 Zero;
1548 /* beginning of POSIX Create Context Response */
1549 __le32 HardLinks;
1550 __le32 ReparseTag;
1551 __le32 Mode;
1552 u8 Sids[];
1553 /*
1554 * var sized owner SID
1555 * var sized group SID
1556 * le32 filenamelength
1557 * u8 filename[]
1558 */
1559} __packed;
1560
1561struct smb2_posix_info {
1562 __le32 NextEntryOffset;
1563 __u32 Ignored;
1564 __le64 CreationTime;
1565 __le64 LastAccessTime;
1566 __le64 LastWriteTime;
1567 __le64 ChangeTime;
1568 __le64 EndOfFile;
1569 __le64 AllocationSize;
1570 __le32 DosAttributes;
1571 __le64 Inode;
1572 __le32 DeviceId;
1573 __le32 Zero;
1574 /* beginning of POSIX Create Context Response */
1575 __le32 HardLinks;
1576 __le32 ReparseTag;
1577 __le32 Mode;
1578 u8 SidBuffer[40];
1579 __le32 name_len;
1580 u8 name[1];
1581 /*
1582 * var sized owner SID
1583 * var sized group SID
1584 * le32 filenamelength
1585 * u8 filename[]
1586 */
1587} __packed;
1588
1589/* functions */
Namjae Jeon64b39f42021-03-30 14:25:35 +09001590int init_smb2_0_server(struct ksmbd_conn *conn);
1591void init_smb2_1_server(struct ksmbd_conn *conn);
1592void init_smb3_0_server(struct ksmbd_conn *conn);
1593void init_smb3_02_server(struct ksmbd_conn *conn);
1594int init_smb3_11_server(struct ksmbd_conn *conn);
Namjae Jeone2f34482021-03-16 10:49:09 +09001595
Namjae Jeon64b39f42021-03-30 14:25:35 +09001596void init_smb2_max_read_size(unsigned int sz);
1597void init_smb2_max_write_size(unsigned int sz);
1598void init_smb2_max_trans_size(unsigned int sz);
Namjae Jeone2f34482021-03-16 10:49:09 +09001599
Namjae Jeon64b39f42021-03-30 14:25:35 +09001600int is_smb2_neg_cmd(struct ksmbd_work *work);
1601int is_smb2_rsp(struct ksmbd_work *work);
Namjae Jeone2f34482021-03-16 10:49:09 +09001602
Namjae Jeon64b39f42021-03-30 14:25:35 +09001603u16 get_smb2_cmd_val(struct ksmbd_work *work);
1604void set_smb2_rsp_status(struct ksmbd_work *work, __le32 err);
1605int init_smb2_rsp_hdr(struct ksmbd_work *work);
1606int smb2_allocate_rsp_buf(struct ksmbd_work *work);
1607bool is_chained_smb2_message(struct ksmbd_work *work);
1608int init_smb2_neg_rsp(struct ksmbd_work *work);
1609void smb2_set_err_rsp(struct ksmbd_work *work);
1610int smb2_check_user_session(struct ksmbd_work *work);
1611int smb2_get_ksmbd_tcon(struct ksmbd_work *work);
1612bool smb2_is_sign_req(struct ksmbd_work *work, unsigned int command);
1613int smb2_check_sign_req(struct ksmbd_work *work);
1614void smb2_set_sign_rsp(struct ksmbd_work *work);
1615int smb3_check_sign_req(struct ksmbd_work *work);
1616void smb3_set_sign_rsp(struct ksmbd_work *work);
1617int find_matching_smb2_dialect(int start_index, __le16 *cli_dialects,
1618 __le16 dialects_count);
1619struct file_lock *smb_flock_init(struct file *f);
1620int setup_async_work(struct ksmbd_work *work, void (*fn)(void **),
1621 void **arg);
1622void smb2_send_interim_resp(struct ksmbd_work *work, __le32 status);
1623struct channel *lookup_chann_list(struct ksmbd_session *sess);
1624void smb3_preauth_hash_rsp(struct ksmbd_work *work);
1625int smb3_is_transform_hdr(void *buf);
1626int smb3_decrypt_req(struct ksmbd_work *work);
1627int smb3_encrypt_resp(struct ksmbd_work *work);
1628bool smb3_11_final_sess_setup_resp(struct ksmbd_work *work);
1629int smb2_set_rsp_credits(struct ksmbd_work *work);
Namjae Jeone2f34482021-03-16 10:49:09 +09001630
1631/* smb2 misc functions */
Namjae Jeon64b39f42021-03-30 14:25:35 +09001632int ksmbd_smb2_check_message(struct ksmbd_work *work);
Namjae Jeone2f34482021-03-16 10:49:09 +09001633
1634/* smb2 command handlers */
Namjae Jeon64b39f42021-03-30 14:25:35 +09001635int smb2_handle_negotiate(struct ksmbd_work *work);
1636int smb2_negotiate_request(struct ksmbd_work *work);
1637int smb2_sess_setup(struct ksmbd_work *work);
1638int smb2_tree_connect(struct ksmbd_work *work);
1639int smb2_tree_disconnect(struct ksmbd_work *work);
1640int smb2_session_logoff(struct ksmbd_work *work);
1641int smb2_open(struct ksmbd_work *work);
1642int smb2_query_info(struct ksmbd_work *work);
1643int smb2_query_dir(struct ksmbd_work *work);
1644int smb2_close(struct ksmbd_work *work);
1645int smb2_echo(struct ksmbd_work *work);
1646int smb2_set_info(struct ksmbd_work *work);
1647int smb2_read(struct ksmbd_work *work);
1648int smb2_write(struct ksmbd_work *work);
1649int smb2_flush(struct ksmbd_work *work);
1650int smb2_cancel(struct ksmbd_work *work);
1651int smb2_lock(struct ksmbd_work *work);
1652int smb2_ioctl(struct ksmbd_work *work);
1653int smb2_oplock_break(struct ksmbd_work *work);
1654int smb2_notify(struct ksmbd_work *ksmbd_work);
Namjae Jeone2f34482021-03-16 10:49:09 +09001655
1656#endif /* _SMB2PDU_H */