From patchwork Thu Apr 18 16:06:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10907609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EAE713B5 for ; Thu, 18 Apr 2019 16:07:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EB8128B56 for ; Thu, 18 Apr 2019 16:07:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7294728CAC; Thu, 18 Apr 2019 16:07:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F1BB28B56 for ; Thu, 18 Apr 2019 16:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389016AbfDRQHK (ORCPT ); Thu, 18 Apr 2019 12:07:10 -0400 Received: from mail-pg1-f176.google.com ([209.85.215.176]:45944 "EHLO mail-pg1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725888AbfDRQHK (ORCPT ); Thu, 18 Apr 2019 12:07:10 -0400 Received: by mail-pg1-f176.google.com with SMTP id y3so1394712pgk.12 for ; Thu, 18 Apr 2019 09:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=sKF0jK9b9yJIjxLEg5h1WJiNnPHeqBXNuciZYywUK10=; b=HFLhI+q2BzvgsHuEUHB0tKySjdJYSa1YczIvTy3wgA3iKanCkDVEppjN2qdFs+NZ5X 0eRf5T/+1FxcYXAUfUCLdcC7EsLAQbKrdCttm+aMiFjHEmhc76jeCGhHKb4sskUTLooE bgUkfNn6beVgnnI96XNm026vC/M7lhGcCs63BikjFG/Pk7L2iOL34JkfuO5/QNc0f9aG GdRAHfYcpjL2p2mue1XWzJEQJG0lb9DpYXiJBqhKPdEl2uacQIwbfOe8p6jNa2zVlQud aeGZ70FhPG4J1t7VEGwMRWtX13a1ULFpuJt/85mPRd26mT+cqOGOkn9AytV17XsxeVyB r8AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=sKF0jK9b9yJIjxLEg5h1WJiNnPHeqBXNuciZYywUK10=; b=siuSTtVRJgvC6mSPeWuKcD4cEzBnYiFMfcHi/2E+M6yecHzDHzxk3vPzQz2wlWo7uN jeXpIaiGWlTvgqtfe5v0gEia7YUCUeNDgef7f0OPuAjwj6hJJZ1oOPgomuN47NYzz/e+ Xgb3WHZLzLH7AzmVhsUMynUFI3EXDRi5A62V8Z0rtQKivJgYxJ2023u2lQpzrjgdOW+C oh4l7DgonspFdIqBQo5IQG6qd2imEi4hqGtD0wwP43hX7FU86vjs+c2EG7jUJ8AmYXdQ yCFnUo9v03hMOp5j5Gbc/3UohS1BtIEmHluiT03WzdUQ0Tt1gF3fl/MPt8+Sl+/iVcvC mY0A== X-Gm-Message-State: APjAAAVYmVAmryvvxskX4wFOhu7uwvcX+pxsrMUuFlhb8pKepCDIv8qa VEltmd5xZMn52ywI3PLZ6LqBaRcAWeuN5aZJMlyumA== X-Google-Smtp-Source: APXvYqzbDLqEhRrKwMjwi0oHzij7hXyqn7I0wriLfhCXPpHVP5/hCrX1wuv90Xo/dCkZQ9aWU8G7lFTn+0aOAks615s= X-Received: by 2002:a63:e004:: with SMTP id e4mr90402811pgh.344.1555603629211; Thu, 18 Apr 2019 09:07:09 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Thu, 18 Apr 2019 11:06:57 -0500 Message-ID: Subject: [PATCH][SMB3] Add missing defines for new negotiate contexts To: CIFS , samba-technical Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP See updated MS-SMB2 - two new negotiate contexts From 137c7222c0f4abbc9ea2b2ab11c98c69e87613db Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 18 Apr 2019 11:03:58 -0500 Subject: [PATCH] SMB3: Add defines for new negotiate contexts See the latest MS-SMB2 protocol specification updates. These will be needed for implementing compression support on the wire for example. Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 5 +---- fs/cifs/smb2pdu.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index ac92d066c724..3999ec5a6bb9 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -459,10 +459,7 @@ smb2_plain_req_init(__le16 smb2_command, struct cifs_tcon *tcon, return rc; } - -#define SMB2_PREAUTH_INTEGRITY_CAPABILITIES cpu_to_le16(1) -#define SMB2_ENCRYPTION_CAPABILITIES cpu_to_le16(2) -#define SMB2_POSIX_EXTENSIONS_AVAILABLE cpu_to_le16(0x100) +/* For explanation of negotiate contexts see MS-SMB2 section 2.2.3.1 */ static void build_preauth_ctxt(struct smb2_preauth_neg_context *pneg_ctxt) diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index bc9161a26400..e0725e98f175 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h @@ -251,6 +251,14 @@ struct smb2_negotiate_req { #define SMB2_NT_FIND 0x00100000 #define SMB2_LARGE_FILES 0x00200000 + +/* Negotiate Contexts - ContextTypes. See MS-SMB2 section 2.2.3.1 for details */ +#define SMB2_PREAUTH_INTEGRITY_CAPABILITIES cpu_to_le16(1) +#define SMB2_ENCRYPTION_CAPABILITIES cpu_to_le16(2) +#define SMB2_COMPRESSION_CAPABILITIES cpu_to_le16(4) +#define SMB2_NETNAME_NEGOTIATE_CONTEXT_ID cpu_to_le16(5) +#define SMB2_POSIX_EXTENSIONS_AVAILABLE cpu_to_le16(0x100) + struct smb2_neg_context { __le16 ContextType; __le16 DataLength; @@ -288,6 +296,24 @@ struct smb2_encryption_neg_context { __le16 Ciphers[1]; /* Ciphers[0] since only one used now */ } __packed; +/* See MS-SMB2 2.2.3.1.3 */ +#define SMB3_COMPRESS_NONE 0x0000 +#define SMB3_COMPRESS_LZNT1 0x0001 +#define SMB3_COMPRESS_LZ77 0x0002 +#define SMB3_COMPRESS_LZ77_HUFF 0x0003 + +struct smb2_compression_capabilities_context { + __le16 CompressionAlgorithmCount; + __u16 Padding; + __u32 Reserved; + __u16 CompressionAlgorithms[1]; +} __packed; + +/* + * For smb2_netname_negotiate_context_id See MS-SMB2 2.2.3.1.4. + * Its struct simply contains NetName, an array of Unicode characters + */ + #define POSIX_CTXT_DATA_LEN 16 struct smb2_posix_neg_context { __le16 ContextType; /* 0x100 */ -- 2.17.1