diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2009-11-05 08:26:41 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2009-11-11 03:42:05 -0500 |
commit | 26a7034b40ba80f82f64fa251a2cbf49f9971c6a (patch) | |
tree | b2f72e19e51d04c6f18398ca08f8b2e8519ee65e /kernel/sysctl_binary.c | |
parent | 642c6d946b5cdc27d0146c41dc20b7c4d4c3ccd8 (diff) |
sysctl: Reduce sys_sysctl to a compatibility wrapper around /proc/sys
To simply maintenance and to be able to remove all of the binary
sysctl support from various subsystems I have rewritten the binary
sysctl code as a compatibility wrapper around proc/sys.
The code is built around a hard coded table based on the table
in sysctl_check.c that lists all of our current binary sysctls
and provides enough information to convert from the sysctl
binary input into into ascii and back again. New in this
patch is the realization that the only dynamic entries
that need to be handled have ifname as the asscii string
and ifindex as their ctl_name.
When a sys_sysctl is called the code now looks in the
translation table converting the binary name to the
path under /proc where the value is to be found. Opens
that file, and calls into a format conversion wrapper
that calls fop->read and then fop->write as appropriate.
Since in practice the practically no one uses or tests
sys_sysctl rewritting the code to be beautiful is a little
silly. The redeeming merit of this work is it allows us to
rip out all of the binary sysctl syscall support from
everywhere else in the tree. Allowing us to remove
a lot of dead (after this patch) and barely maintained code.
In addition it becomes much easier to optimize the sysctl
implementation for being the backing store of /proc/sys,
without having to worry about sys_sysctl.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kernel/sysctl_binary.c')
-rw-r--r-- | kernel/sysctl_binary.c | 1485 |
1 files changed, 1383 insertions, 102 deletions
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c index 642019894299..471438bbece6 100644 --- a/kernel/sysctl_binary.c +++ b/kernel/sysctl_binary.c | |||
@@ -12,108 +12,1385 @@ | |||
12 | #include <linux/pid_namespace.h> | 12 | #include <linux/pid_namespace.h> |
13 | #include <linux/file.h> | 13 | #include <linux/file.h> |
14 | #include <linux/ctype.h> | 14 | #include <linux/ctype.h> |
15 | #include <linux/smp_lock.h> | ||
16 | 15 | ||
17 | #ifdef CONFIG_SYSCTL_SYSCALL | 16 | #ifdef CONFIG_SYSCTL_SYSCALL |
18 | 17 | ||
19 | /* Perform the actual read/write of a sysctl table entry. */ | 18 | struct bin_table; |
20 | static int do_sysctl_strategy(struct ctl_table_root *root, | 19 | typedef ssize_t bin_convert_t(struct file *file, |
21 | struct ctl_table *table, | 20 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen); |
22 | void __user *oldval, size_t __user *oldlenp, | 21 | |
23 | void __user *newval, size_t newlen) | 22 | static bin_convert_t bin_dir; |
23 | static bin_convert_t bin_string; | ||
24 | static bin_convert_t bin_intvec; | ||
25 | static bin_convert_t bin_ulongvec; | ||
26 | static bin_convert_t bin_uuid; | ||
27 | static bin_convert_t bin_dn_node_address; | ||
28 | |||
29 | #define CTL_DIR bin_dir | ||
30 | #define CTL_STR bin_string | ||
31 | #define CTL_INT bin_intvec | ||
32 | #define CTL_ULONG bin_ulongvec | ||
33 | #define CTL_UUID bin_uuid | ||
34 | #define CTL_DNADR bin_dn_node_address | ||
35 | |||
36 | #define BUFSZ 256 | ||
37 | |||
38 | struct bin_table { | ||
39 | bin_convert_t *convert; | ||
40 | int ctl_name; | ||
41 | const char *procname; | ||
42 | const struct bin_table *child; | ||
43 | }; | ||
44 | |||
45 | static const struct bin_table bin_random_table[] = { | ||
46 | { CTL_INT, RANDOM_POOLSIZE, "poolsize" }, | ||
47 | { CTL_INT, RANDOM_ENTROPY_COUNT, "entropy_avail" }, | ||
48 | { CTL_INT, RANDOM_READ_THRESH, "read_wakeup_threshold" }, | ||
49 | { CTL_INT, RANDOM_WRITE_THRESH, "write_wakeup_threshold" }, | ||
50 | { CTL_UUID, RANDOM_BOOT_ID, "boot_id" }, | ||
51 | { CTL_UUID, RANDOM_UUID, "uuid" }, | ||
52 | {} | ||
53 | }; | ||
54 | |||
55 | static const struct bin_table bin_pty_table[] = { | ||
56 | { CTL_INT, PTY_MAX, "max" }, | ||
57 | { CTL_INT, PTY_NR, "nr" }, | ||
58 | {} | ||
59 | }; | ||
60 | |||
61 | static const struct bin_table bin_kern_table[] = { | ||
62 | { CTL_STR, KERN_OSTYPE, "ostype" }, | ||
63 | { CTL_STR, KERN_OSRELEASE, "osrelease" }, | ||
64 | /* KERN_OSREV not used */ | ||
65 | { CTL_STR, KERN_VERSION, "version" }, | ||
66 | /* KERN_SECUREMASK not used */ | ||
67 | /* KERN_PROF not used */ | ||
68 | { CTL_STR, KERN_NODENAME, "hostname" }, | ||
69 | { CTL_STR, KERN_DOMAINNAME, "domainname" }, | ||
70 | |||
71 | { CTL_INT, KERN_PANIC, "panic" }, | ||
72 | { CTL_INT, KERN_REALROOTDEV, "real-root-dev" }, | ||
73 | |||
74 | { CTL_STR, KERN_SPARC_REBOOT, "reboot-cmd" }, | ||
75 | { CTL_INT, KERN_CTLALTDEL, "ctrl-alt-del" }, | ||
76 | { CTL_INT, KERN_PRINTK, "printk" }, | ||
77 | |||
78 | /* KERN_NAMETRANS not used */ | ||
79 | /* KERN_PPC_HTABRECLAIM not used */ | ||
80 | /* KERN_PPC_ZEROPAGED not used */ | ||
81 | { CTL_INT, KERN_PPC_POWERSAVE_NAP, "powersave-nap" }, | ||
82 | |||
83 | { CTL_STR, KERN_MODPROBE, "modprobe" }, | ||
84 | { CTL_INT, KERN_SG_BIG_BUFF, "sg-big-buff" }, | ||
85 | { CTL_INT, KERN_ACCT, "acct" }, | ||
86 | /* KERN_PPC_L2CR "l2cr" no longer used */ | ||
87 | |||
88 | /* KERN_RTSIGNR not used */ | ||
89 | /* KERN_RTSIGMAX not used */ | ||
90 | |||
91 | { CTL_ULONG, KERN_SHMMAX, "shmmax" }, | ||
92 | { CTL_INT, KERN_MSGMAX, "msgmax" }, | ||
93 | { CTL_INT, KERN_MSGMNB, "msgmnb" }, | ||
94 | /* KERN_MSGPOOL not used*/ | ||
95 | { CTL_INT, KERN_SYSRQ, "sysrq" }, | ||
96 | { CTL_INT, KERN_MAX_THREADS, "threads-max" }, | ||
97 | { CTL_DIR, KERN_RANDOM, "random", bin_random_table }, | ||
98 | { CTL_ULONG, KERN_SHMALL, "shmall" }, | ||
99 | { CTL_INT, KERN_MSGMNI, "msgmni" }, | ||
100 | { CTL_INT, KERN_SEM, "sem" }, | ||
101 | { CTL_INT, KERN_SPARC_STOP_A, "stop-a" }, | ||
102 | { CTL_INT, KERN_SHMMNI, "shmmni" }, | ||
103 | |||
104 | { CTL_INT, KERN_OVERFLOWUID, "overflowuid" }, | ||
105 | { CTL_INT, KERN_OVERFLOWGID, "overflowgid" }, | ||
106 | |||
107 | { CTL_STR, KERN_HOTPLUG, "hotplug", }, | ||
108 | { CTL_INT, KERN_IEEE_EMULATION_WARNINGS, "ieee_emulation_warnings" }, | ||
109 | |||
110 | { CTL_INT, KERN_S390_USER_DEBUG_LOGGING, "userprocess_debug" }, | ||
111 | { CTL_INT, KERN_CORE_USES_PID, "core_uses_pid" }, | ||
112 | /* KERN_TAINTED "tainted" no longer used */ | ||
113 | { CTL_INT, KERN_CADPID, "cad_pid" }, | ||
114 | { CTL_INT, KERN_PIDMAX, "pid_max" }, | ||
115 | { CTL_STR, KERN_CORE_PATTERN, "core_pattern" }, | ||
116 | { CTL_INT, KERN_PANIC_ON_OOPS, "panic_on_oops" }, | ||
117 | { CTL_INT, KERN_HPPA_PWRSW, "soft-power" }, | ||
118 | { CTL_INT, KERN_HPPA_UNALIGNED, "unaligned-trap" }, | ||
119 | |||
120 | { CTL_INT, KERN_PRINTK_RATELIMIT, "printk_ratelimit" }, | ||
121 | { CTL_INT, KERN_PRINTK_RATELIMIT_BURST, "printk_ratelimit_burst" }, | ||
122 | |||
123 | { CTL_DIR, KERN_PTY, "pty", bin_pty_table }, | ||
124 | { CTL_INT, KERN_NGROUPS_MAX, "ngroups_max" }, | ||
125 | { CTL_INT, KERN_SPARC_SCONS_PWROFF, "scons-poweroff" }, | ||
126 | /* KERN_HZ_TIMER "hz_timer" no longer used */ | ||
127 | { CTL_INT, KERN_UNKNOWN_NMI_PANIC, "unknown_nmi_panic" }, | ||
128 | { CTL_INT, KERN_BOOTLOADER_TYPE, "bootloader_type" }, | ||
129 | { CTL_INT, KERN_RANDOMIZE, "randomize_va_space" }, | ||
130 | |||
131 | { CTL_INT, KERN_SPIN_RETRY, "spin_retry" }, | ||
132 | /* KERN_ACPI_VIDEO_FLAGS "acpi_video_flags" no longer used */ | ||
133 | { CTL_INT, KERN_IA64_UNALIGNED, "ignore-unaligned-usertrap" }, | ||
134 | { CTL_INT, KERN_COMPAT_LOG, "compat-log" }, | ||
135 | { CTL_INT, KERN_MAX_LOCK_DEPTH, "max_lock_depth" }, | ||
136 | { CTL_INT, KERN_NMI_WATCHDOG, "nmi_watchdog" }, | ||
137 | { CTL_INT, KERN_PANIC_ON_NMI, "panic_on_unrecovered_nmi" }, | ||
138 | {} | ||
139 | }; | ||
140 | |||
141 | static const struct bin_table bin_vm_table[] = { | ||
142 | { CTL_INT, VM_OVERCOMMIT_MEMORY, "overcommit_memory" }, | ||
143 | { CTL_INT, VM_PAGE_CLUSTER, "page-cluster" }, | ||
144 | { CTL_INT, VM_DIRTY_BACKGROUND, "dirty_background_ratio" }, | ||
145 | { CTL_INT, VM_DIRTY_RATIO, "dirty_ratio" }, | ||
146 | /* VM_DIRTY_WB_CS "dirty_writeback_centisecs" no longer used */ | ||
147 | /* VM_DIRTY_EXPIRE_CS "dirty_expire_centisecs" no longer used */ | ||
148 | { CTL_INT, VM_NR_PDFLUSH_THREADS, "nr_pdflush_threads" }, | ||
149 | { CTL_INT, VM_OVERCOMMIT_RATIO, "overcommit_ratio" }, | ||
150 | /* VM_PAGEBUF unused */ | ||
151 | /* VM_HUGETLB_PAGES "nr_hugepages" no longer used */ | ||
152 | { CTL_INT, VM_SWAPPINESS, "swappiness" }, | ||
153 | { CTL_INT, VM_LOWMEM_RESERVE_RATIO, "lowmem_reserve_ratio" }, | ||
154 | { CTL_INT, VM_MIN_FREE_KBYTES, "min_free_kbytes" }, | ||
155 | { CTL_INT, VM_MAX_MAP_COUNT, "max_map_count" }, | ||
156 | { CTL_INT, VM_LAPTOP_MODE, "laptop_mode" }, | ||
157 | { CTL_INT, VM_BLOCK_DUMP, "block_dump" }, | ||
158 | { CTL_INT, VM_HUGETLB_GROUP, "hugetlb_shm_group" }, | ||
159 | { CTL_INT, VM_VFS_CACHE_PRESSURE, "vfs_cache_pressure" }, | ||
160 | { CTL_INT, VM_LEGACY_VA_LAYOUT, "legacy_va_layout" }, | ||
161 | /* VM_SWAP_TOKEN_TIMEOUT unused */ | ||
162 | { CTL_INT, VM_DROP_PAGECACHE, "drop_caches" }, | ||
163 | { CTL_INT, VM_PERCPU_PAGELIST_FRACTION, "percpu_pagelist_fraction" }, | ||
164 | { CTL_INT, VM_ZONE_RECLAIM_MODE, "zone_reclaim_mode" }, | ||
165 | { CTL_INT, VM_MIN_UNMAPPED, "min_unmapped_ratio" }, | ||
166 | { CTL_INT, VM_PANIC_ON_OOM, "panic_on_oom" }, | ||
167 | { CTL_INT, VM_VDSO_ENABLED, "vdso_enabled" }, | ||
168 | { CTL_INT, VM_MIN_SLAB, "min_slab_ratio" }, | ||
169 | |||
170 | {} | ||
171 | }; | ||
172 | |||
173 | static const struct bin_table bin_net_core_table[] = { | ||
174 | { CTL_INT, NET_CORE_WMEM_MAX, "wmem_max" }, | ||
175 | { CTL_INT, NET_CORE_RMEM_MAX, "rmem_max" }, | ||
176 | { CTL_INT, NET_CORE_WMEM_DEFAULT, "wmem_default" }, | ||
177 | { CTL_INT, NET_CORE_RMEM_DEFAULT, "rmem_default" }, | ||
178 | /* NET_CORE_DESTROY_DELAY unused */ | ||
179 | { CTL_INT, NET_CORE_MAX_BACKLOG, "netdev_max_backlog" }, | ||
180 | /* NET_CORE_FASTROUTE unused */ | ||
181 | { CTL_INT, NET_CORE_MSG_COST, "message_cost" }, | ||
182 | { CTL_INT, NET_CORE_MSG_BURST, "message_burst" }, | ||
183 | { CTL_INT, NET_CORE_OPTMEM_MAX, "optmem_max" }, | ||
184 | /* NET_CORE_HOT_LIST_LENGTH unused */ | ||
185 | /* NET_CORE_DIVERT_VERSION unused */ | ||
186 | /* NET_CORE_NO_CONG_THRESH unused */ | ||
187 | /* NET_CORE_NO_CONG unused */ | ||
188 | /* NET_CORE_LO_CONG unused */ | ||
189 | /* NET_CORE_MOD_CONG unused */ | ||
190 | { CTL_INT, NET_CORE_DEV_WEIGHT, "dev_weight" }, | ||
191 | { CTL_INT, NET_CORE_SOMAXCONN, "somaxconn" }, | ||
192 | { CTL_INT, NET_CORE_BUDGET, "netdev_budget" }, | ||
193 | { CTL_INT, NET_CORE_AEVENT_ETIME, "xfrm_aevent_etime" }, | ||
194 | { CTL_INT, NET_CORE_AEVENT_RSEQTH, "xfrm_aevent_rseqth" }, | ||
195 | { CTL_INT, NET_CORE_WARNINGS, "warnings" }, | ||
196 | {}, | ||
197 | }; | ||
198 | |||
199 | static const struct bin_table bin_net_unix_table[] = { | ||
200 | /* NET_UNIX_DESTROY_DELAY unused */ | ||
201 | /* NET_UNIX_DELETE_DELAY unused */ | ||
202 | { CTL_INT, NET_UNIX_MAX_DGRAM_QLEN, "max_dgram_qlen" }, | ||
203 | {} | ||
204 | }; | ||
205 | |||
206 | static const struct bin_table bin_net_ipv4_route_table[] = { | ||
207 | { CTL_INT, NET_IPV4_ROUTE_FLUSH, "flush" }, | ||
208 | /* NET_IPV4_ROUTE_MIN_DELAY "min_delay" no longer used */ | ||
209 | /* NET_IPV4_ROUTE_MAX_DELAY "max_delay" no longer used */ | ||
210 | { CTL_INT, NET_IPV4_ROUTE_GC_THRESH, "gc_thresh" }, | ||
211 | { CTL_INT, NET_IPV4_ROUTE_MAX_SIZE, "max_size" }, | ||
212 | { CTL_INT, NET_IPV4_ROUTE_GC_MIN_INTERVAL, "gc_min_interval" }, | ||
213 | { CTL_INT, NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS, "gc_min_interval_ms" }, | ||
214 | { CTL_INT, NET_IPV4_ROUTE_GC_TIMEOUT, "gc_timeout" }, | ||
215 | { CTL_INT, NET_IPV4_ROUTE_GC_INTERVAL, "gc_interval" }, | ||
216 | { CTL_INT, NET_IPV4_ROUTE_REDIRECT_LOAD, "redirect_load" }, | ||
217 | { CTL_INT, NET_IPV4_ROUTE_REDIRECT_NUMBER, "redirect_number" }, | ||
218 | { CTL_INT, NET_IPV4_ROUTE_REDIRECT_SILENCE, "redirect_silence" }, | ||
219 | { CTL_INT, NET_IPV4_ROUTE_ERROR_COST, "error_cost" }, | ||
220 | { CTL_INT, NET_IPV4_ROUTE_ERROR_BURST, "error_burst" }, | ||
221 | { CTL_INT, NET_IPV4_ROUTE_GC_ELASTICITY, "gc_elasticity" }, | ||
222 | { CTL_INT, NET_IPV4_ROUTE_MTU_EXPIRES, "mtu_expires" }, | ||
223 | { CTL_INT, NET_IPV4_ROUTE_MIN_PMTU, "min_pmtu" }, | ||
224 | { CTL_INT, NET_IPV4_ROUTE_MIN_ADVMSS, "min_adv_mss" }, | ||
225 | { CTL_INT, NET_IPV4_ROUTE_SECRET_INTERVAL, "secret_interval" }, | ||
226 | {} | ||
227 | }; | ||
228 | |||
229 | static const struct bin_table bin_net_ipv4_conf_vars_table[] = { | ||
230 | { CTL_INT, NET_IPV4_CONF_FORWARDING, "forwarding" }, | ||
231 | { CTL_INT, NET_IPV4_CONF_MC_FORWARDING, "mc_forwarding" }, | ||
232 | |||
233 | { CTL_INT, NET_IPV4_CONF_ACCEPT_REDIRECTS, "accept_redirects" }, | ||
234 | { CTL_INT, NET_IPV4_CONF_SECURE_REDIRECTS, "secure_redirects" }, | ||
235 | { CTL_INT, NET_IPV4_CONF_SEND_REDIRECTS, "send_redirects" }, | ||
236 | { CTL_INT, NET_IPV4_CONF_SHARED_MEDIA, "shared_media" }, | ||
237 | { CTL_INT, NET_IPV4_CONF_RP_FILTER, "rp_filter" }, | ||
238 | { CTL_INT, NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "accept_source_route" }, | ||
239 | { CTL_INT, NET_IPV4_CONF_PROXY_ARP, "proxy_arp" }, | ||
240 | { CTL_INT, NET_IPV4_CONF_MEDIUM_ID, "medium_id" }, | ||
241 | { CTL_INT, NET_IPV4_CONF_BOOTP_RELAY, "bootp_relay" }, | ||
242 | { CTL_INT, NET_IPV4_CONF_LOG_MARTIANS, "log_martians" }, | ||
243 | { CTL_INT, NET_IPV4_CONF_TAG, "tag" }, | ||
244 | { CTL_INT, NET_IPV4_CONF_ARPFILTER, "arp_filter" }, | ||
245 | { CTL_INT, NET_IPV4_CONF_ARP_ANNOUNCE, "arp_announce" }, | ||
246 | { CTL_INT, NET_IPV4_CONF_ARP_IGNORE, "arp_ignore" }, | ||
247 | { CTL_INT, NET_IPV4_CONF_ARP_ACCEPT, "arp_accept" }, | ||
248 | { CTL_INT, NET_IPV4_CONF_ARP_NOTIFY, "arp_notify" }, | ||
249 | |||
250 | { CTL_INT, NET_IPV4_CONF_NOXFRM, "disable_xfrm" }, | ||
251 | { CTL_INT, NET_IPV4_CONF_NOPOLICY, "disable_policy" }, | ||
252 | { CTL_INT, NET_IPV4_CONF_FORCE_IGMP_VERSION, "force_igmp_version" }, | ||
253 | { CTL_INT, NET_IPV4_CONF_PROMOTE_SECONDARIES, "promote_secondaries" }, | ||
254 | {} | ||
255 | }; | ||
256 | |||
257 | static const struct bin_table bin_net_ipv4_conf_table[] = { | ||
258 | { CTL_DIR, NET_PROTO_CONF_ALL, "all", bin_net_ipv4_conf_vars_table }, | ||
259 | { CTL_DIR, NET_PROTO_CONF_DEFAULT, "default", bin_net_ipv4_conf_vars_table }, | ||
260 | { CTL_DIR, 0, NULL, bin_net_ipv4_conf_vars_table }, | ||
261 | {} | ||
262 | }; | ||
263 | |||
264 | static const struct bin_table bin_net_neigh_vars_table[] = { | ||
265 | { CTL_INT, NET_NEIGH_MCAST_SOLICIT, "mcast_solicit" }, | ||
266 | { CTL_INT, NET_NEIGH_UCAST_SOLICIT, "ucast_solicit" }, | ||
267 | { CTL_INT, NET_NEIGH_APP_SOLICIT, "app_solicit" }, | ||
268 | /* NET_NEIGH_RETRANS_TIME "retrans_time" no longer used */ | ||
269 | { CTL_INT, NET_NEIGH_REACHABLE_TIME, "base_reachable_time" }, | ||
270 | { CTL_INT, NET_NEIGH_DELAY_PROBE_TIME, "delay_first_probe_time" }, | ||
271 | { CTL_INT, NET_NEIGH_GC_STALE_TIME, "gc_stale_time" }, | ||
272 | { CTL_INT, NET_NEIGH_UNRES_QLEN, "unres_qlen" }, | ||
273 | { CTL_INT, NET_NEIGH_PROXY_QLEN, "proxy_qlen" }, | ||
274 | /* NET_NEIGH_ANYCAST_DELAY "anycast_delay" no longer used */ | ||
275 | /* NET_NEIGH_PROXY_DELAY "proxy_delay" no longer used */ | ||
276 | /* NET_NEIGH_LOCKTIME "locktime" no longer used */ | ||
277 | { CTL_INT, NET_NEIGH_GC_INTERVAL, "gc_interval" }, | ||
278 | { CTL_INT, NET_NEIGH_GC_THRESH1, "gc_thresh1" }, | ||
279 | { CTL_INT, NET_NEIGH_GC_THRESH2, "gc_thresh2" }, | ||
280 | { CTL_INT, NET_NEIGH_GC_THRESH3, "gc_thresh3" }, | ||
281 | { CTL_INT, NET_NEIGH_RETRANS_TIME_MS, "retrans_time_ms" }, | ||
282 | { CTL_INT, NET_NEIGH_REACHABLE_TIME_MS, "base_reachable_time_ms" }, | ||
283 | {} | ||
284 | }; | ||
285 | |||
286 | static const struct bin_table bin_net_neigh_table[] = { | ||
287 | { CTL_DIR, NET_PROTO_CONF_DEFAULT, "default", bin_net_neigh_vars_table }, | ||
288 | { CTL_DIR, 0, NULL, bin_net_neigh_vars_table }, | ||
289 | {} | ||
290 | }; | ||
291 | |||
292 | static const struct bin_table bin_net_ipv4_netfilter_table[] = { | ||
293 | { CTL_INT, NET_IPV4_NF_CONNTRACK_MAX, "ip_conntrack_max" }, | ||
294 | |||
295 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT "ip_conntrack_tcp_timeout_syn_sent" no longer used */ | ||
296 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV "ip_conntrack_tcp_timeout_syn_recv" no longer used */ | ||
297 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED "ip_conntrack_tcp_timeout_established" no longer used */ | ||
298 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT "ip_conntrack_tcp_timeout_fin_wait" no longer used */ | ||
299 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT "ip_conntrack_tcp_timeout_close_wait" no longer used */ | ||
300 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK "ip_conntrack_tcp_timeout_last_ack" no longer used */ | ||
301 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT "ip_conntrack_tcp_timeout_time_wait" no longer used */ | ||
302 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE "ip_conntrack_tcp_timeout_close" no longer used */ | ||
303 | |||
304 | /* NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT "ip_conntrack_udp_timeout" no longer used */ | ||
305 | /* NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM "ip_conntrack_udp_timeout_stream" no longer used */ | ||
306 | /* NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT "ip_conntrack_icmp_timeout" no longer used */ | ||
307 | /* NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT "ip_conntrack_generic_timeout" no longer used */ | ||
308 | |||
309 | { CTL_INT, NET_IPV4_NF_CONNTRACK_BUCKETS, "ip_conntrack_buckets" }, | ||
310 | { CTL_INT, NET_IPV4_NF_CONNTRACK_LOG_INVALID, "ip_conntrack_log_invalid" }, | ||
311 | /* NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS "ip_conntrack_tcp_timeout_max_retrans" no longer used */ | ||
312 | { CTL_INT, NET_IPV4_NF_CONNTRACK_TCP_LOOSE, "ip_conntrack_tcp_loose" }, | ||
313 | { CTL_INT, NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL, "ip_conntrack_tcp_be_liberal" }, | ||
314 | { CTL_INT, NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS, "ip_conntrack_tcp_max_retrans" }, | ||
315 | |||
316 | /* NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED "ip_conntrack_sctp_timeout_closed" no longer used */ | ||
317 | /* NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT "ip_conntrack_sctp_timeout_cookie_wait" no longer used */ | ||
318 | /* NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED "ip_conntrack_sctp_timeout_cookie_echoed" no longer used */ | ||
319 | /* NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED "ip_conntrack_sctp_timeout_established" no longer used */ | ||
320 | /* NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT "ip_conntrack_sctp_timeout_shutdown_sent" no longer used */ | ||
321 | /* NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD "ip_conntrack_sctp_timeout_shutdown_recd" no longer used */ | ||
322 | /* NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT "ip_conntrack_sctp_timeout_shutdown_ack_sent" no longer used */ | ||
323 | |||
324 | { CTL_INT, NET_IPV4_NF_CONNTRACK_COUNT, "ip_conntrack_count" }, | ||
325 | { CTL_INT, NET_IPV4_NF_CONNTRACK_CHECKSUM, "ip_conntrack_checksum" }, | ||
326 | {} | ||
327 | }; | ||
328 | |||
329 | static const struct bin_table bin_net_ipv4_table[] = { | ||
330 | {CTL_INT, NET_IPV4_FORWARD, "ip_forward" }, | ||
331 | |||
332 | { CTL_DIR, NET_IPV4_CONF, "conf", bin_net_ipv4_conf_table }, | ||
333 | { CTL_DIR, NET_IPV4_NEIGH, "neigh", bin_net_neigh_table }, | ||
334 | { CTL_DIR, NET_IPV4_ROUTE, "route", bin_net_ipv4_route_table }, | ||
335 | /* NET_IPV4_FIB_HASH unused */ | ||
336 | { CTL_DIR, NET_IPV4_NETFILTER, "netfilter", bin_net_ipv4_netfilter_table }, | ||
337 | |||
338 | { CTL_INT, NET_IPV4_TCP_TIMESTAMPS, "tcp_timestamps" }, | ||
339 | { CTL_INT, NET_IPV4_TCP_WINDOW_SCALING, "tcp_window_scaling" }, | ||
340 | { CTL_INT, NET_IPV4_TCP_SACK, "tcp_sack" }, | ||
341 | { CTL_INT, NET_IPV4_TCP_RETRANS_COLLAPSE, "tcp_retrans_collapse" }, | ||
342 | { CTL_INT, NET_IPV4_DEFAULT_TTL, "ip_default_ttl" }, | ||
343 | /* NET_IPV4_AUTOCONFIG unused */ | ||
344 | { CTL_INT, NET_IPV4_NO_PMTU_DISC, "ip_no_pmtu_disc" }, | ||
345 | { CTL_INT, NET_IPV4_NONLOCAL_BIND, "ip_nonlocal_bind" }, | ||
346 | { CTL_INT, NET_IPV4_TCP_SYN_RETRIES, "tcp_syn_retries" }, | ||
347 | { CTL_INT, NET_TCP_SYNACK_RETRIES, "tcp_synack_retries" }, | ||
348 | { CTL_INT, NET_TCP_MAX_ORPHANS, "tcp_max_orphans" }, | ||
349 | { CTL_INT, NET_TCP_MAX_TW_BUCKETS, "tcp_max_tw_buckets" }, | ||
350 | { CTL_INT, NET_IPV4_DYNADDR, "ip_dynaddr" }, | ||
351 | { CTL_INT, NET_IPV4_TCP_KEEPALIVE_TIME, "tcp_keepalive_time" }, | ||
352 | { CTL_INT, NET_IPV4_TCP_KEEPALIVE_PROBES, "tcp_keepalive_probes" }, | ||
353 | { CTL_INT, NET_IPV4_TCP_KEEPALIVE_INTVL, "tcp_keepalive_intvl" }, | ||
354 | { CTL_INT, NET_IPV4_TCP_RETRIES1, "tcp_retries1" }, | ||
355 | { CTL_INT, NET_IPV4_TCP_RETRIES2, "tcp_retries2" }, | ||
356 | { CTL_INT, NET_IPV4_TCP_FIN_TIMEOUT, "tcp_fin_timeout" }, | ||
357 | { CTL_INT, NET_TCP_SYNCOOKIES, "tcp_syncookies" }, | ||
358 | { CTL_INT, NET_TCP_TW_RECYCLE, "tcp_tw_recycle" }, | ||
359 | { CTL_INT, NET_TCP_ABORT_ON_OVERFLOW, "tcp_abort_on_overflow" }, | ||
360 | { CTL_INT, NET_TCP_STDURG, "tcp_stdurg" }, | ||
361 | { CTL_INT, NET_TCP_RFC1337, "tcp_rfc1337" }, | ||
362 | { CTL_INT, NET_TCP_MAX_SYN_BACKLOG, "tcp_max_syn_backlog" }, | ||
363 | { CTL_INT, NET_IPV4_LOCAL_PORT_RANGE, "ip_local_port_range" }, | ||
364 | { CTL_INT, NET_IPV4_IGMP_MAX_MEMBERSHIPS, "igmp_max_memberships" }, | ||
365 | { CTL_INT, NET_IPV4_IGMP_MAX_MSF, "igmp_max_msf" }, | ||
366 | { CTL_INT, NET_IPV4_INET_PEER_THRESHOLD, "inet_peer_threshold" }, | ||
367 | { CTL_INT, NET_IPV4_INET_PEER_MINTTL, "inet_peer_minttl" }, | ||
368 | { CTL_INT, NET_IPV4_INET_PEER_MAXTTL, "inet_peer_maxttl" }, | ||
369 | { CTL_INT, NET_IPV4_INET_PEER_GC_MINTIME, "inet_peer_gc_mintime" }, | ||
370 | { CTL_INT, NET_IPV4_INET_PEER_GC_MAXTIME, "inet_peer_gc_maxtime" }, | ||
371 | { CTL_INT, NET_TCP_ORPHAN_RETRIES, "tcp_orphan_retries" }, | ||
372 | { CTL_INT, NET_TCP_FACK, "tcp_fack" }, | ||
373 | { CTL_INT, NET_TCP_REORDERING, "tcp_reordering" }, | ||
374 | { CTL_INT, NET_TCP_ECN, "tcp_ecn" }, | ||
375 | { CTL_INT, NET_TCP_DSACK, "tcp_dsack" }, | ||
376 | { CTL_INT, NET_TCP_MEM, "tcp_mem" }, | ||
377 | { CTL_INT, NET_TCP_WMEM, "tcp_wmem" }, | ||
378 | { CTL_INT, NET_TCP_RMEM, "tcp_rmem" }, | ||
379 | { CTL_INT, NET_TCP_APP_WIN, "tcp_app_win" }, | ||
380 | { CTL_INT, NET_TCP_ADV_WIN_SCALE, "tcp_adv_win_scale" }, | ||
381 | { CTL_INT, NET_TCP_TW_REUSE, "tcp_tw_reuse" }, | ||
382 | { CTL_INT, NET_TCP_FRTO, "tcp_frto" }, | ||
383 | { CTL_INT, NET_TCP_FRTO_RESPONSE, "tcp_frto_response" }, | ||
384 | { CTL_INT, NET_TCP_LOW_LATENCY, "tcp_low_latency" }, | ||
385 | { CTL_INT, NET_TCP_NO_METRICS_SAVE, "tcp_no_metrics_save" }, | ||
386 | { CTL_INT, NET_TCP_MODERATE_RCVBUF, "tcp_moderate_rcvbuf" }, | ||
387 | { CTL_INT, NET_TCP_TSO_WIN_DIVISOR, "tcp_tso_win_divisor" }, | ||
388 | { CTL_STR, NET_TCP_CONG_CONTROL, "tcp_congestion_control" }, | ||
389 | { CTL_INT, NET_TCP_ABC, "tcp_abc" }, | ||
390 | { CTL_INT, NET_TCP_MTU_PROBING, "tcp_mtu_probing" }, | ||
391 | { CTL_INT, NET_TCP_BASE_MSS, "tcp_base_mss" }, | ||
392 | { CTL_INT, NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, "tcp_workaround_signed_windows" }, | ||
393 | { CTL_INT, NET_TCP_DMA_COPYBREAK, "tcp_dma_copybreak" }, | ||
394 | { CTL_INT, NET_TCP_SLOW_START_AFTER_IDLE, "tcp_slow_start_after_idle" }, | ||
395 | { CTL_INT, NET_CIPSOV4_CACHE_ENABLE, "cipso_cache_enable" }, | ||
396 | { CTL_INT, NET_CIPSOV4_CACHE_BUCKET_SIZE, "cipso_cache_bucket_size" }, | ||
397 | { CTL_INT, NET_CIPSOV4_RBM_OPTFMT, "cipso_rbm_optfmt" }, | ||
398 | { CTL_INT, NET_CIPSOV4_RBM_STRICTVALID, "cipso_rbm_strictvalid" }, | ||
399 | /* NET_TCP_AVAIL_CONG_CONTROL "tcp_available_congestion_control" no longer used */ | ||
400 | { CTL_STR, NET_TCP_ALLOWED_CONG_CONTROL, "tcp_allowed_congestion_control" }, | ||
401 | { CTL_INT, NET_TCP_MAX_SSTHRESH, "tcp_max_ssthresh" }, | ||
402 | |||
403 | { CTL_INT, NET_IPV4_ICMP_ECHO_IGNORE_ALL, "icmp_echo_ignore_all" }, | ||
404 | { CTL_INT, NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "icmp_echo_ignore_broadcasts" }, | ||
405 | { CTL_INT, NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "icmp_ignore_bogus_error_responses" }, | ||
406 | { CTL_INT, NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR, "icmp_errors_use_inbound_ifaddr" }, | ||
407 | { CTL_INT, NET_IPV4_ICMP_RATELIMIT, "icmp_ratelimit" }, | ||
408 | { CTL_INT, NET_IPV4_ICMP_RATEMASK, "icmp_ratemask" }, | ||
409 | |||
410 | { CTL_INT, NET_IPV4_IPFRAG_HIGH_THRESH, "ipfrag_high_thresh" }, | ||
411 | { CTL_INT, NET_IPV4_IPFRAG_LOW_THRESH, "ipfrag_low_thresh" }, | ||
412 | { CTL_INT, NET_IPV4_IPFRAG_TIME, "ipfrag_time" }, | ||
413 | |||
414 | { CTL_INT, NET_IPV4_IPFRAG_SECRET_INTERVAL, "ipfrag_secret_interval" }, | ||
415 | /* NET_IPV4_IPFRAG_MAX_DIST "ipfrag_max_dist" no longer used */ | ||
416 | |||
417 | { CTL_INT, 2088 /* NET_IPQ_QMAX */, "ip_queue_maxlen" }, | ||
418 | |||
419 | /* NET_TCP_DEFAULT_WIN_SCALE unused */ | ||
420 | /* NET_TCP_BIC_BETA unused */ | ||
421 | /* NET_IPV4_TCP_MAX_KA_PROBES unused */ | ||
422 | /* NET_IPV4_IP_MASQ_DEBUG unused */ | ||
423 | /* NET_TCP_SYN_TAILDROP unused */ | ||
424 | /* NET_IPV4_ICMP_SOURCEQUENCH_RATE unused */ | ||
425 | /* NET_IPV4_ICMP_DESTUNREACH_RATE unused */ | ||
426 | /* NET_IPV4_ICMP_TIMEEXCEED_RATE unused */ | ||
427 | /* NET_IPV4_ICMP_PARAMPROB_RATE unused */ | ||
428 | /* NET_IPV4_ICMP_ECHOREPLY_RATE unused */ | ||
429 | /* NET_IPV4_ALWAYS_DEFRAG unused */ | ||
430 | {} | ||
431 | }; | ||
432 | |||
433 | static const struct bin_table bin_net_ipx_table[] = { | ||
434 | { CTL_INT, NET_IPX_PPROP_BROADCASTING, "ipx_pprop_broadcasting" }, | ||
435 | /* NET_IPX_FORWARDING unused */ | ||
436 | {} | ||
437 | }; | ||
438 | |||
439 | static const struct bin_table bin_net_atalk_table[] = { | ||
440 | { CTL_INT, NET_ATALK_AARP_EXPIRY_TIME, "aarp-expiry-time" }, | ||
441 | { CTL_INT, NET_ATALK_AARP_TICK_TIME, "aarp-tick-time" }, | ||
442 | { CTL_INT, NET_ATALK_AARP_RETRANSMIT_LIMIT, "aarp-retransmit-limit" }, | ||
443 | { CTL_INT, NET_ATALK_AARP_RESOLVE_TIME, "aarp-resolve-time" }, | ||
444 | {}, | ||
445 | }; | ||
446 | |||
447 | static const struct bin_table bin_net_netrom_table[] = { | ||
448 | { CTL_INT, NET_NETROM_DEFAULT_PATH_QUALITY, "default_path_quality" }, | ||
449 | { CTL_INT, NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER, "obsolescence_count_initialiser" }, | ||
450 | { CTL_INT, NET_NETROM_NETWORK_TTL_INITIALISER, "network_ttl_initialiser" }, | ||
451 | { CTL_INT, NET_NETROM_TRANSPORT_TIMEOUT, "transport_timeout" }, | ||
452 | { CTL_INT, NET_NETROM_TRANSPORT_MAXIMUM_TRIES, "transport_maximum_tries" }, | ||
453 | { CTL_INT, NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY, "transport_acknowledge_delay" }, | ||
454 | { CTL_INT, NET_NETROM_TRANSPORT_BUSY_DELAY, "transport_busy_delay" }, | ||
455 | { CTL_INT, NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE, "transport_requested_window_size" }, | ||
456 | { CTL_INT, NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT, "transport_no_activity_timeout" }, | ||
457 | { CTL_INT, NET_NETROM_ROUTING_CONTROL, "routing_control" }, | ||
458 | { CTL_INT, NET_NETROM_LINK_FAILS_COUNT, "link_fails_count" }, | ||
459 | { CTL_INT, NET_NETROM_RESET, "reset" }, | ||
460 | {} | ||
461 | }; | ||
462 | |||
463 | static const struct bin_table bin_net_ax25_param_table[] = { | ||
464 | { CTL_INT, NET_AX25_IP_DEFAULT_MODE, "ip_default_mode" }, | ||
465 | { CTL_INT, NET_AX25_DEFAULT_MODE, "ax25_default_mode" }, | ||
466 | { CTL_INT, NET_AX25_BACKOFF_TYPE, "backoff_type" }, | ||
467 | { CTL_INT, NET_AX25_CONNECT_MODE, "connect_mode" }, | ||
468 | { CTL_INT, NET_AX25_STANDARD_WINDOW, "standard_window_size" }, | ||
469 | { CTL_INT, NET_AX25_EXTENDED_WINDOW, "extended_window_size" }, | ||
470 | { CTL_INT, NET_AX25_T1_TIMEOUT, "t1_timeout" }, | ||
471 | { CTL_INT, NET_AX25_T2_TIMEOUT, "t2_timeout" }, | ||
472 | { CTL_INT, NET_AX25_T3_TIMEOUT, "t3_timeout" }, | ||
473 | { CTL_INT, NET_AX25_IDLE_TIMEOUT, "idle_timeout" }, | ||
474 | { CTL_INT, NET_AX25_N2, "maximum_retry_count" }, | ||
475 | { CTL_INT, NET_AX25_PACLEN, "maximum_packet_length" }, | ||
476 | { CTL_INT, NET_AX25_PROTOCOL, "protocol" }, | ||
477 | { CTL_INT, NET_AX25_DAMA_SLAVE_TIMEOUT, "dama_slave_timeout" }, | ||
478 | {} | ||
479 | }; | ||
480 | |||
481 | static const struct bin_table bin_net_ax25_table[] = { | ||
482 | { CTL_DIR, 0, NULL, bin_net_ax25_param_table }, | ||
483 | {} | ||
484 | }; | ||
485 | |||
486 | static const struct bin_table bin_net_rose_table[] = { | ||
487 | { CTL_INT, NET_ROSE_RESTART_REQUEST_TIMEOUT, "restart_request_timeout" }, | ||
488 | { CTL_INT, NET_ROSE_CALL_REQUEST_TIMEOUT, "call_request_timeout" }, | ||
489 | { CTL_INT, NET_ROSE_RESET_REQUEST_TIMEOUT, "reset_request_timeout" }, | ||
490 | { CTL_INT, NET_ROSE_CLEAR_REQUEST_TIMEOUT, "clear_request_timeout" }, | ||
491 | { CTL_INT, NET_ROSE_ACK_HOLD_BACK_TIMEOUT, "acknowledge_hold_back_timeout" }, | ||
492 | { CTL_INT, NET_ROSE_ROUTING_CONTROL, "routing_control" }, | ||
493 | { CTL_INT, NET_ROSE_LINK_FAIL_TIMEOUT, "link_fail_timeout" }, | ||
494 | { CTL_INT, NET_ROSE_MAX_VCS, "maximum_virtual_circuits" }, | ||
495 | { CTL_INT, NET_ROSE_WINDOW_SIZE, "window_size" }, | ||
496 | { CTL_INT, NET_ROSE_NO_ACTIVITY_TIMEOUT, "no_activity_timeout" }, | ||
497 | {} | ||
498 | }; | ||
499 | |||
500 | static const struct bin_table bin_net_ipv6_conf_var_table[] = { | ||
501 | { CTL_INT, NET_IPV6_FORWARDING, "forwarding" }, | ||
502 | { CTL_INT, NET_IPV6_HOP_LIMIT, "hop_limit" }, | ||
503 | { CTL_INT, NET_IPV6_MTU, "mtu" }, | ||
504 | { CTL_INT, NET_IPV6_ACCEPT_RA, "accept_ra" }, | ||
505 | { CTL_INT, NET_IPV6_ACCEPT_REDIRECTS, "accept_redirects" }, | ||
506 | { CTL_INT, NET_IPV6_AUTOCONF, "autoconf" }, | ||
507 | { CTL_INT, NET_IPV6_DAD_TRANSMITS, "dad_transmits" }, | ||
508 | { CTL_INT, NET_IPV6_RTR_SOLICITS, "router_solicitations" }, | ||
509 | { CTL_INT, NET_IPV6_RTR_SOLICIT_INTERVAL, "router_solicitation_interval" }, | ||
510 | { CTL_INT, NET_IPV6_RTR_SOLICIT_DELAY, "router_solicitation_delay" }, | ||
511 | { CTL_INT, NET_IPV6_USE_TEMPADDR, "use_tempaddr" }, | ||
512 | { CTL_INT, NET_IPV6_TEMP_VALID_LFT, "temp_valid_lft" }, | ||
513 | { CTL_INT, NET_IPV6_TEMP_PREFERED_LFT, "temp_prefered_lft" }, | ||
514 | { CTL_INT, NET_IPV6_REGEN_MAX_RETRY, "regen_max_retry" }, | ||
515 | { CTL_INT, NET_IPV6_MAX_DESYNC_FACTOR, "max_desync_factor" }, | ||
516 | { CTL_INT, NET_IPV6_MAX_ADDRESSES, "max_addresses" }, | ||
517 | { CTL_INT, NET_IPV6_FORCE_MLD_VERSION, "force_mld_version" }, | ||
518 | { CTL_INT, NET_IPV6_ACCEPT_RA_DEFRTR, "accept_ra_defrtr" }, | ||
519 | { CTL_INT, NET_IPV6_ACCEPT_RA_PINFO, "accept_ra_pinfo" }, | ||
520 | { CTL_INT, NET_IPV6_ACCEPT_RA_RTR_PREF, "accept_ra_rtr_pref" }, | ||
521 | { CTL_INT, NET_IPV6_RTR_PROBE_INTERVAL, "router_probe_interval" }, | ||
522 | { CTL_INT, NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN, "accept_ra_rt_info_max_plen" }, | ||
523 | { CTL_INT, NET_IPV6_PROXY_NDP, "proxy_ndp" }, | ||
524 | { CTL_INT, NET_IPV6_ACCEPT_SOURCE_ROUTE, "accept_source_route" }, | ||
525 | {} | ||
526 | }; | ||
527 | |||
528 | static const struct bin_table bin_net_ipv6_conf_table[] = { | ||
529 | { CTL_DIR, NET_PROTO_CONF_ALL, "all", bin_net_ipv6_conf_var_table }, | ||
530 | { CTL_DIR, NET_PROTO_CONF_DEFAULT, "default", bin_net_ipv6_conf_var_table }, | ||
531 | { CTL_DIR, 0, NULL, bin_net_ipv6_conf_var_table }, | ||
532 | {} | ||
533 | }; | ||
534 | |||
535 | static const struct bin_table bin_net_ipv6_route_table[] = { | ||
536 | /* NET_IPV6_ROUTE_FLUSH "flush" no longer used */ | ||
537 | { CTL_INT, NET_IPV6_ROUTE_GC_THRESH, "gc_thresh" }, | ||
538 | { CTL_INT, NET_IPV6_ROUTE_MAX_SIZE, "max_size" }, | ||
539 | { CTL_INT, NET_IPV6_ROUTE_GC_MIN_INTERVAL, "gc_min_interval" }, | ||
540 | { CTL_INT, NET_IPV6_ROUTE_GC_TIMEOUT, "gc_timeout" }, | ||
541 | { CTL_INT, NET_IPV6_ROUTE_GC_INTERVAL, "gc_interval" }, | ||
542 | { CTL_INT, NET_IPV6_ROUTE_GC_ELASTICITY, "gc_elasticity" }, | ||
543 | { CTL_INT, NET_IPV6_ROUTE_MTU_EXPIRES, "mtu_expires" }, | ||
544 | { CTL_INT, NET_IPV6_ROUTE_MIN_ADVMSS, "min_adv_mss" }, | ||
545 | { CTL_INT, NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS, "gc_min_interval_ms" }, | ||
546 | {} | ||
547 | }; | ||
548 | |||
549 | static const struct bin_table bin_net_ipv6_icmp_table[] = { | ||
550 | { CTL_INT, NET_IPV6_ICMP_RATELIMIT, "ratelimit" }, | ||
551 | {} | ||
552 | }; | ||
553 | |||
554 | static const struct bin_table bin_net_ipv6_table[] = { | ||
555 | { CTL_DIR, NET_IPV6_CONF, "conf", bin_net_ipv6_conf_table }, | ||
556 | { CTL_DIR, NET_IPV6_NEIGH, "neigh", bin_net_neigh_table }, | ||
557 | { CTL_DIR, NET_IPV6_ROUTE, "route", bin_net_ipv6_route_table }, | ||
558 | { CTL_DIR, NET_IPV6_ICMP, "icmp", bin_net_ipv6_icmp_table }, | ||
559 | { CTL_INT, NET_IPV6_BINDV6ONLY, "bindv6only" }, | ||
560 | { CTL_INT, NET_IPV6_IP6FRAG_HIGH_THRESH, "ip6frag_high_thresh" }, | ||
561 | { CTL_INT, NET_IPV6_IP6FRAG_LOW_THRESH, "ip6frag_low_thresh" }, | ||
562 | { CTL_INT, NET_IPV6_IP6FRAG_TIME, "ip6frag_time" }, | ||
563 | { CTL_INT, NET_IPV6_IP6FRAG_SECRET_INTERVAL, "ip6frag_secret_interval" }, | ||
564 | { CTL_INT, NET_IPV6_MLD_MAX_MSF, "mld_max_msf" }, | ||
565 | { CTL_INT, 2088 /* IPQ_QMAX */, "ip6_queue_maxlen" }, | ||
566 | {} | ||
567 | }; | ||
568 | |||
569 | static const struct bin_table bin_net_x25_table[] = { | ||
570 | { CTL_INT, NET_X25_RESTART_REQUEST_TIMEOUT, "restart_request_timeout" }, | ||
571 | { CTL_INT, NET_X25_CALL_REQUEST_TIMEOUT, "call_request_timeout" }, | ||
572 | { CTL_INT, NET_X25_RESET_REQUEST_TIMEOUT, "reset_request_timeout" }, | ||
573 | { CTL_INT, NET_X25_CLEAR_REQUEST_TIMEOUT, "clear_request_timeout" }, | ||
574 | { CTL_INT, NET_X25_ACK_HOLD_BACK_TIMEOUT, "acknowledgement_hold_back_timeout" }, | ||
575 | { CTL_INT, NET_X25_FORWARD, "x25_forward" }, | ||
576 | {} | ||
577 | }; | ||
578 | |||
579 | static const struct bin_table bin_net_tr_table[] = { | ||
580 | { CTL_INT, NET_TR_RIF_TIMEOUT, "rif_timeout" }, | ||
581 | {} | ||
582 | }; | ||
583 | |||
584 | |||
585 | static const struct bin_table bin_net_decnet_conf_vars[] = { | ||
586 | { CTL_INT, NET_DECNET_CONF_DEV_FORWARDING, "forwarding" }, | ||
587 | { CTL_INT, NET_DECNET_CONF_DEV_PRIORITY, "priority" }, | ||
588 | { CTL_INT, NET_DECNET_CONF_DEV_T2, "t2" }, | ||
589 | { CTL_INT, NET_DECNET_CONF_DEV_T3, "t3" }, | ||
590 | {} | ||
591 | }; | ||
592 | |||
593 | static const struct bin_table bin_net_decnet_conf[] = { | ||
594 | { CTL_DIR, NET_DECNET_CONF_ETHER, "ethernet", bin_net_decnet_conf_vars }, | ||
595 | { CTL_DIR, NET_DECNET_CONF_GRE, "ipgre", bin_net_decnet_conf_vars }, | ||
596 | { CTL_DIR, NET_DECNET_CONF_X25, "x25", bin_net_decnet_conf_vars }, | ||
597 | { CTL_DIR, NET_DECNET_CONF_PPP, "ppp", bin_net_decnet_conf_vars }, | ||
598 | { CTL_DIR, NET_DECNET_CONF_DDCMP, "ddcmp", bin_net_decnet_conf_vars }, | ||
599 | { CTL_DIR, NET_DECNET_CONF_LOOPBACK, "loopback", bin_net_decnet_conf_vars }, | ||
600 | { CTL_DIR, 0, NULL, bin_net_decnet_conf_vars }, | ||
601 | {} | ||
602 | }; | ||
603 | |||
604 | static const struct bin_table bin_net_decnet_table[] = { | ||
605 | { CTL_DIR, NET_DECNET_CONF, "conf", bin_net_decnet_conf }, | ||
606 | { CTL_DNADR, NET_DECNET_NODE_ADDRESS, "node_address" }, | ||
607 | { CTL_STR, NET_DECNET_NODE_NAME, "node_name" }, | ||
608 | { CTL_STR, NET_DECNET_DEFAULT_DEVICE, "default_device" }, | ||
609 | { CTL_INT, NET_DECNET_TIME_WAIT, "time_wait" }, | ||
610 | { CTL_INT, NET_DECNET_DN_COUNT, "dn_count" }, | ||
611 | { CTL_INT, NET_DECNET_DI_COUNT, "di_count" }, | ||
612 | { CTL_INT, NET_DECNET_DR_COUNT, "dr_count" }, | ||
613 | { CTL_INT, NET_DECNET_DST_GC_INTERVAL, "dst_gc_interval" }, | ||
614 | { CTL_INT, NET_DECNET_NO_FC_MAX_CWND, "no_fc_max_cwnd" }, | ||
615 | { CTL_INT, NET_DECNET_MEM, "decnet_mem" }, | ||
616 | { CTL_INT, NET_DECNET_RMEM, "decnet_rmem" }, | ||
617 | { CTL_INT, NET_DECNET_WMEM, "decnet_wmem" }, | ||
618 | { CTL_INT, NET_DECNET_DEBUG_LEVEL, "debug" }, | ||
619 | {} | ||
620 | }; | ||
621 | |||
622 | static const struct bin_table bin_net_sctp_table[] = { | ||
623 | { CTL_INT, NET_SCTP_RTO_INITIAL, "rto_initial" }, | ||
624 | { CTL_INT, NET_SCTP_RTO_MIN, "rto_min" }, | ||
625 | { CTL_INT, NET_SCTP_RTO_MAX, "rto_max" }, | ||
626 | { CTL_INT, NET_SCTP_RTO_ALPHA, "rto_alpha_exp_divisor" }, | ||
627 | { CTL_INT, NET_SCTP_RTO_BETA, "rto_beta_exp_divisor" }, | ||
628 | { CTL_INT, NET_SCTP_VALID_COOKIE_LIFE, "valid_cookie_life" }, | ||
629 | { CTL_INT, NET_SCTP_ASSOCIATION_MAX_RETRANS, "association_max_retrans" }, | ||
630 | { CTL_INT, NET_SCTP_PATH_MAX_RETRANS, "path_max_retrans" }, | ||
631 | { CTL_INT, NET_SCTP_MAX_INIT_RETRANSMITS, "max_init_retransmits" }, | ||
632 | { CTL_INT, NET_SCTP_HB_INTERVAL, "hb_interval" }, | ||
633 | { CTL_INT, NET_SCTP_PRESERVE_ENABLE, "cookie_preserve_enable" }, | ||
634 | { CTL_INT, NET_SCTP_MAX_BURST, "max_burst" }, | ||
635 | { CTL_INT, NET_SCTP_ADDIP_ENABLE, "addip_enable" }, | ||
636 | { CTL_INT, NET_SCTP_PRSCTP_ENABLE, "prsctp_enable" }, | ||
637 | { CTL_INT, NET_SCTP_SNDBUF_POLICY, "sndbuf_policy" }, | ||
638 | { CTL_INT, NET_SCTP_SACK_TIMEOUT, "sack_timeout" }, | ||
639 | { CTL_INT, NET_SCTP_RCVBUF_POLICY, "rcvbuf_policy" }, | ||
640 | {} | ||
641 | }; | ||
642 | |||
643 | static const struct bin_table bin_net_llc_llc2_timeout_table[] = { | ||
644 | { CTL_INT, NET_LLC2_ACK_TIMEOUT, "ack" }, | ||
645 | { CTL_INT, NET_LLC2_P_TIMEOUT, "p" }, | ||
646 | { CTL_INT, NET_LLC2_REJ_TIMEOUT, "rej" }, | ||
647 | { CTL_INT, NET_LLC2_BUSY_TIMEOUT, "busy" }, | ||
648 | {} | ||
649 | }; | ||
650 | |||
651 | static const struct bin_table bin_net_llc_station_table[] = { | ||
652 | { CTL_INT, NET_LLC_STATION_ACK_TIMEOUT, "ack_timeout" }, | ||
653 | {} | ||
654 | }; | ||
655 | |||
656 | static const struct bin_table bin_net_llc_llc2_table[] = { | ||
657 | { CTL_DIR, NET_LLC2, "timeout", bin_net_llc_llc2_timeout_table }, | ||
658 | {} | ||
659 | }; | ||
660 | |||
661 | static const struct bin_table bin_net_llc_table[] = { | ||
662 | { CTL_DIR, NET_LLC2, "llc2", bin_net_llc_llc2_table }, | ||
663 | { CTL_DIR, NET_LLC_STATION, "station", bin_net_llc_station_table }, | ||
664 | {} | ||
665 | }; | ||
666 | |||
667 | static const struct bin_table bin_net_netfilter_table[] = { | ||
668 | { CTL_INT, NET_NF_CONNTRACK_MAX, "nf_conntrack_max" }, | ||
669 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT "nf_conntrack_tcp_timeout_syn_sent" no longer used */ | ||
670 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV "nf_conntrack_tcp_timeout_syn_recv" no longer used */ | ||
671 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED "nf_conntrack_tcp_timeout_established" no longer used */ | ||
672 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT "nf_conntrack_tcp_timeout_fin_wait" no longer used */ | ||
673 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT "nf_conntrack_tcp_timeout_close_wait" no longer used */ | ||
674 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK "nf_conntrack_tcp_timeout_last_ack" no longer used */ | ||
675 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT "nf_conntrack_tcp_timeout_time_wait" no longer used */ | ||
676 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE "nf_conntrack_tcp_timeout_close" no longer used */ | ||
677 | /* NET_NF_CONNTRACK_UDP_TIMEOUT "nf_conntrack_udp_timeout" no longer used */ | ||
678 | /* NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM "nf_conntrack_udp_timeout_stream" no longer used */ | ||
679 | /* NET_NF_CONNTRACK_ICMP_TIMEOUT "nf_conntrack_icmp_timeout" no longer used */ | ||
680 | /* NET_NF_CONNTRACK_GENERIC_TIMEOUT "nf_conntrack_generic_timeout" no longer used */ | ||
681 | { CTL_INT, NET_NF_CONNTRACK_BUCKETS, "nf_conntrack_buckets" }, | ||
682 | { CTL_INT, NET_NF_CONNTRACK_LOG_INVALID, "nf_conntrack_log_invalid" }, | ||
683 | /* NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS "nf_conntrack_tcp_timeout_max_retrans" no longer used */ | ||
684 | { CTL_INT, NET_NF_CONNTRACK_TCP_LOOSE, "nf_conntrack_tcp_loose" }, | ||
685 | { CTL_INT, NET_NF_CONNTRACK_TCP_BE_LIBERAL, "nf_conntrack_tcp_be_liberal" }, | ||
686 | { CTL_INT, NET_NF_CONNTRACK_TCP_MAX_RETRANS, "nf_conntrack_tcp_max_retrans" }, | ||
687 | /* NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED "nf_conntrack_sctp_timeout_closed" no longer used */ | ||
688 | /* NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT "nf_conntrack_sctp_timeout_cookie_wait" no longer used */ | ||
689 | /* NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED "nf_conntrack_sctp_timeout_cookie_echoed" no longer used */ | ||
690 | /* NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED "nf_conntrack_sctp_timeout_established" no longer used */ | ||
691 | /* NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT "nf_conntrack_sctp_timeout_shutdown_sent" no longer used */ | ||
692 | /* NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD "nf_conntrack_sctp_timeout_shutdown_recd" no longer used */ | ||
693 | /* NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT "nf_conntrack_sctp_timeout_shutdown_ack_sent" no longer used */ | ||
694 | { CTL_INT, NET_NF_CONNTRACK_COUNT, "nf_conntrack_count" }, | ||
695 | /* NET_NF_CONNTRACK_ICMPV6_TIMEOUT "nf_conntrack_icmpv6_timeout" no longer used */ | ||
696 | /* NET_NF_CONNTRACK_FRAG6_TIMEOUT "nf_conntrack_frag6_timeout" no longer used */ | ||
697 | { CTL_INT, NET_NF_CONNTRACK_FRAG6_LOW_THRESH, "nf_conntrack_frag6_low_thresh" }, | ||
698 | { CTL_INT, NET_NF_CONNTRACK_FRAG6_HIGH_THRESH, "nf_conntrack_frag6_high_thresh" }, | ||
699 | { CTL_INT, NET_NF_CONNTRACK_CHECKSUM, "nf_conntrack_checksum" }, | ||
700 | |||
701 | {} | ||
702 | }; | ||
703 | |||
704 | static const struct bin_table bin_net_irda_table[] = { | ||
705 | { CTL_INT, NET_IRDA_DISCOVERY, "discovery" }, | ||
706 | { CTL_STR, NET_IRDA_DEVNAME, "devname" }, | ||
707 | { CTL_INT, NET_IRDA_DEBUG, "debug" }, | ||
708 | { CTL_INT, NET_IRDA_FAST_POLL, "fast_poll_increase" }, | ||
709 | { CTL_INT, NET_IRDA_DISCOVERY_SLOTS, "discovery_slots" }, | ||
710 | { CTL_INT, NET_IRDA_DISCOVERY_TIMEOUT, "discovery_timeout" }, | ||
711 | { CTL_INT, NET_IRDA_SLOT_TIMEOUT, "slot_timeout" }, | ||
712 | { CTL_INT, NET_IRDA_MAX_BAUD_RATE, "max_baud_rate" }, | ||
713 | { CTL_INT, NET_IRDA_MIN_TX_TURN_TIME, "min_tx_turn_time" }, | ||
714 | { CTL_INT, NET_IRDA_MAX_TX_DATA_SIZE, "max_tx_data_size" }, | ||
715 | { CTL_INT, NET_IRDA_MAX_TX_WINDOW, "max_tx_window" }, | ||
716 | { CTL_INT, NET_IRDA_MAX_NOREPLY_TIME, "max_noreply_time" }, | ||
717 | { CTL_INT, NET_IRDA_WARN_NOREPLY_TIME, "warn_noreply_time" }, | ||
718 | { CTL_INT, NET_IRDA_LAP_KEEPALIVE_TIME, "lap_keepalive_time" }, | ||
719 | {} | ||
720 | }; | ||
721 | |||
722 | static const struct bin_table bin_net_table[] = { | ||
723 | { CTL_DIR, NET_CORE, "core", bin_net_core_table }, | ||
724 | /* NET_ETHER not used */ | ||
725 | /* NET_802 not used */ | ||
726 | { CTL_DIR, NET_UNIX, "unix", bin_net_unix_table }, | ||
727 | { CTL_DIR, NET_IPV4, "ipv4", bin_net_ipv4_table }, | ||
728 | { CTL_DIR, NET_IPX, "ipx", bin_net_ipx_table }, | ||
729 | { CTL_DIR, NET_ATALK, "appletalk", bin_net_atalk_table }, | ||
730 | { CTL_DIR, NET_NETROM, "netrom", bin_net_netrom_table }, | ||
731 | { CTL_DIR, NET_AX25, "ax25", bin_net_ax25_table }, | ||
732 | /* NET_BRIDGE "bridge" no longer used */ | ||
733 | { CTL_DIR, NET_ROSE, "rose", bin_net_rose_table }, | ||
734 | { CTL_DIR, NET_IPV6, "ipv6", bin_net_ipv6_table }, | ||
735 | { CTL_DIR, NET_X25, "x25", bin_net_x25_table }, | ||
736 | { CTL_DIR, NET_TR, "token-ring", bin_net_tr_table }, | ||
737 | { CTL_DIR, NET_DECNET, "decnet", bin_net_decnet_table }, | ||
738 | /* NET_ECONET not used */ | ||
739 | { CTL_DIR, NET_SCTP, "sctp", bin_net_sctp_table }, | ||
740 | { CTL_DIR, NET_LLC, "llc", bin_net_llc_table }, | ||
741 | { CTL_DIR, NET_NETFILTER, "netfilter", bin_net_netfilter_table }, | ||
742 | /* NET_DCCP "dccp" no longer used */ | ||
743 | { CTL_DIR, NET_IRDA, "irda", bin_net_irda_table }, | ||
744 | { CTL_INT, 2089, "nf_conntrack_max" }, | ||
745 | {} | ||
746 | }; | ||
747 | |||
748 | static const struct bin_table bin_fs_quota_table[] = { | ||
749 | { CTL_INT, FS_DQ_LOOKUPS, "lookups" }, | ||
750 | { CTL_INT, FS_DQ_DROPS, "drops" }, | ||
751 | { CTL_INT, FS_DQ_READS, "reads" }, | ||
752 | { CTL_INT, FS_DQ_WRITES, "writes" }, | ||
753 | { CTL_INT, FS_DQ_CACHE_HITS, "cache_hits" }, | ||
754 | { CTL_INT, FS_DQ_ALLOCATED, "allocated_dquots" }, | ||
755 | { CTL_INT, FS_DQ_FREE, "free_dquots" }, | ||
756 | { CTL_INT, FS_DQ_SYNCS, "syncs" }, | ||
757 | { CTL_INT, FS_DQ_WARNINGS, "warnings" }, | ||
758 | {} | ||
759 | }; | ||
760 | |||
761 | static const struct bin_table bin_fs_xfs_table[] = { | ||
762 | { CTL_INT, XFS_SGID_INHERIT, "irix_sgid_inherit" }, | ||
763 | { CTL_INT, XFS_SYMLINK_MODE, "irix_symlink_mode" }, | ||
764 | { CTL_INT, XFS_PANIC_MASK, "panic_mask" }, | ||
765 | |||
766 | { CTL_INT, XFS_ERRLEVEL, "error_level" }, | ||
767 | { CTL_INT, XFS_SYNCD_TIMER, "xfssyncd_centisecs" }, | ||
768 | { CTL_INT, XFS_INHERIT_SYNC, "inherit_sync" }, | ||
769 | { CTL_INT, XFS_INHERIT_NODUMP, "inherit_nodump" }, | ||
770 | { CTL_INT, XFS_INHERIT_NOATIME, "inherit_noatime" }, | ||
771 | { CTL_INT, XFS_BUF_TIMER, "xfsbufd_centisecs" }, | ||
772 | { CTL_INT, XFS_BUF_AGE, "age_buffer_centisecs" }, | ||
773 | { CTL_INT, XFS_INHERIT_NOSYM, "inherit_nosymlinks" }, | ||
774 | { CTL_INT, XFS_ROTORSTEP, "rotorstep" }, | ||
775 | { CTL_INT, XFS_INHERIT_NODFRG, "inherit_nodefrag" }, | ||
776 | { CTL_INT, XFS_FILESTREAM_TIMER, "filestream_centisecs" }, | ||
777 | { CTL_INT, XFS_STATS_CLEAR, "stats_clear" }, | ||
778 | {} | ||
779 | }; | ||
780 | |||
781 | static const struct bin_table bin_fs_ocfs2_nm_table[] = { | ||
782 | { CTL_STR, 1, "hb_ctl_path" }, | ||
783 | {} | ||
784 | }; | ||
785 | |||
786 | static const struct bin_table bin_fs_ocfs2_table[] = { | ||
787 | { CTL_DIR, 1, "nm", bin_fs_ocfs2_nm_table }, | ||
788 | {} | ||
789 | }; | ||
790 | |||
791 | static const struct bin_table bin_inotify_table[] = { | ||
792 | { CTL_INT, INOTIFY_MAX_USER_INSTANCES, "max_user_instances" }, | ||
793 | { CTL_INT, INOTIFY_MAX_USER_WATCHES, "max_user_watches" }, | ||
794 | { CTL_INT, INOTIFY_MAX_QUEUED_EVENTS, "max_queued_events" }, | ||
795 | {} | ||
796 | }; | ||
797 | |||
798 | static const struct bin_table bin_fs_table[] = { | ||
799 | { CTL_INT, FS_NRINODE, "inode-nr" }, | ||
800 | { CTL_INT, FS_STATINODE, "inode-state" }, | ||
801 | /* FS_MAXINODE unused */ | ||
802 | /* FS_NRDQUOT unused */ | ||
803 | /* FS_MAXDQUOT unused */ | ||
804 | /* FS_NRFILE "file-nr" no longer used */ | ||
805 | { CTL_INT, FS_MAXFILE, "file-max" }, | ||
806 | { CTL_INT, FS_DENTRY, "dentry-state" }, | ||
807 | /* FS_NRSUPER unused */ | ||
808 | /* FS_MAXUPSER unused */ | ||
809 | { CTL_INT, FS_OVERFLOWUID, "overflowuid" }, | ||
810 | { CTL_INT, FS_OVERFLOWGID, "overflowgid" }, | ||
811 | { CTL_INT, FS_LEASES, "leases-enable" }, | ||
812 | { CTL_INT, FS_DIR_NOTIFY, "dir-notify-enable" }, | ||
813 | { CTL_INT, FS_LEASE_TIME, "lease-break-time" }, | ||
814 | { CTL_DIR, FS_DQSTATS, "quota", bin_fs_quota_table }, | ||
815 | { CTL_DIR, FS_XFS, "xfs", bin_fs_xfs_table }, | ||
816 | { CTL_ULONG, FS_AIO_NR, "aio-nr" }, | ||
817 | { CTL_ULONG, FS_AIO_MAX_NR, "aio-max-nr" }, | ||
818 | { CTL_DIR, FS_INOTIFY, "inotify", bin_inotify_table }, | ||
819 | { CTL_DIR, FS_OCFS2, "ocfs2", bin_fs_ocfs2_table }, | ||
820 | { CTL_INT, KERN_SETUID_DUMPABLE, "suid_dumpable" }, | ||
821 | {} | ||
822 | }; | ||
823 | |||
824 | static const struct bin_table bin_ipmi_table[] = { | ||
825 | { CTL_INT, DEV_IPMI_POWEROFF_POWERCYCLE, "poweroff_powercycle" }, | ||
826 | {} | ||
827 | }; | ||
828 | |||
829 | static const struct bin_table bin_mac_hid_files[] = { | ||
830 | /* DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES unused */ | ||
831 | /* DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES unused */ | ||
832 | { CTL_INT, DEV_MAC_HID_MOUSE_BUTTON_EMULATION, "mouse_button_emulation" }, | ||
833 | { CTL_INT, DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE, "mouse_button2_keycode" }, | ||
834 | { CTL_INT, DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE, "mouse_button3_keycode" }, | ||
835 | /* DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES unused */ | ||
836 | {} | ||
837 | }; | ||
838 | |||
839 | static const struct bin_table bin_raid_table[] = { | ||
840 | { CTL_INT, DEV_RAID_SPEED_LIMIT_MIN, "speed_limit_min" }, | ||
841 | { CTL_INT, DEV_RAID_SPEED_LIMIT_MAX, "speed_limit_max" }, | ||
842 | {} | ||
843 | }; | ||
844 | |||
845 | static const struct bin_table bin_scsi_table[] = { | ||
846 | { CTL_INT, DEV_SCSI_LOGGING_LEVEL, "logging_level" }, | ||
847 | {} | ||
848 | }; | ||
849 | |||
850 | static const struct bin_table bin_dev_table[] = { | ||
851 | /* DEV_CDROM "cdrom" no longer used */ | ||
852 | /* DEV_HWMON unused */ | ||
853 | /* DEV_PARPORT "parport" no longer used */ | ||
854 | { CTL_DIR, DEV_RAID, "raid", bin_raid_table }, | ||
855 | { CTL_DIR, DEV_MAC_HID, "mac_hid", bin_mac_hid_files }, | ||
856 | { CTL_DIR, DEV_SCSI, "scsi", bin_scsi_table }, | ||
857 | { CTL_DIR, DEV_IPMI, "ipmi", bin_ipmi_table }, | ||
858 | {} | ||
859 | }; | ||
860 | |||
861 | static const struct bin_table bin_bus_isa_table[] = { | ||
862 | { CTL_INT, BUS_ISA_MEM_BASE, "membase" }, | ||
863 | { CTL_INT, BUS_ISA_PORT_BASE, "portbase" }, | ||
864 | { CTL_INT, BUS_ISA_PORT_SHIFT, "portshift" }, | ||
865 | {} | ||
866 | }; | ||
867 | |||
868 | static const struct bin_table bin_bus_table[] = { | ||
869 | { CTL_DIR, CTL_BUS_ISA, "isa", bin_bus_isa_table }, | ||
870 | {} | ||
871 | }; | ||
872 | |||
873 | |||
874 | static const struct bin_table bin_s390dbf_table[] = { | ||
875 | { CTL_INT, 5678 /* CTL_S390DBF_STOPPABLE */, "debug_stoppable" }, | ||
876 | { CTL_INT, 5679 /* CTL_S390DBF_ACTIVE */, "debug_active" }, | ||
877 | {} | ||
878 | }; | ||
879 | |||
880 | static const struct bin_table bin_sunrpc_table[] = { | ||
881 | /* CTL_RPCDEBUG "rpc_debug" no longer used */ | ||
882 | /* CTL_NFSDEBUG "nfs_debug" no longer used */ | ||
883 | /* CTL_NFSDDEBUG "nfsd_debug" no longer used */ | ||
884 | /* CTL_NLMDEBUG "nlm_debug" no longer used */ | ||
885 | |||
886 | { CTL_INT, CTL_SLOTTABLE_UDP, "udp_slot_table_entries" }, | ||
887 | { CTL_INT, CTL_SLOTTABLE_TCP, "tcp_slot_table_entries" }, | ||
888 | { CTL_INT, CTL_MIN_RESVPORT, "min_resvport" }, | ||
889 | { CTL_INT, CTL_MAX_RESVPORT, "max_resvport" }, | ||
890 | {} | ||
891 | }; | ||
892 | |||
893 | static const struct bin_table bin_pm_table[] = { | ||
894 | /* frv specific */ | ||
895 | /* 1 == CTL_PM_SUSPEND "suspend" no longer used" */ | ||
896 | { CTL_INT, 2 /* CTL_PM_CMODE */, "cmode" }, | ||
897 | { CTL_INT, 3 /* CTL_PM_P0 */, "p0" }, | ||
898 | { CTL_INT, 4 /* CTL_PM_CM */, "cm" }, | ||
899 | {} | ||
900 | }; | ||
901 | |||
902 | static const struct bin_table bin_root_table[] = { | ||
903 | { CTL_DIR, CTL_KERN, "kernel", bin_kern_table }, | ||
904 | { CTL_DIR, CTL_VM, "vm", bin_vm_table }, | ||
905 | { CTL_DIR, CTL_NET, "net", bin_net_table }, | ||
906 | /* CTL_PROC not used */ | ||
907 | { CTL_DIR, CTL_FS, "fs", bin_fs_table }, | ||
908 | /* CTL_DEBUG "debug" no longer used */ | ||
909 | { CTL_DIR, CTL_DEV, "dev", bin_dev_table }, | ||
910 | { CTL_DIR, CTL_BUS, "bus", bin_bus_table }, | ||
911 | { CTL_DIR, CTL_ABI, "abi" }, | ||
912 | /* CTL_CPU not used */ | ||
913 | /* CTL_ARLAN "arlan" no longer used */ | ||
914 | { CTL_DIR, CTL_S390DBF, "s390dbf", bin_s390dbf_table }, | ||
915 | { CTL_DIR, CTL_SUNRPC, "sunrpc", bin_sunrpc_table }, | ||
916 | { CTL_DIR, CTL_PM, "pm", bin_pm_table }, | ||
917 | {} | ||
918 | }; | ||
919 | |||
920 | static ssize_t bin_dir(struct file *file, | ||
921 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | ||
922 | { | ||
923 | return -ENOTDIR; | ||
924 | } | ||
925 | |||
926 | |||
927 | static ssize_t bin_string(struct file *file, | ||
928 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | ||
929 | { | ||
930 | ssize_t result, copied = 0; | ||
931 | |||
932 | if (oldval && oldlen) { | ||
933 | char __user *lastp; | ||
934 | loff_t pos = 0; | ||
935 | int ch; | ||
936 | |||
937 | result = vfs_read(file, oldval, oldlen, &pos); | ||
938 | if (result < 0) | ||
939 | goto out; | ||
940 | |||
941 | copied = result; | ||
942 | lastp = oldval + copied - 1; | ||
943 | |||
944 | result = -EFAULT; | ||
945 | if (get_user(ch, lastp)) | ||
946 | goto out; | ||
947 | |||
948 | /* Trim off the trailing newline */ | ||
949 | if (ch == '\n') { | ||
950 | result = -EFAULT; | ||
951 | if (put_user('\0', lastp)) | ||
952 | goto out; | ||
953 | copied -= 1; | ||
954 | } | ||
955 | } | ||
956 | |||
957 | if (newval && newlen) { | ||
958 | loff_t pos = 0; | ||
959 | |||
960 | result = vfs_write(file, newval, newlen, &pos); | ||
961 | if (result < 0) | ||
962 | goto out; | ||
963 | } | ||
964 | |||
965 | result = copied; | ||
966 | out: | ||
967 | return result; | ||
968 | } | ||
969 | |||
970 | static ssize_t bin_intvec(struct file *file, | ||
971 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | ||
972 | { | ||
973 | mm_segment_t old_fs = get_fs(); | ||
974 | ssize_t copied = 0; | ||
975 | char *buffer; | ||
976 | ssize_t result; | ||
977 | |||
978 | result = -ENOMEM; | ||
979 | buffer = kmalloc(BUFSZ, GFP_KERNEL); | ||
980 | if (!buffer) | ||
981 | goto out; | ||
982 | |||
983 | if (oldval && oldlen) { | ||
984 | unsigned __user *vec = oldval; | ||
985 | size_t length = oldlen / sizeof(*vec); | ||
986 | loff_t pos = 0; | ||
987 | char *str, *end; | ||
988 | int i; | ||
989 | |||
990 | set_fs(KERNEL_DS); | ||
991 | result = vfs_read(file, buffer, BUFSZ - 1, &pos); | ||
992 | set_fs(old_fs); | ||
993 | if (result < 0) | ||
994 | goto out_kfree; | ||
995 | |||
996 | str = buffer; | ||
997 | end = str + result; | ||
998 | *end++ = '\0'; | ||
999 | for (i = 0; i < length; i++) { | ||
1000 | unsigned long value; | ||
1001 | |||
1002 | value = simple_strtoul(str, &str, 10); | ||
1003 | while (isspace(*str)) | ||
1004 | str++; | ||
1005 | |||
1006 | result = -EFAULT; | ||
1007 | if (put_user(value, vec + i)) | ||
1008 | goto out_kfree; | ||
1009 | |||
1010 | copied += sizeof(*vec); | ||
1011 | if (!isdigit(*str)) | ||
1012 | break; | ||
1013 | } | ||
1014 | } | ||
1015 | |||
1016 | if (newval && newlen) { | ||
1017 | unsigned __user *vec = newval; | ||
1018 | size_t length = newlen / sizeof(*vec); | ||
1019 | loff_t pos = 0; | ||
1020 | char *str, *end; | ||
1021 | int i; | ||
1022 | |||
1023 | str = buffer; | ||
1024 | end = str + BUFSZ; | ||
1025 | for (i = 0; i < length; i++) { | ||
1026 | unsigned long value; | ||
1027 | |||
1028 | result = -EFAULT; | ||
1029 | if (get_user(value, vec + i)) | ||
1030 | goto out_kfree; | ||
1031 | |||
1032 | str += snprintf(str, end - str, "%lu\t", value); | ||
1033 | } | ||
1034 | |||
1035 | set_fs(KERNEL_DS); | ||
1036 | result = vfs_write(file, buffer, str - buffer, &pos); | ||
1037 | set_fs(old_fs); | ||
1038 | if (result < 0) | ||
1039 | goto out_kfree; | ||
1040 | } | ||
1041 | result = copied; | ||
1042 | out_kfree: | ||
1043 | kfree(buffer); | ||
1044 | out: | ||
1045 | return result; | ||
1046 | } | ||
1047 | |||
1048 | static ssize_t bin_ulongvec(struct file *file, | ||
1049 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | ||
24 | { | 1050 | { |
25 | int op = 0, rc; | 1051 | mm_segment_t old_fs = get_fs(); |
26 | 1052 | ssize_t copied = 0; | |
27 | if (oldval) | 1053 | char *buffer; |
28 | op |= MAY_READ; | 1054 | ssize_t result; |
29 | if (newval) | 1055 | |
30 | op |= MAY_WRITE; | 1056 | result = -ENOMEM; |
31 | if (sysctl_perm(root, table, op)) | 1057 | buffer = kmalloc(BUFSZ, GFP_KERNEL); |
32 | return -EPERM; | 1058 | if (!buffer) |
33 | 1059 | goto out; | |
34 | if (table->strategy) { | 1060 | |
35 | rc = table->strategy(table, oldval, oldlenp, newval, newlen); | 1061 | if (oldval && oldlen) { |
36 | if (rc < 0) | 1062 | unsigned long __user *vec = oldval; |
37 | return rc; | 1063 | size_t length = oldlen / sizeof(*vec); |
38 | if (rc > 0) | 1064 | loff_t pos = 0; |
39 | return 0; | 1065 | char *str, *end; |
1066 | int i; | ||
1067 | |||
1068 | set_fs(KERNEL_DS); | ||
1069 | result = vfs_read(file, buffer, BUFSZ - 1, &pos); | ||
1070 | set_fs(old_fs); | ||
1071 | if (result < 0) | ||
1072 | goto out_kfree; | ||
1073 | |||
1074 | str = buffer; | ||
1075 | end = str + result; | ||
1076 | *end++ = '\0'; | ||
1077 | for (i = 0; i < length; i++) { | ||
1078 | unsigned long value; | ||
1079 | |||
1080 | value = simple_strtoul(str, &str, 10); | ||
1081 | while (isspace(*str)) | ||
1082 | str++; | ||
1083 | |||
1084 | result = -EFAULT; | ||
1085 | if (put_user(value, vec + i)) | ||
1086 | goto out_kfree; | ||
1087 | |||
1088 | copied += sizeof(*vec); | ||
1089 | if (!isdigit(*str)) | ||
1090 | break; | ||
1091 | } | ||
40 | } | 1092 | } |
41 | 1093 | ||
42 | /* If there is no strategy routine, or if the strategy returns | 1094 | if (newval && newlen) { |
43 | * zero, proceed with automatic r/w */ | 1095 | unsigned long __user *vec = newval; |
44 | if (table->data && table->maxlen) { | 1096 | size_t length = newlen / sizeof(*vec); |
45 | rc = sysctl_data(table, oldval, oldlenp, newval, newlen); | 1097 | loff_t pos = 0; |
46 | if (rc < 0) | 1098 | char *str, *end; |
47 | return rc; | 1099 | int i; |
1100 | |||
1101 | str = buffer; | ||
1102 | end = str + BUFSZ; | ||
1103 | for (i = 0; i < length; i++) { | ||
1104 | unsigned long value; | ||
1105 | |||
1106 | result = -EFAULT; | ||
1107 | if (get_user(value, vec + i)) | ||
1108 | goto out_kfree; | ||
1109 | |||
1110 | str += snprintf(str, end - str, "%lu\t", value); | ||
1111 | } | ||
1112 | |||
1113 | set_fs(KERNEL_DS); | ||
1114 | result = vfs_write(file, buffer, str - buffer, &pos); | ||
1115 | set_fs(old_fs); | ||
1116 | if (result < 0) | ||
1117 | goto out_kfree; | ||
48 | } | 1118 | } |
49 | return 0; | 1119 | result = copied; |
1120 | out_kfree: | ||
1121 | kfree(buffer); | ||
1122 | out: | ||
1123 | return result; | ||
1124 | } | ||
1125 | |||
1126 | static unsigned hex_value(int ch) | ||
1127 | { | ||
1128 | return isdigit(ch) ? ch - '0' : ((ch | 0x20) - 'a') + 10; | ||
50 | } | 1129 | } |
51 | 1130 | ||
52 | static int parse_table(const int *name, int nlen, | 1131 | static ssize_t bin_uuid(struct file *file, |
53 | void __user *oldval, size_t __user *oldlenp, | 1132 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
54 | void __user *newval, size_t newlen, | ||
55 | struct ctl_table_root *root, | ||
56 | struct ctl_table *table) | ||
57 | { | 1133 | { |
58 | int n; | 1134 | mm_segment_t old_fs = get_fs(); |
1135 | ssize_t result, copied = 0; | ||
1136 | |||
1137 | /* Only supports reads */ | ||
1138 | if (oldval && oldlen) { | ||
1139 | loff_t pos = 0; | ||
1140 | char buf[40], *str = buf; | ||
1141 | unsigned char uuid[16]; | ||
1142 | int i; | ||
1143 | |||
1144 | set_fs(KERNEL_DS); | ||
1145 | result = vfs_read(file, buf, sizeof(buf) - 1, &pos); | ||
1146 | set_fs(old_fs); | ||
1147 | if (result < 0) | ||
1148 | goto out; | ||
1149 | |||
1150 | buf[result] = '\0'; | ||
1151 | |||
1152 | /* Convert the uuid to from a string to binary */ | ||
1153 | for (i = 0; i < 16; i++) { | ||
1154 | result = -EIO; | ||
1155 | if (!isxdigit(str[0]) || !isxdigit(str[1])) | ||
1156 | goto out; | ||
1157 | |||
1158 | uuid[i] = (hex_value(str[0]) << 4) | hex_value(str[1]); | ||
1159 | str += 2; | ||
1160 | if (*str == '-') | ||
1161 | str++; | ||
1162 | } | ||
1163 | |||
1164 | if (oldlen > 16) | ||
1165 | oldlen = 16; | ||
1166 | |||
1167 | result = -EFAULT; | ||
1168 | if (copy_to_user(oldval, uuid, oldlen)) | ||
1169 | goto out; | ||
1170 | |||
1171 | copied = oldlen; | ||
1172 | } | ||
1173 | result = copied; | ||
1174 | out: | ||
1175 | return result; | ||
1176 | } | ||
1177 | |||
1178 | static ssize_t bin_dn_node_address(struct file *file, | ||
1179 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | ||
1180 | { | ||
1181 | mm_segment_t old_fs = get_fs(); | ||
1182 | ssize_t result, copied = 0; | ||
1183 | |||
1184 | if (oldval && oldlen) { | ||
1185 | loff_t pos = 0; | ||
1186 | char buf[15], *nodep; | ||
1187 | unsigned long area, node; | ||
1188 | __le16 dnaddr; | ||
1189 | |||
1190 | set_fs(KERNEL_DS); | ||
1191 | result = vfs_read(file, buf, sizeof(buf) - 1, &pos); | ||
1192 | set_fs(old_fs); | ||
1193 | if (result < 0) | ||
1194 | goto out; | ||
1195 | |||
1196 | buf[result] = '\0'; | ||
1197 | |||
1198 | /* Convert the decnet addresss to binary */ | ||
1199 | result = -EIO; | ||
1200 | nodep = strchr(buf, '.') + 1; | ||
1201 | if (!nodep) | ||
1202 | goto out; | ||
1203 | |||
1204 | area = simple_strtoul(buf, NULL, 10); | ||
1205 | node = simple_strtoul(nodep, NULL, 10); | ||
1206 | |||
1207 | result = -EIO; | ||
1208 | if ((area > 63)||(node > 1023)) | ||
1209 | goto out; | ||
1210 | |||
1211 | dnaddr = cpu_to_le16((area << 10) | node); | ||
1212 | |||
1213 | result = -EFAULT; | ||
1214 | if (put_user(dnaddr, (__le16 __user *)oldval)) | ||
1215 | goto out; | ||
1216 | |||
1217 | copied = sizeof(dnaddr); | ||
1218 | } | ||
1219 | |||
1220 | if (newval && newlen) { | ||
1221 | loff_t pos = 0; | ||
1222 | __le16 dnaddr; | ||
1223 | char buf[15]; | ||
1224 | int len; | ||
1225 | |||
1226 | result = -EINVAL; | ||
1227 | if (newlen != sizeof(dnaddr)) | ||
1228 | goto out; | ||
1229 | |||
1230 | result = -EFAULT; | ||
1231 | if (get_user(dnaddr, (__le16 __user *)newval)) | ||
1232 | goto out; | ||
1233 | |||
1234 | len = snprintf(buf, sizeof(buf), "%hu.%hu", | ||
1235 | le16_to_cpu(dnaddr) >> 10, | ||
1236 | le16_to_cpu(dnaddr) & 0x3ff); | ||
1237 | |||
1238 | set_fs(KERNEL_DS); | ||
1239 | result = vfs_write(file, buf, len, &pos); | ||
1240 | set_fs(old_fs); | ||
1241 | if (result < 0) | ||
1242 | goto out; | ||
1243 | } | ||
1244 | |||
1245 | result = copied; | ||
1246 | out: | ||
1247 | return result; | ||
1248 | } | ||
1249 | |||
1250 | static const struct bin_table *get_sysctl(const int *name, int nlen, char *path) | ||
1251 | { | ||
1252 | const struct bin_table *table = &bin_root_table[0]; | ||
1253 | struct net *net = current->nsproxy->net_ns; | ||
1254 | int ctl_name; | ||
1255 | |||
1256 | memcpy(path, "sys/", 4); | ||
1257 | path += 4; | ||
1258 | |||
59 | repeat: | 1259 | repeat: |
60 | if (!nlen) | 1260 | if (!nlen) |
61 | return -ENOTDIR; | 1261 | return ERR_PTR(-ENOTDIR); |
62 | n = *name; | 1262 | ctl_name = *name; |
63 | for ( ; table->ctl_name || table->procname; table++) { | 1263 | name++; |
64 | if (!table->ctl_name) | 1264 | nlen--; |
65 | continue; | 1265 | for ( ; table->convert; table++) { |
66 | if (n == table->ctl_name) { | 1266 | struct net_device *dev = NULL; |
67 | int error; | 1267 | const char *procname = NULL; |
1268 | |||
1269 | /* Use the well known sysctl number to proc name mapping */ | ||
1270 | if (ctl_name == table->ctl_name) | ||
1271 | procname = table->procname; | ||
1272 | |||
1273 | /* | ||
1274 | * For a wild card entry map from ifindex to network | ||
1275 | * device name. | ||
1276 | */ | ||
1277 | else if (!table->ctl_name) { | ||
1278 | dev = dev_get_by_index(net, ctl_name); | ||
1279 | if (dev) | ||
1280 | procname = dev->name; | ||
1281 | } | ||
1282 | if (procname) { | ||
1283 | int len; | ||
1284 | |||
1285 | len = strlen(procname); | ||
1286 | memcpy(path, procname, len); | ||
1287 | path += len; | ||
1288 | if (dev) | ||
1289 | dev_put(dev); | ||
68 | if (table->child) { | 1290 | if (table->child) { |
69 | if (sysctl_perm(root, table, MAY_EXEC)) | 1291 | *path++ = '/'; |
70 | return -EPERM; | ||
71 | name++; | ||
72 | nlen--; | ||
73 | table = table->child; | 1292 | table = table->child; |
74 | goto repeat; | 1293 | goto repeat; |
75 | } | 1294 | } |
76 | error = do_sysctl_strategy(root, table, | 1295 | *path = '\0'; |
77 | oldval, oldlenp, | 1296 | return table; |
78 | newval, newlen); | ||
79 | return error; | ||
80 | } | 1297 | } |
81 | } | 1298 | } |
82 | return -ENOTDIR; | 1299 | return ERR_PTR(-ENOTDIR); |
83 | } | 1300 | } |
84 | 1301 | ||
85 | static ssize_t binary_sysctl(const int *name, int nlen, | 1302 | static char *sysctl_getname(const int *name, int nlen, const struct bin_table **tablep) |
86 | void __user *oldval, size_t __user *oldlenp, | ||
87 | void __user *newval, size_t newlen) | ||
88 | |||
89 | { | 1303 | { |
90 | struct ctl_table_header *head; | 1304 | char *tmp, *result; |
91 | ssize_t error = -ENOTDIR; | 1305 | |
92 | 1306 | result = ERR_PTR(-ENOMEM); | |
93 | for (head = sysctl_head_next(NULL); head; | 1307 | tmp = __getname(); |
94 | head = sysctl_head_next(head)) { | 1308 | if (tmp) { |
95 | error = parse_table(name, nlen, oldval, oldlenp, | 1309 | const struct bin_table *table = get_sysctl(name, nlen, tmp); |
96 | newval, newlen, | 1310 | result = tmp; |
97 | head->root, head->ctl_table); | 1311 | *tablep = table; |
98 | if (error != -ENOTDIR) { | 1312 | if (IS_ERR(table)) { |
99 | sysctl_head_finish(head); | 1313 | __putname(tmp); |
100 | break; | 1314 | result = ERR_CAST(table); |
101 | } | 1315 | } |
102 | } | 1316 | } |
103 | return error; | 1317 | return result; |
104 | } | 1318 | } |
105 | 1319 | ||
1320 | static ssize_t binary_sysctl(const int *name, int nlen, | ||
1321 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | ||
1322 | { | ||
1323 | const struct bin_table *table = NULL; | ||
1324 | struct nameidata nd; | ||
1325 | struct vfsmount *mnt; | ||
1326 | struct file *file; | ||
1327 | ssize_t result; | ||
1328 | char *pathname; | ||
1329 | int flags; | ||
1330 | int acc_mode, fmode; | ||
1331 | |||
1332 | pathname = sysctl_getname(name, nlen, &table); | ||
1333 | result = PTR_ERR(pathname); | ||
1334 | if (IS_ERR(pathname)) | ||
1335 | goto out; | ||
1336 | |||
1337 | /* How should the sysctl be accessed? */ | ||
1338 | if (oldval && oldlen && newval && newlen) { | ||
1339 | flags = O_RDWR; | ||
1340 | acc_mode = MAY_READ | MAY_WRITE; | ||
1341 | fmode = FMODE_READ | FMODE_WRITE; | ||
1342 | } else if (newval && newlen) { | ||
1343 | flags = O_WRONLY; | ||
1344 | acc_mode = MAY_WRITE; | ||
1345 | fmode = FMODE_WRITE; | ||
1346 | } else if (oldval && oldlen) { | ||
1347 | flags = O_RDONLY; | ||
1348 | acc_mode = MAY_READ; | ||
1349 | fmode = FMODE_READ; | ||
1350 | } else { | ||
1351 | result = 0; | ||
1352 | goto out_putname; | ||
1353 | } | ||
1354 | |||
1355 | mnt = current->nsproxy->pid_ns->proc_mnt; | ||
1356 | result = vfs_path_lookup(mnt->mnt_root, mnt, pathname, 0, &nd); | ||
1357 | if (result) | ||
1358 | goto out_putname; | ||
1359 | |||
1360 | result = may_open(&nd.path, acc_mode, fmode); | ||
1361 | if (result) | ||
1362 | goto out_putpath; | ||
1363 | |||
1364 | file = dentry_open(nd.path.dentry, nd.path.mnt, flags, current_cred()); | ||
1365 | result = PTR_ERR(file); | ||
1366 | if (IS_ERR(file)) | ||
1367 | goto out_putname; | ||
1368 | |||
1369 | result = table->convert(file, oldval, oldlen, newval, newlen); | ||
1370 | |||
1371 | fput(file); | ||
1372 | out_putname: | ||
1373 | putname(pathname); | ||
1374 | out: | ||
1375 | return result; | ||
1376 | |||
1377 | out_putpath: | ||
1378 | path_put(&nd.path); | ||
1379 | goto out_putname; | ||
1380 | } | ||
1381 | |||
1382 | |||
106 | #else /* CONFIG_SYSCTL_SYSCALL */ | 1383 | #else /* CONFIG_SYSCTL_SYSCALL */ |
107 | 1384 | ||
108 | static ssize_t binary_sysctl(const int *ctl_name, int nlen, | 1385 | static ssize_t binary_sysctl(const int *name, int nlen, |
109 | void __user *oldval, size_t __user *oldlenp, | 1386 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
110 | void __user *newval, size_t newlen) | ||
111 | { | 1387 | { |
112 | return -ENOSYS; | 1388 | return -ENOSYS; |
113 | } | 1389 | } |
114 | 1390 | ||
115 | #endif /* CONFIG_SYSCTL_SYSCALL */ | 1391 | #endif /* CONFIG_SYSCTL_SYSCALL */ |
116 | 1392 | ||
1393 | |||
117 | static void deprecated_sysctl_warning(const int *name, int nlen) | 1394 | static void deprecated_sysctl_warning(const int *name, int nlen) |
118 | { | 1395 | { |
119 | static int msg_count; | 1396 | static int msg_count; |
@@ -135,21 +1412,15 @@ static void deprecated_sysctl_warning(const int *name, int nlen) | |||
135 | return; | 1412 | return; |
136 | } | 1413 | } |
137 | 1414 | ||
138 | static int do_sysctl(int __user *args_name, int nlen, | 1415 | static ssize_t do_sysctl(int __user *args_name, int nlen, |
139 | void __user *oldval, size_t __user *oldlenp, | 1416 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
140 | void __user *newval, size_t newlen) | ||
141 | { | 1417 | { |
142 | int name[CTL_MAXNAME]; | 1418 | int name[CTL_MAXNAME]; |
143 | size_t oldlen = 0; | ||
144 | int i; | 1419 | int i; |
145 | 1420 | ||
146 | if (nlen <= 0 || nlen >= CTL_MAXNAME) | 1421 | /* Check args->nlen. */ |
1422 | if (nlen < 0 || nlen > CTL_MAXNAME) | ||
147 | return -ENOTDIR; | 1423 | return -ENOTDIR; |
148 | if (oldval && !oldlenp) | ||
149 | return -EFAULT; | ||
150 | if (oldlenp && get_user(oldlen, oldlenp)) | ||
151 | return -EFAULT; | ||
152 | |||
153 | /* Read in the sysctl name for simplicity */ | 1424 | /* Read in the sysctl name for simplicity */ |
154 | for (i = 0; i < nlen; i++) | 1425 | for (i = 0; i < nlen; i++) |
155 | if (get_user(name[i], args_name + i)) | 1426 | if (get_user(name[i], args_name + i)) |
@@ -157,26 +1428,39 @@ static int do_sysctl(int __user *args_name, int nlen, | |||
157 | 1428 | ||
158 | deprecated_sysctl_warning(name, nlen); | 1429 | deprecated_sysctl_warning(name, nlen); |
159 | 1430 | ||
160 | return binary_sysctl(name, nlen, oldval, oldlenp, newval, newlen); | 1431 | return binary_sysctl(name, nlen, oldval, oldlen, newval, newlen); |
161 | } | 1432 | } |
162 | 1433 | ||
163 | |||
164 | SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args) | 1434 | SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args) |
165 | { | 1435 | { |
166 | struct __sysctl_args tmp; | 1436 | struct __sysctl_args tmp; |
167 | int error; | 1437 | size_t oldlen = 0; |
1438 | ssize_t result; | ||
168 | 1439 | ||
169 | if (copy_from_user(&tmp, args, sizeof(tmp))) | 1440 | if (copy_from_user(&tmp, args, sizeof(tmp))) |
170 | return -EFAULT; | 1441 | return -EFAULT; |
171 | 1442 | ||
172 | lock_kernel(); | 1443 | if (tmp.oldval && !tmp.oldlenp) |
173 | error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp, | 1444 | return -EFAULT; |
174 | tmp.newval, tmp.newlen); | 1445 | |
175 | unlock_kernel(); | 1446 | if (tmp.oldlenp && get_user(oldlen, tmp.oldlenp)) |
1447 | return -EFAULT; | ||
1448 | |||
1449 | result = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, oldlen, | ||
1450 | tmp.newval, tmp.newlen); | ||
1451 | |||
1452 | if (result >= 0) { | ||
1453 | oldlen = result; | ||
1454 | result = 0; | ||
1455 | } | ||
176 | 1456 | ||
177 | return error; | 1457 | if (tmp.oldlenp && put_user(oldlen, tmp.oldlenp)) |
1458 | return -EFAULT; | ||
1459 | |||
1460 | return result; | ||
178 | } | 1461 | } |
179 | 1462 | ||
1463 | |||
180 | #ifdef CONFIG_COMPAT | 1464 | #ifdef CONFIG_COMPAT |
181 | #include <asm/compat.h> | 1465 | #include <asm/compat.h> |
182 | 1466 | ||
@@ -194,34 +1478,31 @@ asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args) | |||
194 | { | 1478 | { |
195 | struct compat_sysctl_args tmp; | 1479 | struct compat_sysctl_args tmp; |
196 | compat_size_t __user *compat_oldlenp; | 1480 | compat_size_t __user *compat_oldlenp; |
197 | size_t __user *oldlenp = NULL; | ||
198 | size_t oldlen = 0; | 1481 | size_t oldlen = 0; |
199 | ssize_t result; | 1482 | ssize_t result; |
200 | 1483 | ||
201 | if (copy_from_user(&tmp, args, sizeof(tmp))) | 1484 | if (copy_from_user(&tmp, args, sizeof(tmp))) |
202 | return -EFAULT; | 1485 | return -EFAULT; |
203 | 1486 | ||
204 | compat_oldlenp = compat_ptr(tmp.oldlenp); | 1487 | if (tmp.oldval && !tmp.oldlenp) |
205 | if (compat_oldlenp) { | 1488 | return -EFAULT; |
206 | oldlenp = compat_alloc_user_space(sizeof(*compat_oldlenp)); | ||
207 | 1489 | ||
208 | if (get_user(oldlen, compat_oldlenp) || | 1490 | compat_oldlenp = compat_ptr(tmp.oldlenp); |
209 | put_user(oldlen, oldlenp)) | 1491 | if (compat_oldlenp && get_user(oldlen, compat_oldlenp)) |
210 | return -EFAULT; | 1492 | return -EFAULT; |
211 | } | ||
212 | 1493 | ||
213 | lock_kernel(); | ||
214 | result = do_sysctl(compat_ptr(tmp.name), tmp.nlen, | 1494 | result = do_sysctl(compat_ptr(tmp.name), tmp.nlen, |
215 | compat_ptr(tmp.oldval), oldlenp, | 1495 | compat_ptr(tmp.oldval), oldlen, |
216 | compat_ptr(tmp.newval), tmp.newlen); | 1496 | compat_ptr(tmp.newval), tmp.newlen); |
217 | unlock_kernel(); | ||
218 | 1497 | ||
219 | if (oldlenp && !result) { | 1498 | if (result >= 0) { |
220 | if (get_user(oldlen, oldlenp) || | 1499 | oldlen = result; |
221 | put_user(oldlen, compat_oldlenp)) | 1500 | result = 0; |
222 | return -EFAULT; | ||
223 | } | 1501 | } |
224 | 1502 | ||
1503 | if (compat_oldlenp && put_user(oldlen, compat_oldlenp)) | ||
1504 | return -EFAULT; | ||
1505 | |||
225 | return result; | 1506 | return result; |
226 | } | 1507 | } |
227 | 1508 | ||