Linux-CIFS Archive on lore.kernel.org
 help / color / Atom feed
* [SMB3] New compression flags
@ 2020-03-15 22:50 Steve French
  2020-03-15 23:07 ` Steve French
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Steve French @ 2020-03-15 22:50 UTC (permalink / raw)
  To: CIFS, samba-technical

[-- Attachment #1: Type: text/plain, Size: 96 bytes --]

Some compression related flags I noticed were added in the latest MS-SMB2



-- 
Thanks,

Steve

[-- Attachment #2: 0001-SMB3-Add-new-compression-flags.patch --]
[-- Type: text/x-patch, Size: 1370 bytes --]

From 12837ae091d533b58c80a0da43b92980b7ff5b6b Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Sun, 15 Mar 2020 17:42:41 -0500
Subject: [PATCH] SMB3: Add new compression flags

Additional compression capabilities can now be negotiated and a
new compression algorithm.  Add the flags for these.

See newly updated MS-SMB2 sections 3.1.4.4.1 and 2.2.3.1.3

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2pdu.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 817bc0531536..4a7d154fffae 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -307,11 +307,17 @@ struct smb2_encryption_neg_context {
 #define SMB3_COMPRESS_LZNT1	cpu_to_le16(0x0001)
 #define SMB3_COMPRESS_LZ77	cpu_to_le16(0x0002)
 #define SMB3_COMPRESS_LZ77_HUFF	cpu_to_le16(0x0003)
+/* Pattern scanning algorithm See MS-SMB2 3.1.4.4.1 */
+#define SMB3_COMPRESS_PATTERN	cpu_to_le16(0x0004)
+
+/* Compression Flags */
+#define SMB2_COMPRESSION_CAPABILITIES_FLAG_NONE		cpu_to_le32(0x00000000)
+#define SMB2_COMPRESSION_CAPABILITIES_FLAG_CHAINED	cpu_to_le32(0x00000001)
 
 struct smb2_compression_capabilities_context {
 	__le16	ContextType; /* 3 */
 	__le16  DataLength;
-	__u32	Reserved;
+	__u32	Flags;
 	__le16	CompressionAlgorithmCount;
 	__u16	Padding;
 	__u32	Reserved1;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SMB3] New compression flags
  2020-03-15 22:50 [SMB3] New compression flags Steve French
@ 2020-03-15 23:07 ` Steve French
  2020-03-15 23:09   ` ronnie sahlberg
  2020-03-16 10:50 ` Aurélien Aptel
  2020-03-16 19:01 ` [EXTERNAL] " Tom Talpey
  2 siblings, 1 reply; 6+ messages in thread
From: Steve French @ 2020-03-15 23:07 UTC (permalink / raw)
  To: CIFS, samba-technical

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

And one more small set of structures for the updated transform header.
See MS-SMB2 2.2.42.1 and 2.2.42.2


On Sun, Mar 15, 2020 at 5:50 PM Steve French <smfrench@gmail.com> wrote:
>
> Some compression related flags I noticed were added in the latest MS-SMB2
>
>
>
> --
> Thanks,
>
> Steve



-- 
Thanks,

Steve

[-- Attachment #2: 0001-SMB3-Additional-compression-structures.patch --]
[-- Type: text/x-patch, Size: 1377 bytes --]

From eeb672fc5e0ec07d355a0d782a20f9cd28f34be7 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Sun, 15 Mar 2020 18:04:13 -0500
Subject: [PATCH] SMB3: Additional compression structures

New transform header structures. See recent updates
to MS-SMB2 adding section 2.2.42.1 and 2.2.42.2

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2pdu.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 4a7d154fffae..8b8fbbc464c7 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -137,6 +137,21 @@ struct smb2_transform_hdr {
 	__u64  SessionId;
 } __packed;
 
+/* See MS-SMB2 2.2.42.1 */
+struct compression_playload_header {
+	__le16	AlgorithmId;
+	__le16	Reserved;
+	__le32	Length;
+} __packed;
+
+/* See MS-SMB2 2.2.42.2 */
+struct compression_pattern_payload_v1 {
+	__le16	Pattern;
+	__le16	Reserved1;
+	__le16	Reserved2;
+	__le32	Repititions;
+} __packed;
+
 /*
  *	SMB2 flag definitions
  */
@@ -1186,7 +1201,7 @@ struct smb2_write_req {
 	__le64 Offset;
 	__u64  PersistentFileId; /* opaque endianness */
 	__u64  VolatileFileId; /* opaque endianness */
-	__le32 Channel; /* Reserved MBZ */
+	__le32 Channel; /* MBZ unless SMB3.02 or later */
 	__le32 RemainingBytes;
 	__le16 WriteChannelInfoOffset;
 	__le16 WriteChannelInfoLength;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SMB3] New compression flags
  2020-03-15 23:07 ` Steve French
@ 2020-03-15 23:09   ` ronnie sahlberg
  2020-03-16  1:19     ` Steve French
  0 siblings, 1 reply; 6+ messages in thread
From: ronnie sahlberg @ 2020-03-15 23:09 UTC (permalink / raw)
  To: Steve French; +Cc: CIFS, samba-technical

Typo in
+    __le32    Repititions;

otherwise looks good.
Acked-by me for both.

On Mon, Mar 16, 2020 at 9:07 AM Steve French via samba-technical
<samba-technical@lists.samba.org> wrote:
>
> And one more small set of structures for the updated transform header.
> See MS-SMB2 2.2.42.1 and 2.2.42.2
>
>
> On Sun, Mar 15, 2020 at 5:50 PM Steve French <smfrench@gmail.com> wrote:
> >
> > Some compression related flags I noticed were added in the latest MS-SMB2
> >
> >
> >
> > --
> > Thanks,
> >
> > Steve
>
>
>
> --
> Thanks,
>
> Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SMB3] New compression flags
  2020-03-15 23:09   ` ronnie sahlberg
@ 2020-03-16  1:19     ` Steve French
  0 siblings, 0 replies; 6+ messages in thread
From: Steve French @ 2020-03-16  1:19 UTC (permalink / raw)
  To: ronnie sahlberg; +Cc: CIFS, samba-technical

fixed typo - thx

(and also added acked-by) and pushed to cifs-2.6.git for-next

On Sun, Mar 15, 2020 at 6:10 PM ronnie sahlberg
<ronniesahlberg@gmail.com> wrote:
>
> Typo in
> +    __le32    Repititions;
>
> otherwise looks good.
> Acked-by me for both.
>
> On Mon, Mar 16, 2020 at 9:07 AM Steve French via samba-technical
> <samba-technical@lists.samba.org> wrote:
> >
> > And one more small set of structures for the updated transform header.
> > See MS-SMB2 2.2.42.1 and 2.2.42.2
> >
> >
> > On Sun, Mar 15, 2020 at 5:50 PM Steve French <smfrench@gmail.com> wrote:
> > >
> > > Some compression related flags I noticed were added in the latest MS-SMB2
> > >
> > >
> > >
> > > --
> > > Thanks,
> > >
> > > Steve
> >
> >
> >
> > --
> > Thanks,
> >
> > Steve



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SMB3] New compression flags
  2020-03-15 22:50 [SMB3] New compression flags Steve French
  2020-03-15 23:07 ` Steve French
@ 2020-03-16 10:50 ` Aurélien Aptel
  2020-03-16 19:01 ` [EXTERNAL] " Tom Talpey
  2 siblings, 0 replies; 6+ messages in thread
From: Aurélien Aptel @ 2020-03-16 10:50 UTC (permalink / raw)
  To: Steve French, CIFS, samba-technical

Hi,

Changes looks good.

I had a quick look at this new stuff with Pike recently but it seems
even the latest windows server (1909) doesn't support it yet (not
returned in negprot).

Cheers,
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [EXTERNAL] [SMB3] New compression flags
  2020-03-15 22:50 [SMB3] New compression flags Steve French
  2020-03-15 23:07 ` Steve French
  2020-03-16 10:50 ` Aurélien Aptel
@ 2020-03-16 19:01 ` " Tom Talpey
  2 siblings, 0 replies; 6+ messages in thread
From: Tom Talpey @ 2020-03-16 19:01 UTC (permalink / raw)
  To: Steve French, CIFS, samba-technical

Note that this new document is published, as always, in advance of the upcoming release. The new protocol bits won’t be visible until "20H1" ships.

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/5606ad47-5ee0-437a-817e-70c366052962

-----Original Message-----
From: linux-cifs-owner@vger.kernel.org <linux-cifs-owner@vger.kernel.org> On Behalf Of Steve French
Sent: Sunday, March 15, 2020 6:50 PM
To: CIFS <linux-cifs@vger.kernel.org>; samba-technical <samba-technical@lists.samba.org>
Subject: [EXTERNAL] [SMB3] New compression flags

Some compression related flags I noticed were added in the latest MS-SMB2



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-15 22:50 [SMB3] New compression flags Steve French
2020-03-15 23:07 ` Steve French
2020-03-15 23:09   ` ronnie sahlberg
2020-03-16  1:19     ` Steve French
2020-03-16 10:50 ` Aurélien Aptel
2020-03-16 19:01 ` [EXTERNAL] " Tom Talpey

Linux-CIFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-cifs/0 linux-cifs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-cifs linux-cifs/ https://lore.kernel.org/linux-cifs \
		linux-cifs@vger.kernel.org
	public-inbox-index linux-cifs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-cifs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git