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 | .procname = "default_path_quality", |
| 40 | .data = &sysctl_netrom_default_path_quality, |
| 41 | .maxlen = sizeof(int), |
| 42 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 43 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | .extra1 = &min_quality, |
| 45 | .extra2 = &max_quality |
| 46 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 47 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | .procname = "obsolescence_count_initialiser", |
| 49 | .data = &sysctl_netrom_obsolescence_count_initialiser, |
| 50 | .maxlen = sizeof(int), |
| 51 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 52 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | .extra1 = &min_obs, |
| 54 | .extra2 = &max_obs |
| 55 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 56 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | .procname = "network_ttl_initialiser", |
| 58 | .data = &sysctl_netrom_network_ttl_initialiser, |
| 59 | .maxlen = sizeof(int), |
| 60 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 61 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | .extra1 = &min_ttl, |
| 63 | .extra2 = &max_ttl |
| 64 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 65 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | .procname = "transport_timeout", |
| 67 | .data = &sysctl_netrom_transport_timeout, |
| 68 | .maxlen = sizeof(int), |
| 69 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 70 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | .extra1 = &min_t1, |
| 72 | .extra2 = &max_t1 |
| 73 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 74 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | .procname = "transport_maximum_tries", |
| 76 | .data = &sysctl_netrom_transport_maximum_tries, |
| 77 | .maxlen = sizeof(int), |
| 78 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 79 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | .extra1 = &min_n2, |
| 81 | .extra2 = &max_n2 |
| 82 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 83 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | .procname = "transport_acknowledge_delay", |
| 85 | .data = &sysctl_netrom_transport_acknowledge_delay, |
| 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, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | .extra1 = &min_t2, |
| 90 | .extra2 = &max_t2 |
| 91 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 92 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | .procname = "transport_busy_delay", |
| 94 | .data = &sysctl_netrom_transport_busy_delay, |
| 95 | .maxlen = sizeof(int), |
| 96 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 97 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | .extra1 = &min_t4, |
| 99 | .extra2 = &max_t4 |
| 100 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 101 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | .procname = "transport_requested_window_size", |
| 103 | .data = &sysctl_netrom_transport_requested_window_size, |
| 104 | .maxlen = sizeof(int), |
| 105 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 106 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | .extra1 = &min_window, |
| 108 | .extra2 = &max_window |
| 109 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 110 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | .procname = "transport_no_activity_timeout", |
| 112 | .data = &sysctl_netrom_transport_no_activity_timeout, |
| 113 | .maxlen = sizeof(int), |
| 114 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 115 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | .extra1 = &min_idle, |
| 117 | .extra2 = &max_idle |
| 118 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 119 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | .procname = "routing_control", |
| 121 | .data = &sysctl_netrom_routing_control, |
| 122 | .maxlen = sizeof(int), |
| 123 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 124 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | .extra1 = &min_route, |
| 126 | .extra2 = &max_route |
| 127 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 128 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | .procname = "link_fails_count", |
| 130 | .data = &sysctl_netrom_link_fails_count, |
| 131 | .maxlen = sizeof(int), |
| 132 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 133 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | .extra1 = &min_fails, |
| 135 | .extra2 = &max_fails |
| 136 | }, |
YOSHIFUJI Hideaki | 5f8f59d | 2007-02-09 23:25:09 +0900 | [diff] [blame] | 137 | { |
Ralf Baechle | e21ce8c | 2005-09-12 14:27:37 -0700 | [diff] [blame] | 138 | .procname = "reset", |
| 139 | .data = &sysctl_netrom_reset_circuit, |
| 140 | .maxlen = sizeof(int), |
| 141 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 142 | .proc_handler = proc_dointvec_minmax, |
Ralf Baechle | e21ce8c | 2005-09-12 14:27:37 -0700 | [diff] [blame] | 143 | .extra1 = &min_reset, |
| 144 | .extra2 = &max_reset |
| 145 | }, |
Eric W. Biederman | f8572d8 | 2009-11-05 13:32:03 -0800 | [diff] [blame] | 146 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | }; |
| 148 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | void __init nr_register_sysctl(void) |
| 150 | { |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 151 | nr_table_header = register_net_sysctl(&init_net, "net/netrom", nr_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | void nr_unregister_sysctl(void) |
| 155 | { |
Eric W. Biederman | 5dd3df1 | 2012-04-19 13:24:33 +0000 | [diff] [blame] | 156 | unregister_net_sysctl_table(nr_table_header); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | } |