/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Dispatch function for SMB2_OPLOCK_BREAK
*/
#include <smbsrv/smb2_kproto.h>
/*
* SMB2 Oplock Break Acknowledgement
* [MS-SMB2 2.2.24]
*/
{
int rc = 0;
/*
* Decode the SMB2 Oplock Break Ack.
*/
&StructSize, /* w */
&OplockLevel, /* b */
/* reserved 5. */
return (SDRC_ERROR);
if (status)
goto errout;
/* Not a regular file */
goto errout;
}
/*
* Process the oplock break ack. We only expect levels
* at or below the hightest break levels we send, which is
* currently SMB2_OPLOCK_LEVEL_II.
*/
switch (OplockLevel) {
case SMB2_OPLOCK_LEVEL_NONE: /* 0x00 */
break;
case SMB2_OPLOCK_LEVEL_II: /* 0x01 */
break;
/* We don't break to these levels (yet). */
case SMB2_OPLOCK_LEVEL_EXCLUSIVE: /* 0x08 */
case SMB2_OPLOCK_LEVEL_BATCH: /* 0x09 */
case SMB2_OPLOCK_LEVEL_LEASE: /* 0xFF */
default: /* gcc -Wuninitialized */
goto errout;
}
/*
* Generate SMB2 Oplock Break response
* [MS-SMB2] 2.2.25
*/
StructSize = 24;
(void) smb_mbc_encodef(
StructSize, /* w */
OplockLevel, /* b */
/* reserved 5. */
return (SDRC_SUCCESS);
return (SDRC_SUCCESS);
}
/*
* Compose an SMB2 Oplock Break Notification packet, including
* the SMB2 header and everything, in sr->reply.
* The caller will send it and free the request.
*/
void
{
switch (brk) {
default:
ASSERT(0);
/* FALLTHROUGH */
case SMB_OPLOCK_BREAK_TO_NONE:
break;
break;
}
/*
* SMB2 Header
*/
/*
* SMB2 Oplock Break, variable part
*/
StructSize = 24;
smb2fid.persistent = 0;
(void) smb_mbc_encodef(
StructSize, /* w */
OplockLevel, /* b */
/* reserved 5. */
}