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/rose.h> |
| 14 | |
| 15 | static int min_timer[] = {1 * HZ}; |
| 16 | static int max_timer[] = {300 * HZ}; |
| 17 | static int min_idle[] = {0 * HZ}; |
| 18 | static int max_idle[] = {65535 * HZ}; |
| 19 | static int min_route[1], max_route[] = {1}; |
| 20 | static int min_ftimer[] = {60 * HZ}; |
| 21 | static int max_ftimer[] = {600 * HZ}; |
| 22 | static int min_maxvcs[] = {1}, max_maxvcs[] = {254}; |
| 23 | static int min_window[] = {1}, max_window[] = {7}; |
| 24 | |
| 25 | static struct ctl_table_header *rose_table_header; |
| 26 | |
| 27 | static ctl_table rose_table[] = { |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 28 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | .ctl_name = NET_ROSE_RESTART_REQUEST_TIMEOUT, |
| 30 | .procname = "restart_request_timeout", |
| 31 | .data = &sysctl_rose_restart_request_timeout, |
| 32 | .maxlen = sizeof(int), |
| 33 | .mode = 0644, |
| 34 | .proc_handler = &proc_dointvec_minmax, |
| 35 | .strategy = &sysctl_intvec, |
| 36 | .extra1 = &min_timer, |
| 37 | .extra2 = &max_timer |
| 38 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 39 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | .ctl_name = NET_ROSE_CALL_REQUEST_TIMEOUT, |
| 41 | .procname = "call_request_timeout", |
| 42 | .data = &sysctl_rose_call_request_timeout, |
| 43 | .maxlen = sizeof(int), |
| 44 | .mode = 0644, |
| 45 | .proc_handler = &proc_dointvec_minmax, |
| 46 | .strategy = &sysctl_intvec, |
| 47 | .extra1 = &min_timer, |
| 48 | .extra2 = &max_timer |
| 49 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 50 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | .ctl_name = NET_ROSE_RESET_REQUEST_TIMEOUT, |
| 52 | .procname = "reset_request_timeout", |
| 53 | .data = &sysctl_rose_reset_request_timeout, |
| 54 | .maxlen = sizeof(int), |
| 55 | .mode = 0644, |
| 56 | .proc_handler = &proc_dointvec_minmax, |
| 57 | .strategy = &sysctl_intvec, |
| 58 | .extra1 = &min_timer, |
| 59 | .extra2 = &max_timer |
| 60 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 61 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | .ctl_name = NET_ROSE_CLEAR_REQUEST_TIMEOUT, |
| 63 | .procname = "clear_request_timeout", |
| 64 | .data = &sysctl_rose_clear_request_timeout, |
| 65 | .maxlen = sizeof(int), |
| 66 | .mode = 0644, |
| 67 | .proc_handler = &proc_dointvec_minmax, |
| 68 | .strategy = &sysctl_intvec, |
| 69 | .extra1 = &min_timer, |
| 70 | .extra2 = &max_timer |
| 71 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 72 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | .ctl_name = NET_ROSE_NO_ACTIVITY_TIMEOUT, |
| 74 | .procname = "no_activity_timeout", |
| 75 | .data = &sysctl_rose_no_activity_timeout, |
| 76 | .maxlen = sizeof(int), |
| 77 | .mode = 0644, |
| 78 | .proc_handler = &proc_dointvec_minmax, |
| 79 | .strategy = &sysctl_intvec, |
| 80 | .extra1 = &min_idle, |
| 81 | .extra2 = &max_idle |
| 82 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 83 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | .ctl_name = NET_ROSE_ACK_HOLD_BACK_TIMEOUT, |
| 85 | .procname = "acknowledge_hold_back_timeout", |
| 86 | .data = &sysctl_rose_ack_hold_back_timeout, |
| 87 | .maxlen = sizeof(int), |
| 88 | .mode = 0644, |
| 89 | .proc_handler = &proc_dointvec_minmax, |
| 90 | .strategy = &sysctl_intvec, |
| 91 | .extra1 = &min_timer, |
| 92 | .extra2 = &max_timer |
| 93 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 94 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | .ctl_name = NET_ROSE_ROUTING_CONTROL, |
| 96 | .procname = "routing_control", |
| 97 | .data = &sysctl_rose_routing_control, |
| 98 | .maxlen = sizeof(int), |
| 99 | .mode = 0644, |
| 100 | .proc_handler = &proc_dointvec_minmax, |
| 101 | .strategy = &sysctl_intvec, |
| 102 | .extra1 = &min_route, |
| 103 | .extra2 = &max_route |
| 104 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 105 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | .ctl_name = NET_ROSE_LINK_FAIL_TIMEOUT, |
| 107 | .procname = "link_fail_timeout", |
| 108 | .data = &sysctl_rose_link_fail_timeout, |
| 109 | .maxlen = sizeof(int), |
| 110 | .mode = 0644, |
| 111 | .proc_handler = &proc_dointvec_minmax, |
| 112 | .strategy = &sysctl_intvec, |
| 113 | .extra1 = &min_ftimer, |
| 114 | .extra2 = &max_ftimer |
| 115 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 116 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | .ctl_name = NET_ROSE_MAX_VCS, |
| 118 | .procname = "maximum_virtual_circuits", |
| 119 | .data = &sysctl_rose_maximum_vcs, |
| 120 | .maxlen = sizeof(int), |
| 121 | .mode = 0644, |
| 122 | .proc_handler = &proc_dointvec_minmax, |
| 123 | .strategy = &sysctl_intvec, |
| 124 | .extra1 = &min_maxvcs, |
| 125 | .extra2 = &max_maxvcs |
| 126 | }, |
YOSHIFUJI Hideaki | 3dcf7c5 | 2007-02-09 23:25:12 +0900 | [diff] [blame] | 127 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | .ctl_name = NET_ROSE_WINDOW_SIZE, |
| 129 | .procname = "window_size", |
| 130 | .data = &sysctl_rose_window_size, |
| 131 | .maxlen = sizeof(int), |
| 132 | .mode = 0644, |
| 133 | .proc_handler = &proc_dointvec_minmax, |
| 134 | .strategy = &sysctl_intvec, |
| 135 | .extra1 = &min_window, |
| 136 | .extra2 = &max_window |
| 137 | }, |
| 138 | { .ctl_name = 0 } |
| 139 | }; |
| 140 | |
| 141 | static ctl_table rose_dir_table[] = { |
| 142 | { |
| 143 | .ctl_name = NET_ROSE, |
| 144 | .procname = "rose", |
| 145 | .mode = 0555, |
| 146 | .child = rose_table |
| 147 | }, |
| 148 | { .ctl_name = 0 } |
| 149 | }; |
| 150 | |
| 151 | static ctl_table rose_root_table[] = { |
| 152 | { |
| 153 | .ctl_name = CTL_NET, |
| 154 | .procname = "net", |
| 155 | .mode = 0555, |
| 156 | .child = rose_dir_table |
| 157 | }, |
| 158 | { .ctl_name = 0 } |
| 159 | }; |
| 160 | |
| 161 | void __init rose_register_sysctl(void) |
| 162 | { |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 163 | rose_table_header = register_sysctl_table(rose_root_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | void rose_unregister_sysctl(void) |
| 167 | { |
| 168 | unregister_sysctl_table(rose_table_header); |
| 169 | } |