1a90cf9fGordon Ross/*
2a90cf9fGordon Ross * This file and its contents are supplied under the terms of the
3a90cf9fGordon Ross * Common Development and Distribution License ("CDDL"), version 1.0.
4a90cf9fGordon Ross * You may only use this file in accordance with the terms of version
5a90cf9fGordon Ross * 1.0 of the CDDL.
6a90cf9fGordon Ross *
7a90cf9fGordon Ross * A full copy of the text of the CDDL should have accompanied this
8a90cf9fGordon Ross * source.  A copy of the CDDL is also available via the Internet at
9a90cf9fGordon Ross * http://www.illumos.org/license/CDDL.
10a90cf9fGordon Ross */
11a90cf9fGordon Ross
12a90cf9fGordon Ross/*
1393bc28dGordon Ross * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
14a90cf9fGordon Ross */
15a90cf9fGordon Ross
16a90cf9fGordon Ross/*
17a90cf9fGordon Ross * Dispatch function for SMB2_ECHO
18a90cf9fGordon Ross */
19a90cf9fGordon Ross
20a90cf9fGordon Ross#include <smbsrv/smb2_kproto.h>
21a90cf9fGordon Ross
22a90cf9fGordon Rosssmb_sdrc_t
23a90cf9fGordon Rosssmb2_echo(smb_request_t *sr)
24a90cf9fGordon Ross{
25a90cf9fGordon Ross	uint16_t StructSize;
26a90cf9fGordon Ross	uint16_t reserved;
27a90cf9fGordon Ross	int rc;
28a90cf9fGordon Ross
29a90cf9fGordon Ross	/*
30a90cf9fGordon Ross	 * SMB2 Echo request
31a90cf9fGordon Ross	 */
32a90cf9fGordon Ross	rc = smb_mbc_decodef(
33a90cf9fGordon Ross	    &sr->smb_data, "ww",
34a90cf9fGordon Ross	    &StructSize,		/* w */
35a90cf9fGordon Ross	    &reserved);			/* w */
36a90cf9fGordon Ross	if (rc)
37a90cf9fGordon Ross		return (SDRC_ERROR);
38a90cf9fGordon Ross	if (StructSize != 4)
39a90cf9fGordon Ross		return (SDRC_ERROR);
40a90cf9fGordon Ross
4193bc28dGordon Ross	DTRACE_SMB2_START(op__Echo, smb_request_t *, sr);
4293bc28dGordon Ross	DTRACE_SMB2_DONE(op__Echo, smb_request_t *, sr);
4393bc28dGordon Ross
44a90cf9fGordon Ross	/*
45a90cf9fGordon Ross	 * SMB2 Echo reply
46a90cf9fGordon Ross	 */
47a90cf9fGordon Ross	(void) smb_mbc_encodef(
48a90cf9fGordon Ross	    &sr->reply, "wwl",
49a90cf9fGordon Ross	    4,	/* StructSize */	/* w */
50a90cf9fGordon Ross	    0); /* reserved */		/* w */
51a90cf9fGordon Ross
52a90cf9fGordon Ross	return (SDRC_SUCCESS);
53a90cf9fGordon Ross}
54