xref: /kernel/linux/linux-5.10/net/tipc/sysctl.c (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * net/tipc/sysctl.c: sysctl interface to TIPC subsystem
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (c) 2013, Wind River Systems
58c2ecf20Sopenharmony_ci * All rights reserved.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
88c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions are met:
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright
118c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
128c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
138c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
148c2ecf20Sopenharmony_ci *    documentation and/or other materials provided with the distribution.
158c2ecf20Sopenharmony_ci * 3. Neither the names of the copyright holders nor the names of its
168c2ecf20Sopenharmony_ci *    contributors may be used to endorse or promote products derived from
178c2ecf20Sopenharmony_ci *    this software without specific prior written permission.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the
208c2ecf20Sopenharmony_ci * GNU General Public License ("GPL") version 2 as published by the Free
218c2ecf20Sopenharmony_ci * Software Foundation.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
248c2ecf20Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
258c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
268c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
278c2ecf20Sopenharmony_ci * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
288c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
298c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
308c2ecf20Sopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
318c2ecf20Sopenharmony_ci * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
328c2ecf20Sopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
338c2ecf20Sopenharmony_ci * POSSIBILITY OF SUCH DAMAGE.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#include "core.h"
378c2ecf20Sopenharmony_ci#include "trace.h"
388c2ecf20Sopenharmony_ci#include "crypto.h"
398c2ecf20Sopenharmony_ci#include "bcast.h"
408c2ecf20Sopenharmony_ci#include <linux/sysctl.h>
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistatic struct ctl_table_header *tipc_ctl_hdr;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistatic struct ctl_table tipc_table[] = {
458c2ecf20Sopenharmony_ci	{
468c2ecf20Sopenharmony_ci		.procname	= "tipc_rmem",
478c2ecf20Sopenharmony_ci		.data		= &sysctl_tipc_rmem,
488c2ecf20Sopenharmony_ci		.maxlen		= sizeof(sysctl_tipc_rmem),
498c2ecf20Sopenharmony_ci		.mode		= 0644,
508c2ecf20Sopenharmony_ci		.proc_handler	= proc_dointvec_minmax,
518c2ecf20Sopenharmony_ci		.extra1         = SYSCTL_ONE,
528c2ecf20Sopenharmony_ci	},
538c2ecf20Sopenharmony_ci	{
548c2ecf20Sopenharmony_ci		.procname	= "named_timeout",
558c2ecf20Sopenharmony_ci		.data		= &sysctl_tipc_named_timeout,
568c2ecf20Sopenharmony_ci		.maxlen		= sizeof(sysctl_tipc_named_timeout),
578c2ecf20Sopenharmony_ci		.mode		= 0644,
588c2ecf20Sopenharmony_ci		.proc_handler	= proc_dointvec_minmax,
598c2ecf20Sopenharmony_ci		.extra1         = SYSCTL_ZERO,
608c2ecf20Sopenharmony_ci	},
618c2ecf20Sopenharmony_ci	{
628c2ecf20Sopenharmony_ci		.procname       = "sk_filter",
638c2ecf20Sopenharmony_ci		.data           = &sysctl_tipc_sk_filter,
648c2ecf20Sopenharmony_ci		.maxlen         = sizeof(sysctl_tipc_sk_filter),
658c2ecf20Sopenharmony_ci		.mode           = 0644,
668c2ecf20Sopenharmony_ci		.proc_handler   = proc_doulongvec_minmax,
678c2ecf20Sopenharmony_ci	},
688c2ecf20Sopenharmony_ci#ifdef CONFIG_TIPC_CRYPTO
698c2ecf20Sopenharmony_ci	{
708c2ecf20Sopenharmony_ci		.procname	= "max_tfms",
718c2ecf20Sopenharmony_ci		.data		= &sysctl_tipc_max_tfms,
728c2ecf20Sopenharmony_ci		.maxlen		= sizeof(sysctl_tipc_max_tfms),
738c2ecf20Sopenharmony_ci		.mode		= 0644,
748c2ecf20Sopenharmony_ci		.proc_handler	= proc_dointvec_minmax,
758c2ecf20Sopenharmony_ci		.extra1         = SYSCTL_ONE,
768c2ecf20Sopenharmony_ci	},
778c2ecf20Sopenharmony_ci	{
788c2ecf20Sopenharmony_ci		.procname	= "key_exchange_enabled",
798c2ecf20Sopenharmony_ci		.data		= &sysctl_tipc_key_exchange_enabled,
808c2ecf20Sopenharmony_ci		.maxlen		= sizeof(sysctl_tipc_key_exchange_enabled),
818c2ecf20Sopenharmony_ci		.mode		= 0644,
828c2ecf20Sopenharmony_ci		.proc_handler	= proc_dointvec_minmax,
838c2ecf20Sopenharmony_ci		.extra1         = SYSCTL_ZERO,
848c2ecf20Sopenharmony_ci		.extra2         = SYSCTL_ONE,
858c2ecf20Sopenharmony_ci	},
868c2ecf20Sopenharmony_ci#endif
878c2ecf20Sopenharmony_ci	{
888c2ecf20Sopenharmony_ci		.procname	= "bc_retruni",
898c2ecf20Sopenharmony_ci		.data		= &sysctl_tipc_bc_retruni,
908c2ecf20Sopenharmony_ci		.maxlen		= sizeof(sysctl_tipc_bc_retruni),
918c2ecf20Sopenharmony_ci		.mode		= 0644,
928c2ecf20Sopenharmony_ci		.proc_handler	= proc_doulongvec_minmax,
938c2ecf20Sopenharmony_ci	},
948c2ecf20Sopenharmony_ci	{}
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ciint tipc_register_sysctl(void)
988c2ecf20Sopenharmony_ci{
998c2ecf20Sopenharmony_ci	tipc_ctl_hdr = register_net_sysctl(&init_net, "net/tipc", tipc_table);
1008c2ecf20Sopenharmony_ci	if (tipc_ctl_hdr == NULL)
1018c2ecf20Sopenharmony_ci		return -ENOMEM;
1028c2ecf20Sopenharmony_ci	return 0;
1038c2ecf20Sopenharmony_ci}
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_civoid tipc_unregister_sysctl(void)
1068c2ecf20Sopenharmony_ci{
1078c2ecf20Sopenharmony_ci	unregister_net_sysctl_table(tipc_ctl_hdr);
1088c2ecf20Sopenharmony_ci}
109