Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * net/tipc/sysctl.c: sysctl interface to TIPC subsystem
0003  *
0004  * Copyright (c) 2013, Wind River Systems
0005  * All rights reserved.
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted provided that the following conditions are met:
0009  *
0010  * 1. Redistributions of source code must retain the above copyright
0011  *    notice, this list of conditions and the following disclaimer.
0012  * 2. Redistributions in binary form must reproduce the above copyright
0013  *    notice, this list of conditions and the following disclaimer in the
0014  *    documentation and/or other materials provided with the distribution.
0015  * 3. Neither the names of the copyright holders nor the names of its
0016  *    contributors may be used to endorse or promote products derived from
0017  *    this software without specific prior written permission.
0018  *
0019  * Alternatively, this software may be distributed under the terms of the
0020  * GNU General Public License ("GPL") version 2 as published by the Free
0021  * Software Foundation.
0022  *
0023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0026  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0027  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0028  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0029  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0030  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0031  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0032  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0033  * POSSIBILITY OF SUCH DAMAGE.
0034  */
0035 
0036 #include "core.h"
0037 #include "trace.h"
0038 #include "crypto.h"
0039 #include "bcast.h"
0040 #include <linux/sysctl.h>
0041 
0042 static struct ctl_table_header *tipc_ctl_hdr;
0043 
0044 static struct ctl_table tipc_table[] = {
0045     {
0046         .procname   = "tipc_rmem",
0047         .data       = &sysctl_tipc_rmem,
0048         .maxlen     = sizeof(sysctl_tipc_rmem),
0049         .mode       = 0644,
0050         .proc_handler   = proc_dointvec_minmax,
0051         .extra1         = SYSCTL_ONE,
0052     },
0053     {
0054         .procname   = "named_timeout",
0055         .data       = &sysctl_tipc_named_timeout,
0056         .maxlen     = sizeof(sysctl_tipc_named_timeout),
0057         .mode       = 0644,
0058         .proc_handler   = proc_dointvec_minmax,
0059         .extra1         = SYSCTL_ZERO,
0060     },
0061     {
0062         .procname       = "sk_filter",
0063         .data           = &sysctl_tipc_sk_filter,
0064         .maxlen         = sizeof(sysctl_tipc_sk_filter),
0065         .mode           = 0644,
0066         .proc_handler   = proc_doulongvec_minmax,
0067     },
0068 #ifdef CONFIG_TIPC_CRYPTO
0069     {
0070         .procname   = "max_tfms",
0071         .data       = &sysctl_tipc_max_tfms,
0072         .maxlen     = sizeof(sysctl_tipc_max_tfms),
0073         .mode       = 0644,
0074         .proc_handler   = proc_dointvec_minmax,
0075         .extra1         = SYSCTL_ONE,
0076     },
0077     {
0078         .procname   = "key_exchange_enabled",
0079         .data       = &sysctl_tipc_key_exchange_enabled,
0080         .maxlen     = sizeof(sysctl_tipc_key_exchange_enabled),
0081         .mode       = 0644,
0082         .proc_handler   = proc_dointvec_minmax,
0083         .extra1         = SYSCTL_ZERO,
0084         .extra2         = SYSCTL_ONE,
0085     },
0086 #endif
0087     {
0088         .procname   = "bc_retruni",
0089         .data       = &sysctl_tipc_bc_retruni,
0090         .maxlen     = sizeof(sysctl_tipc_bc_retruni),
0091         .mode       = 0644,
0092         .proc_handler   = proc_doulongvec_minmax,
0093     },
0094     {}
0095 };
0096 
0097 int tipc_register_sysctl(void)
0098 {
0099     tipc_ctl_hdr = register_net_sysctl(&init_net, "net/tipc", tipc_table);
0100     if (tipc_ctl_hdr == NULL)
0101         return -ENOMEM;
0102     return 0;
0103 }
0104 
0105 void tipc_unregister_sysctl(void)
0106 {
0107     unregister_net_sysctl_table(tipc_ctl_hdr);
0108 }