blob: d391d7758f52a68d5a85de7cf962462a99bc5286 [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Copyright (C) 1996 Mike Shaver (shaver@zeroknowledge.com)
5 */
6#include <linux/mm.h>
7#include <linux/sysctl.h>
8#include <linux/init.h>
9#include <net/ax25.h>
10#include <net/rose.h>
11
12static int min_timer[] = {1 * HZ};
13static int max_timer[] = {300 * HZ};
14static int min_idle[] = {0 * HZ};
15static int max_idle[] = {65535 * HZ};
16static int min_route[1], max_route[] = {1};
17static int min_ftimer[] = {60 * HZ};
18static int max_ftimer[] = {600 * HZ};
19static int min_maxvcs[] = {1}, max_maxvcs[] = {254};
20static int min_window[] = {1}, max_window[] = {7};
21
22static struct ctl_table_header *rose_table_header;
23
Joe Perchesfe2c6332013-06-11 23:04:25 -070024static struct ctl_table rose_table[] = {
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090025 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 .procname = "restart_request_timeout",
27 .data = &sysctl_rose_restart_request_timeout,
28 .maxlen = sizeof(int),
29 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080030 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 .extra1 = &min_timer,
32 .extra2 = &max_timer
33 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090034 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 .procname = "call_request_timeout",
36 .data = &sysctl_rose_call_request_timeout,
37 .maxlen = sizeof(int),
38 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080039 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 .extra1 = &min_timer,
41 .extra2 = &max_timer
42 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090043 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 .procname = "reset_request_timeout",
45 .data = &sysctl_rose_reset_request_timeout,
46 .maxlen = sizeof(int),
47 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080048 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 .extra1 = &min_timer,
50 .extra2 = &max_timer
51 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090052 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 .procname = "clear_request_timeout",
54 .data = &sysctl_rose_clear_request_timeout,
55 .maxlen = sizeof(int),
56 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080057 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 .extra1 = &min_timer,
59 .extra2 = &max_timer
60 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090061 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 .procname = "no_activity_timeout",
63 .data = &sysctl_rose_no_activity_timeout,
64 .maxlen = sizeof(int),
65 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080066 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 .extra1 = &min_idle,
68 .extra2 = &max_idle
69 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090070 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 .procname = "acknowledge_hold_back_timeout",
72 .data = &sysctl_rose_ack_hold_back_timeout,
73 .maxlen = sizeof(int),
74 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080075 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 .extra1 = &min_timer,
77 .extra2 = &max_timer
78 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090079 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 .procname = "routing_control",
81 .data = &sysctl_rose_routing_control,
82 .maxlen = sizeof(int),
83 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080084 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 .extra1 = &min_route,
86 .extra2 = &max_route
87 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090088 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 .procname = "link_fail_timeout",
90 .data = &sysctl_rose_link_fail_timeout,
91 .maxlen = sizeof(int),
92 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -080093 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 .extra1 = &min_ftimer,
95 .extra2 = &max_ftimer
96 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +090097 {
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 .procname = "maximum_virtual_circuits",
99 .data = &sysctl_rose_maximum_vcs,
100 .maxlen = sizeof(int),
101 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800102 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 .extra1 = &min_maxvcs,
104 .extra2 = &max_maxvcs
105 },
YOSHIFUJI Hideaki3dcf7c52007-02-09 23:25:12 +0900106 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 .procname = "window_size",
108 .data = &sysctl_rose_window_size,
109 .maxlen = sizeof(int),
110 .mode = 0644,
Alexey Dobriyan6d9f2392008-11-03 18:21:05 -0800111 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 .extra1 = &min_window,
113 .extra2 = &max_window
114 },
Eric W. Biedermanf8572d82009-11-05 13:32:03 -0800115 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116};
117
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118void __init rose_register_sysctl(void)
119{
Eric W. Biedermanec8f23c2012-04-19 13:44:49 +0000120 rose_table_header = register_net_sysctl(&init_net, "net/rose", rose_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121}
122
123void rose_unregister_sysctl(void)
124{
Eric W. Biederman5dd3df12012-04-19 13:24:33 +0000125 unregister_net_sysctl_table(rose_table_header);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126}