Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f7fbf73 authored by Steve French's avatar Steve French
Browse files

Allow parsing vers=3.11 on cifs mount



Parses and recognizes "vers=3.1.1" on cifs mount and allows sending
0x0311 as a new CIFS/SMB3 dialect. Subsequent patches will add
the new negotiate contexts and updated session setup

Reviewed-by: default avatarJeff Layton <jlayton@primarydata.com>
Signed-off-by: default avatarSteve French <steve.french@primarydata.com>
parent f291095f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -192,6 +192,15 @@ config CIFS_SMB2
	  options are also slightly simpler (compared to CIFS) due
	  to protocol improvements.

config CIFS_SMB311
	bool "SMB3.1.1 network file system support (Experimental)"
	depends on CIFS_SMB2 && INET

	help
	  This enables experimental support for the newest, SMB3.1.1, dialect.
	  This dialect includes improved security negotiation features.
	  If unsure, say N

config CIFS_FSCACHE
	  bool "Provide CIFS client caching support"
	  depends on CIFS=m && FSCACHE || CIFS=y && FSCACHE=y
+7 −0
Original line number Diff line number Diff line
@@ -171,6 +171,10 @@ enum smb_version {
	Smb_21,
	Smb_30,
	Smb_302,
#ifdef CONFIG_CIFS_SMB311
	Smb_311,
#endif /* SMB311 */
	Smb_version_err
};

struct mid_q_entry;
@@ -1617,4 +1621,7 @@ extern struct smb_version_values smb30_values;
#define SMB302_VERSION_STRING	"3.02"
/*extern struct smb_version_operations smb302_operations;*/ /* not needed yet */
extern struct smb_version_values smb302_values;
#define SMB311_VERSION_STRING	"3.1.1"
/*extern struct smb_version_operations smb311_operations;*/ /* not needed yet */
extern struct smb_version_values smb311_values;
#endif	/* _CIFS_GLOB_H */
+10 −0
Original line number Diff line number Diff line
@@ -280,6 +280,10 @@ static const match_table_t cifs_smb_version_tokens = {
	{ Smb_21, SMB21_VERSION_STRING },
	{ Smb_30, SMB30_VERSION_STRING },
	{ Smb_302, SMB302_VERSION_STRING },
#ifdef CONFIG_CIFS_SMB311
	{ Smb_311, SMB311_VERSION_STRING },
#endif /* SMB311 */
	{ Smb_version_err, NULL }
};

static int ip_connect(struct TCP_Server_Info *server);
@@ -1133,6 +1137,12 @@ cifs_parse_smb_version(char *value, struct smb_vol *vol)
		vol->ops = &smb30_operations; /* currently identical with 3.0 */
		vol->vals = &smb302_values;
		break;
#ifdef CONFIG_CIFS_SMB311
	case Smb_311:
		vol->ops = &smb30_operations; /* currently identical with 3.0 */
		vol->vals = &smb311_values;
		break;
#endif /* SMB311 */
#endif
	default:
		cifs_dbg(VFS, "Unknown vers= option specified: %s\n", value);
+22 −0
Original line number Diff line number Diff line
@@ -1714,3 +1714,25 @@ struct smb_version_values smb302_values = {
	.signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED,
	.create_lease_size = sizeof(struct create_lease_v2),
};

#ifdef CONFIG_CIFS_SMB311
struct smb_version_values smb311_values = {
	.version_string = SMB311_VERSION_STRING,
	.protocol_id = SMB311_PROT_ID,
	.req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU,
	.large_lock_type = 0,
	.exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK,
	.shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK,
	.unlock_lock_type = SMB2_LOCKFLAG_UNLOCK,
	.header_size = sizeof(struct smb2_hdr),
	.max_header_size = MAX_SMB2_HDR_SIZE,
	.read_rsp_size = sizeof(struct smb2_read_rsp) - 1,
	.lock_cmd = SMB2_LOCK,
	.cap_unix = 0,
	.cap_nt_find = SMB2_NT_FIND,
	.cap_large_files = SMB2_LARGE_FILES,
	.signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED,
	.signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED,
	.create_lease_size = sizeof(struct create_lease_v2),
};
#endif /* SMB311 */
+4 −0
Original line number Diff line number Diff line
@@ -393,6 +393,10 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
		cifs_dbg(FYI, "negotiated smb3.0 dialect\n");
	else if (rsp->DialectRevision == cpu_to_le16(SMB302_PROT_ID))
		cifs_dbg(FYI, "negotiated smb3.02 dialect\n");
#ifdef CONFIG_CIFS_SMB311
	else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))
		cifs_dbg(FYI, "negotiated smb3.1.1 dialect\n");
#endif /* SMB311 */
	else {
		cifs_dbg(VFS, "Illegal dialect returned by server %d\n",
			 le16_to_cpu(rsp->DialectRevision));
Loading