[PATCH 3.16 27/83] smb3: send CAP_DFS capability during session setup

From: Ben Hutchings
Date: Wed Nov 20 2019 - 10:44:50 EST


3.16.78-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Steve French <stfrench@xxxxxxxxxxxxx>

commit 8d33096a460d5b9bd13300f01615df5bb454db10 upstream.

We had a report of a server which did not do a DFS referral
because the session setup Capabilities field was set to 0
(unlike negotiate protocol where we set CAP_DFS). Better to
send it session setup in the capabilities as well (this also
more closely matches Windows client behavior).

Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
Reviewed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
Reviewed-by: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
fs/cifs/smb2pdu.c | 5 +++++
1 file changed, 5 insertions(+)

--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -646,7 +646,12 @@ ssetup_ntlmssp_authenticate:
else
req->SecurityMode = 0;

+#ifdef CONFIG_CIFS_DFS_UPCALL
+ req->Capabilities = cpu_to_le32(SMB2_GLOBAL_CAP_DFS);
+#else
req->Capabilities = 0;
+#endif /* DFS_UPCALL */
+
req->Channel = 0; /* MBZ */

iov[0].iov_base = (char *)req;