Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify |
| 3 | * it under the terms of the GNU General Public License as published by |
| 4 | * the Free Software Foundation; either version 2 of the License, or |
| 5 | * (at your option) any later version. |
| 6 | * |
| 7 | * Copyright (C) 1996 Mike Shaver (shaver@zeroknowledge.com) |
| 8 | */ |
| 9 | #include <linux/mm.h> |
| 10 | #include <linux/sysctl.h> |
| 11 | #include <linux/init.h> |
| 12 | #include <net/ax25.h> |
| 13 | #include <net/netrom.h> |
| 14 | |
| 15 | /* |
| 16 | * Values taken from NET/ROM documentation. |
| 17 | */ |
| 18 | static int min_quality[] = {0}, max_quality[] = {255}; |
| 19 | static int min_obs[] = {0}, max_obs[] = {255}; |
| 20 | static int min_ttl[] = {0}, max_ttl[] = {255}; |
| 21 | static int min_t1[] = {5 * HZ}; |
| 22 | static int max_t1[] = {600 * HZ}; |
| 23 | static int min_n2[] = {2}, max_n2[] = {127}; |
| 24 | static int min_t2[] = {1 * HZ}; |
| 25 | static int max_t2[] = {60 * HZ}; |
| 26 | static int min_t4[] = {1 * HZ}; |
| 27 | static int max_t4[] = {1000 * HZ}; |
| 28 | static int min_window[] = {1}, max_window[] = {127}; |
| 29 | static int min_idle[] = {0 * HZ}; |
| 30 | static int max_idle[] = {65535 * HZ}; |
| 31 | static int min_route[] = {0}, max_route[] = {1}; |
| 32 | static int min_fails[] = {1}, max_fails[] = {10}; |
Ralf Baechle | e21ce8c | 2005-09-12 14:27:37 -0700 | [diff] [blame] | 33 | static int min_reset[] = {0}, max_reset[] = {1}; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | static struct ctl_table_header *nr_table_header; |
| 36 | |
| 37 | static ctl_table nr_table[] = { |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 38 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | .ctl_name = NET_NETROM_DEFAULT_PATH_QUALITY, |
| 40 | .procname = "default_path_quality", |
| 41 | .data = &sysctl_netrom_default_path_quality, |
| 42 | .maxlen = sizeof(int), |
| 43 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 44 | .proc_handler = proc_dointvec_minmax, |
| 45 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | .extra1 = &min_quality, |
| 47 | .extra2 = &max_quality |
| 48 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 49 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | .ctl_name = NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER, |
| 51 | .procname = "obsolescence_count_initialiser", |
| 52 | .data = &sysctl_netrom_obsolescence_count_initialiser, |
| 53 | .maxlen = sizeof(int), |
| 54 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 55 | .proc_handler = proc_dointvec_minmax, |
| 56 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | .extra1 = &min_obs, |
| 58 | .extra2 = &max_obs |
| 59 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 60 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | .ctl_name = NET_NETROM_NETWORK_TTL_INITIALISER, |
| 62 | .procname = "network_ttl_initialiser", |
| 63 | .data = &sysctl_netrom_network_ttl_initialiser, |
| 64 | .maxlen = sizeof(int), |
| 65 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 66 | .proc_handler = proc_dointvec_minmax, |
| 67 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | .extra1 = &min_ttl, |
| 69 | .extra2 = &max_ttl |
| 70 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 71 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | .ctl_name = NET_NETROM_TRANSPORT_TIMEOUT, |
| 73 | .procname = "transport_timeout", |
| 74 | .data = &sysctl_netrom_transport_timeout, |
| 75 | .maxlen = sizeof(int), |
| 76 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 77 | .proc_handler = proc_dointvec_minmax, |
| 78 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | .extra1 = &min_t1, |
| 80 | .extra2 = &max_t1 |
| 81 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 82 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | .ctl_name = NET_NETROM_TRANSPORT_MAXIMUM_TRIES, |
| 84 | .procname = "transport_maximum_tries", |
| 85 | .data = &sysctl_netrom_transport_maximum_tries, |
| 86 | .maxlen = sizeof(int), |
| 87 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 88 | .proc_handler = proc_dointvec_minmax, |
| 89 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | .extra1 = &min_n2, |
| 91 | .extra2 = &max_n2 |
| 92 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 93 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | .ctl_name = NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY, |
| 95 | .procname = "transport_acknowledge_delay", |
| 96 | .data = &sysctl_netrom_transport_acknowledge_delay, |
| 97 | .maxlen = sizeof(int), |
| 98 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 99 | .proc_handler = proc_dointvec_minmax, |
| 100 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | .extra1 = &min_t2, |
| 102 | .extra2 = &max_t2 |
| 103 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 104 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | .ctl_name = NET_NETROM_TRANSPORT_BUSY_DELAY, |
| 106 | .procname = "transport_busy_delay", |
| 107 | .data = &sysctl_netrom_transport_busy_delay, |
| 108 | .maxlen = sizeof(int), |
| 109 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 110 | .proc_handler = proc_dointvec_minmax, |
| 111 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | .extra1 = &min_t4, |
| 113 | .extra2 = &max_t4 |
| 114 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 115 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | .ctl_name = NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE, |
| 117 | .procname = "transport_requested_window_size", |
| 118 | .data = &sysctl_netrom_transport_requested_window_size, |
| 119 | .maxlen = sizeof(int), |
| 120 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 121 | .proc_handler = proc_dointvec_minmax, |
| 122 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | .extra1 = &min_window, |
| 124 | .extra2 = &max_window |
| 125 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 126 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | .ctl_name = NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT, |
| 128 | .procname = "transport_no_activity_timeout", |
| 129 | .data = &sysctl_netrom_transport_no_activity_timeout, |
| 130 | .maxlen = sizeof(int), |
| 131 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 132 | .proc_handler = proc_dointvec_minmax, |
| 133 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | .extra1 = &min_idle, |
| 135 | .extra2 = &max_idle |
| 136 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 137 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | .ctl_name = NET_NETROM_ROUTING_CONTROL, |
| 139 | .procname = "routing_control", |
| 140 | .data = &sysctl_netrom_routing_control, |
| 141 | .maxlen = sizeof(int), |
| 142 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 143 | .proc_handler = proc_dointvec_minmax, |
| 144 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | .extra1 = &min_route, |
| 146 | .extra2 = &max_route |
| 147 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 148 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | .ctl_name = NET_NETROM_LINK_FAILS_COUNT, |
| 150 | .procname = "link_fails_count", |
| 151 | .data = &sysctl_netrom_link_fails_count, |
| 152 | .maxlen = sizeof(int), |
| 153 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 154 | .proc_handler = proc_dointvec_minmax, |
| 155 | .strategy = sysctl_intvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | .extra1 = &min_fails, |
| 157 | .extra2 = &max_fails |
| 158 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 159 | { |
Ralf Baechle | e21ce8c | 2005-09-12 14:27:37 -0700 | [diff] [blame] | 160 | .ctl_name = NET_NETROM_RESET, |
| 161 | .procname = "reset", |
| 162 | .data = &sysctl_netrom_reset_circuit, |
| 163 | .maxlen = sizeof(int), |
| 164 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 165 | .proc_handler = proc_dointvec_minmax, |
| 166 | .strategy = sysctl_intvec, |
Ralf Baechle | e21ce8c | 2005-09-12 14:27:37 -0700 | [diff] [blame] | 167 | .extra1 = &min_reset, |
| 168 | .extra2 = &max_reset |
| 169 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | { .ctl_name = 0 } |
| 171 | }; |
| 172 | |
Pavel Emelyanov | b5ccd79 | 2008-01-09 00:30:05 -0800 | [diff] [blame] | 173 | static struct ctl_path nr_path[] = { |
| 174 | { .procname = "net", .ctl_name = CTL_NET, }, |
| 175 | { .procname = "netrom", .ctl_name = NET_NETROM, }, |
| 176 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | }; |
| 178 | |
| 179 | void __init nr_register_sysctl(void) |
| 180 | { |
Pavel Emelyanov | b5ccd79 | 2008-01-09 00:30:05 -0800 | [diff] [blame] | 181 | nr_table_header = register_sysctl_paths(nr_path, nr_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | void nr_unregister_sysctl(void) |
| 185 | { |
| 186 | unregister_sysctl_table(nr_table_header); |
| 187 | } |