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: 1087724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HFLhI+q2"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44lPBR4gjDz9s3Z for ; Fri, 19 Apr 2019 02:07:11 +1000 (AEST) 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 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