hugetlbfs: fix quota leak
[wrt350n-kernel.git] / kernel / sysctl_check.c
bloba68425a5cc1d7f114fb26c9d515758ff56bcbeb5
1 #include <linux/stat.h>
2 #include <linux/sysctl.h>
3 #include "../arch/s390/appldata/appldata.h"
4 #include "../fs/xfs/linux-2.6/xfs_sysctl.h"
5 #include <linux/sunrpc/debug.h>
6 #include <linux/string.h>
7 #include <net/ip_vs.h>
9 struct trans_ctl_table {
10 int ctl_name;
11 const char *procname;
12 struct trans_ctl_table *child;
15 static struct trans_ctl_table trans_random_table[] = {
16 { RANDOM_POOLSIZE, "poolsize" },
17 { RANDOM_ENTROPY_COUNT, "entropy_avail" },
18 { RANDOM_READ_THRESH, "read_wakeup_threshold" },
19 { RANDOM_WRITE_THRESH, "write_wakeup_threshold" },
20 { RANDOM_BOOT_ID, "boot_id" },
21 { RANDOM_UUID, "uuid" },
25 static struct trans_ctl_table trans_pty_table[] = {
26 { PTY_MAX, "max" },
27 { PTY_NR, "nr" },
31 static struct trans_ctl_table trans_kern_table[] = {
32 { KERN_OSTYPE, "ostype" },
33 { KERN_OSRELEASE, "osrelease" },
34 /* KERN_OSREV not used */
35 { KERN_VERSION, "version" },
36 /* KERN_SECUREMASK not used */
37 /* KERN_PROF not used */
38 { KERN_NODENAME, "hostname" },
39 { KERN_DOMAINNAME, "domainname" },
41 #ifdef CONFIG_SECURITY_CAPABILITIES
42 { KERN_CAP_BSET, "cap-bound" },
43 #endif /* def CONFIG_SECURITY_CAPABILITIES */
45 { KERN_PANIC, "panic" },
46 { KERN_REALROOTDEV, "real-root-dev" },
48 { KERN_SPARC_REBOOT, "reboot-cmd" },
49 { KERN_CTLALTDEL, "ctrl-alt-del" },
50 { KERN_PRINTK, "printk" },
52 /* KERN_NAMETRANS not used */
53 /* KERN_PPC_HTABRECLAIM not used */
54 /* KERN_PPC_ZEROPAGED not used */
55 { KERN_PPC_POWERSAVE_NAP, "powersave-nap" },
57 { KERN_MODPROBE, "modprobe" },
58 { KERN_SG_BIG_BUFF, "sg-big-buff" },
59 { KERN_ACCT, "acct" },
60 { KERN_PPC_L2CR, "l2cr" },
62 /* KERN_RTSIGNR not used */
63 /* KERN_RTSIGMAX not used */
65 { KERN_SHMMAX, "shmmax" },
66 { KERN_MSGMAX, "msgmax" },
67 { KERN_MSGMNB, "msgmnb" },
68 /* KERN_MSGPOOL not used*/
69 { KERN_SYSRQ, "sysrq" },
70 { KERN_MAX_THREADS, "threads-max" },
71 { KERN_RANDOM, "random", trans_random_table },
72 { KERN_SHMALL, "shmall" },
73 { KERN_MSGMNI, "msgmni" },
74 { KERN_SEM, "sem" },
75 { KERN_SPARC_STOP_A, "stop-a" },
76 { KERN_SHMMNI, "shmmni" },
78 { KERN_OVERFLOWUID, "overflowuid" },
79 { KERN_OVERFLOWGID, "overflowgid" },
81 { KERN_HOTPLUG, "hotplug", },
82 { KERN_IEEE_EMULATION_WARNINGS, "ieee_emulation_warnings" },
84 { KERN_S390_USER_DEBUG_LOGGING, "userprocess_debug" },
85 { KERN_CORE_USES_PID, "core_uses_pid" },
86 { KERN_TAINTED, "tainted" },
87 { KERN_CADPID, "cad_pid" },
88 { KERN_PIDMAX, "pid_max" },
89 { KERN_CORE_PATTERN, "core_pattern" },
90 { KERN_PANIC_ON_OOPS, "panic_on_oops" },
91 { KERN_HPPA_PWRSW, "soft-power" },
92 { KERN_HPPA_UNALIGNED, "unaligned-trap" },
94 { KERN_PRINTK_RATELIMIT, "printk_ratelimit" },
95 { KERN_PRINTK_RATELIMIT_BURST, "printk_ratelimit_burst" },
97 { KERN_PTY, "pty", trans_pty_table },
98 { KERN_NGROUPS_MAX, "ngroups_max" },
99 { KERN_SPARC_SCONS_PWROFF, "scons-poweroff" },
100 { KERN_HZ_TIMER, "hz_timer" },
101 { KERN_UNKNOWN_NMI_PANIC, "unknown_nmi_panic" },
102 { KERN_BOOTLOADER_TYPE, "bootloader_type" },
103 { KERN_RANDOMIZE, "randomize_va_space" },
105 { KERN_SPIN_RETRY, "spin_retry" },
106 { KERN_ACPI_VIDEO_FLAGS, "acpi_video_flags" },
107 { KERN_IA64_UNALIGNED, "ignore-unaligned-usertrap" },
108 { KERN_COMPAT_LOG, "compat-log" },
109 { KERN_MAX_LOCK_DEPTH, "max_lock_depth" },
110 { KERN_NMI_WATCHDOG, "nmi_watchdog" },
111 { KERN_PANIC_ON_NMI, "panic_on_unrecovered_nmi" },
115 static struct trans_ctl_table trans_vm_table[] = {
116 { VM_OVERCOMMIT_MEMORY, "overcommit_memory" },
117 { VM_PAGE_CLUSTER, "page-cluster" },
118 { VM_DIRTY_BACKGROUND, "dirty_background_ratio" },
119 { VM_DIRTY_RATIO, "dirty_ratio" },
120 { VM_DIRTY_WB_CS, "dirty_writeback_centisecs" },
121 { VM_DIRTY_EXPIRE_CS, "dirty_expire_centisecs" },
122 { VM_NR_PDFLUSH_THREADS, "nr_pdflush_threads" },
123 { VM_OVERCOMMIT_RATIO, "overcommit_ratio" },
124 /* VM_PAGEBUF unused */
125 { VM_HUGETLB_PAGES, "nr_hugepages" },
126 { VM_SWAPPINESS, "swappiness" },
127 { VM_LOWMEM_RESERVE_RATIO, "lowmem_reserve_ratio" },
128 { VM_MIN_FREE_KBYTES, "min_free_kbytes" },
129 { VM_MAX_MAP_COUNT, "max_map_count" },
130 { VM_LAPTOP_MODE, "laptop_mode" },
131 { VM_BLOCK_DUMP, "block_dump" },
132 { VM_HUGETLB_GROUP, "hugetlb_shm_group" },
133 { VM_VFS_CACHE_PRESSURE, "vfs_cache_pressure" },
134 { VM_LEGACY_VA_LAYOUT, "legacy_va_layout" },
135 /* VM_SWAP_TOKEN_TIMEOUT unused */
136 { VM_DROP_PAGECACHE, "drop_caches" },
137 { VM_PERCPU_PAGELIST_FRACTION, "percpu_pagelist_fraction" },
138 { VM_ZONE_RECLAIM_MODE, "zone_reclaim_mode" },
139 { VM_MIN_UNMAPPED, "min_unmapped_ratio" },
140 { VM_PANIC_ON_OOM, "panic_on_oom" },
141 { VM_VDSO_ENABLED, "vdso_enabled" },
142 { VM_MIN_SLAB, "min_slab_ratio" },
147 static struct trans_ctl_table trans_net_core_table[] = {
148 { NET_CORE_WMEM_MAX, "wmem_max" },
149 { NET_CORE_RMEM_MAX, "rmem_max" },
150 { NET_CORE_WMEM_DEFAULT, "wmem_default" },
151 { NET_CORE_RMEM_DEFAULT, "rmem_default" },
152 /* NET_CORE_DESTROY_DELAY unused */
153 { NET_CORE_MAX_BACKLOG, "netdev_max_backlog" },
154 /* NET_CORE_FASTROUTE unused */
155 { NET_CORE_MSG_COST, "message_cost" },
156 { NET_CORE_MSG_BURST, "message_burst" },
157 { NET_CORE_OPTMEM_MAX, "optmem_max" },
158 /* NET_CORE_HOT_LIST_LENGTH unused */
159 /* NET_CORE_DIVERT_VERSION unused */
160 /* NET_CORE_NO_CONG_THRESH unused */
161 /* NET_CORE_NO_CONG unused */
162 /* NET_CORE_LO_CONG unused */
163 /* NET_CORE_MOD_CONG unused */
164 { NET_CORE_DEV_WEIGHT, "dev_weight" },
165 { NET_CORE_SOMAXCONN, "somaxconn" },
166 { NET_CORE_BUDGET, "netdev_budget" },
167 { NET_CORE_AEVENT_ETIME, "xfrm_aevent_etime" },
168 { NET_CORE_AEVENT_RSEQTH, "xfrm_aevent_rseqth" },
169 { NET_CORE_WARNINGS, "warnings" },
173 static struct trans_ctl_table trans_net_unix_table[] = {
174 /* NET_UNIX_DESTROY_DELAY unused */
175 /* NET_UNIX_DELETE_DELAY unused */
176 { NET_UNIX_MAX_DGRAM_QLEN, "max_dgram_qlen" },
180 static struct trans_ctl_table trans_net_ipv4_route_table[] = {
181 { NET_IPV4_ROUTE_FLUSH, "flush" },
182 { NET_IPV4_ROUTE_MIN_DELAY, "min_delay" },
183 { NET_IPV4_ROUTE_MAX_DELAY, "max_delay" },
184 { NET_IPV4_ROUTE_GC_THRESH, "gc_thresh" },
185 { NET_IPV4_ROUTE_MAX_SIZE, "max_size" },
186 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "gc_min_interval" },
187 { NET_IPV4_ROUTE_GC_TIMEOUT, "gc_timeout" },
188 { NET_IPV4_ROUTE_GC_INTERVAL, "gc_interval" },
189 { NET_IPV4_ROUTE_REDIRECT_LOAD, "redirect_load" },
190 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "redirect_number" },
191 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "redirect_silence" },
192 { NET_IPV4_ROUTE_ERROR_COST, "error_cost" },
193 { NET_IPV4_ROUTE_ERROR_BURST, "error_burst" },
194 { NET_IPV4_ROUTE_GC_ELASTICITY, "gc_elasticity" },
195 { NET_IPV4_ROUTE_MTU_EXPIRES, "mtu_expires" },
196 { NET_IPV4_ROUTE_MIN_PMTU, "min_pmtu" },
197 { NET_IPV4_ROUTE_MIN_ADVMSS, "min_adv_mss" },
198 { NET_IPV4_ROUTE_SECRET_INTERVAL, "secret_interval" },
199 { NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS, "gc_min_interval_ms" },
203 static struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
204 { NET_IPV4_CONF_FORWARDING, "forwarding" },
205 { NET_IPV4_CONF_MC_FORWARDING, "mc_forwarding" },
207 { NET_IPV4_CONF_PROXY_ARP, "proxy_arp" },
208 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "accept_redirects" },
209 { NET_IPV4_CONF_SECURE_REDIRECTS, "secure_redirects" },
210 { NET_IPV4_CONF_SEND_REDIRECTS, "send_redirects" },
211 { NET_IPV4_CONF_SHARED_MEDIA, "shared_media" },
212 { NET_IPV4_CONF_RP_FILTER, "rp_filter" },
213 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "accept_source_route" },
214 { NET_IPV4_CONF_BOOTP_RELAY, "bootp_relay" },
215 { NET_IPV4_CONF_LOG_MARTIANS, "log_martians" },
216 { NET_IPV4_CONF_TAG, "tag" },
217 { NET_IPV4_CONF_ARPFILTER, "arp_filter" },
218 { NET_IPV4_CONF_MEDIUM_ID, "medium_id" },
219 { NET_IPV4_CONF_NOXFRM, "disable_xfrm" },
220 { NET_IPV4_CONF_NOPOLICY, "disable_policy" },
221 { NET_IPV4_CONF_FORCE_IGMP_VERSION, "force_igmp_version" },
223 { NET_IPV4_CONF_ARP_ANNOUNCE, "arp_announce" },
224 { NET_IPV4_CONF_ARP_IGNORE, "arp_ignore" },
225 { NET_IPV4_CONF_PROMOTE_SECONDARIES, "promote_secondaries" },
226 { NET_IPV4_CONF_ARP_ACCEPT, "arp_accept" },
230 static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
231 { NET_PROTO_CONF_ALL, "all", trans_net_ipv4_conf_vars_table },
232 { NET_PROTO_CONF_DEFAULT, "default", trans_net_ipv4_conf_vars_table },
233 { 0, NULL, trans_net_ipv4_conf_vars_table },
237 static struct trans_ctl_table trans_net_neigh_vars_table[] = {
238 { NET_NEIGH_MCAST_SOLICIT, "mcast_solicit" },
239 { NET_NEIGH_UCAST_SOLICIT, "ucast_solicit" },
240 { NET_NEIGH_APP_SOLICIT, "app_solicit" },
241 { NET_NEIGH_RETRANS_TIME, "retrans_time" },
242 { NET_NEIGH_REACHABLE_TIME, "base_reachable_time" },
243 { NET_NEIGH_DELAY_PROBE_TIME, "delay_first_probe_time" },
244 { NET_NEIGH_GC_STALE_TIME, "gc_stale_time" },
245 { NET_NEIGH_UNRES_QLEN, "unres_qlen" },
246 { NET_NEIGH_PROXY_QLEN, "proxy_qlen" },
247 { NET_NEIGH_ANYCAST_DELAY, "anycast_delay" },
248 { NET_NEIGH_PROXY_DELAY, "proxy_delay" },
249 { NET_NEIGH_LOCKTIME, "locktime" },
250 { NET_NEIGH_GC_INTERVAL, "gc_interval" },
251 { NET_NEIGH_GC_THRESH1, "gc_thresh1" },
252 { NET_NEIGH_GC_THRESH2, "gc_thresh2" },
253 { NET_NEIGH_GC_THRESH3, "gc_thresh3" },
254 { NET_NEIGH_RETRANS_TIME_MS, "retrans_time_ms" },
255 { NET_NEIGH_REACHABLE_TIME_MS, "base_reachable_time_ms" },
259 static struct trans_ctl_table trans_net_neigh_table[] = {
260 { NET_PROTO_CONF_DEFAULT, "default", trans_net_neigh_vars_table },
261 { 0, NULL, trans_net_neigh_vars_table },
265 static struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
266 { NET_IPV4_NF_CONNTRACK_MAX, "ip_conntrack_max" },
268 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, "ip_conntrack_tcp_timeout_syn_sent" },
269 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV, "ip_conntrack_tcp_timeout_syn_recv" },
270 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED, "ip_conntrack_tcp_timeout_established" },
271 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT, "ip_conntrack_tcp_timeout_fin_wait" },
272 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT, "ip_conntrack_tcp_timeout_close_wait" },
273 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK, "ip_conntrack_tcp_timeout_last_ack" },
274 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT, "ip_conntrack_tcp_timeout_time_wait" },
275 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE, "ip_conntrack_tcp_timeout_close" },
277 { NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT, "ip_conntrack_udp_timeout" },
278 { NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM, "ip_conntrack_udp_timeout_stream" },
279 { NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT, "ip_conntrack_icmp_timeout" },
280 { NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT, "ip_conntrack_generic_timeout" },
282 { NET_IPV4_NF_CONNTRACK_BUCKETS, "ip_conntrack_buckets" },
283 { NET_IPV4_NF_CONNTRACK_LOG_INVALID, "ip_conntrack_log_invalid" },
284 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS, "ip_conntrack_tcp_timeout_max_retrans" },
285 { NET_IPV4_NF_CONNTRACK_TCP_LOOSE, "ip_conntrack_tcp_loose" },
286 { NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL, "ip_conntrack_tcp_be_liberal" },
287 { NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS, "ip_conntrack_tcp_max_retrans" },
289 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED, "ip_conntrack_sctp_timeout_closed" },
290 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT, "ip_conntrack_sctp_timeout_cookie_wait" },
291 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED, "ip_conntrack_sctp_timeout_cookie_echoed" },
292 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED, "ip_conntrack_sctp_timeout_established" },
293 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT, "ip_conntrack_sctp_timeout_shutdown_sent" },
294 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD, "ip_conntrack_sctp_timeout_shutdown_recd" },
295 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT, "ip_conntrack_sctp_timeout_shutdown_ack_sent" },
297 { NET_IPV4_NF_CONNTRACK_COUNT, "ip_conntrack_count" },
298 { NET_IPV4_NF_CONNTRACK_CHECKSUM, "ip_conntrack_checksum" },
302 static struct trans_ctl_table trans_net_ipv4_table[] = {
303 { NET_IPV4_FORWARD, "ip_forward" },
304 { NET_IPV4_DYNADDR, "ip_dynaddr" },
306 { NET_IPV4_CONF, "conf", trans_net_ipv4_conf_table },
307 { NET_IPV4_NEIGH, "neigh", trans_net_neigh_table },
308 { NET_IPV4_ROUTE, "route", trans_net_ipv4_route_table },
309 /* NET_IPV4_FIB_HASH unused */
310 { NET_IPV4_NETFILTER, "netfilter", trans_net_ipv4_netfilter_table },
312 { NET_IPV4_TCP_TIMESTAMPS, "tcp_timestamps" },
313 { NET_IPV4_TCP_WINDOW_SCALING, "tcp_window_scaling" },
314 { NET_IPV4_TCP_SACK, "tcp_sack" },
315 { NET_IPV4_TCP_RETRANS_COLLAPSE, "tcp_retrans_collapse" },
316 { NET_IPV4_DEFAULT_TTL, "ip_default_ttl" },
317 /* NET_IPV4_AUTOCONFIG unused */
318 { NET_IPV4_NO_PMTU_DISC, "ip_no_pmtu_disc" },
319 { NET_IPV4_TCP_SYN_RETRIES, "tcp_syn_retries" },
320 { NET_IPV4_IPFRAG_HIGH_THRESH, "ipfrag_high_thresh" },
321 { NET_IPV4_IPFRAG_LOW_THRESH, "ipfrag_low_thresh" },
322 { NET_IPV4_IPFRAG_TIME, "ipfrag_time" },
323 /* NET_IPV4_TCP_MAX_KA_PROBES unused */
324 { NET_IPV4_TCP_KEEPALIVE_TIME, "tcp_keepalive_time" },
325 { NET_IPV4_TCP_KEEPALIVE_PROBES, "tcp_keepalive_probes" },
326 { NET_IPV4_TCP_RETRIES1, "tcp_retries1" },
327 { NET_IPV4_TCP_RETRIES2, "tcp_retries2" },
328 { NET_IPV4_TCP_FIN_TIMEOUT, "tcp_fin_timeout" },
329 /* NET_IPV4_IP_MASQ_DEBUG unused */
330 { NET_TCP_SYNCOOKIES, "tcp_syncookies" },
331 { NET_TCP_STDURG, "tcp_stdurg" },
332 { NET_TCP_RFC1337, "tcp_rfc1337" },
333 /* NET_TCP_SYN_TAILDROP unused */
334 { NET_TCP_MAX_SYN_BACKLOG, "tcp_max_syn_backlog" },
335 { NET_IPV4_LOCAL_PORT_RANGE, "ip_local_port_range" },
336 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "icmp_echo_ignore_all" },
337 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "icmp_echo_ignore_broadcasts" },
338 /* NET_IPV4_ICMP_SOURCEQUENCH_RATE unused */
339 /* NET_IPV4_ICMP_DESTUNREACH_RATE unused */
340 /* NET_IPV4_ICMP_TIMEEXCEED_RATE unused */
341 /* NET_IPV4_ICMP_PARAMPROB_RATE unused */
342 /* NET_IPV4_ICMP_ECHOREPLY_RATE unused */
343 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "icmp_ignore_bogus_error_responses" },
344 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "igmp_max_memberships" },
345 { NET_TCP_TW_RECYCLE, "tcp_tw_recycle" },
346 /* NET_IPV4_ALWAYS_DEFRAG unused */
347 { NET_IPV4_TCP_KEEPALIVE_INTVL, "tcp_keepalive_intvl" },
348 { NET_IPV4_INET_PEER_THRESHOLD, "inet_peer_threshold" },
349 { NET_IPV4_INET_PEER_MINTTL, "inet_peer_minttl" },
350 { NET_IPV4_INET_PEER_MAXTTL, "inet_peer_maxttl" },
351 { NET_IPV4_INET_PEER_GC_MINTIME, "inet_peer_gc_mintime" },
352 { NET_IPV4_INET_PEER_GC_MAXTIME, "inet_peer_gc_maxtime" },
353 { NET_TCP_ORPHAN_RETRIES, "tcp_orphan_retries" },
354 { NET_TCP_ABORT_ON_OVERFLOW, "tcp_abort_on_overflow" },
355 { NET_TCP_SYNACK_RETRIES, "tcp_synack_retries" },
356 { NET_TCP_MAX_ORPHANS, "tcp_max_orphans" },
357 { NET_TCP_MAX_TW_BUCKETS, "tcp_max_tw_buckets" },
358 { NET_TCP_FACK, "tcp_fack" },
359 { NET_TCP_REORDERING, "tcp_reordering" },
360 { NET_TCP_ECN, "tcp_ecn" },
361 { NET_TCP_DSACK, "tcp_dsack" },
362 { NET_TCP_MEM, "tcp_mem" },
363 { NET_TCP_WMEM, "tcp_wmem" },
364 { NET_TCP_RMEM, "tcp_rmem" },
365 { NET_TCP_APP_WIN, "tcp_app_win" },
366 { NET_TCP_ADV_WIN_SCALE, "tcp_adv_win_scale" },
367 { NET_IPV4_NONLOCAL_BIND, "ip_nonlocal_bind" },
368 { NET_IPV4_ICMP_RATELIMIT, "icmp_ratelimit" },
369 { NET_IPV4_ICMP_RATEMASK, "icmp_ratemask" },
370 { NET_TCP_TW_REUSE, "tcp_tw_reuse" },
371 { NET_TCP_FRTO, "tcp_frto" },
372 { NET_TCP_LOW_LATENCY, "tcp_low_latency" },
373 { NET_IPV4_IPFRAG_SECRET_INTERVAL, "ipfrag_secret_interval" },
374 { NET_IPV4_IGMP_MAX_MSF, "igmp_max_msf" },
375 { NET_TCP_NO_METRICS_SAVE, "tcp_no_metrics_save" },
376 /* NET_TCP_DEFAULT_WIN_SCALE unused */
377 { NET_TCP_MODERATE_RCVBUF, "tcp_moderate_rcvbuf" },
378 { NET_TCP_TSO_WIN_DIVISOR, "tcp_tso_win_divisor" },
379 /* NET_TCP_BIC_BETA unused */
380 { NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR, "icmp_errors_use_inbound_ifaddr" },
381 { NET_TCP_CONG_CONTROL, "tcp_congestion_control" },
382 { NET_TCP_ABC, "tcp_abc" },
383 { NET_IPV4_IPFRAG_MAX_DIST, "ipfrag_max_dist" },
384 { NET_TCP_MTU_PROBING, "tcp_mtu_probing" },
385 { NET_TCP_BASE_MSS, "tcp_base_mss" },
386 { NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, "tcp_workaround_signed_windows" },
387 { NET_TCP_DMA_COPYBREAK, "tcp_dma_copybreak" },
388 { NET_TCP_SLOW_START_AFTER_IDLE, "tcp_slow_start_after_idle" },
389 { NET_CIPSOV4_CACHE_ENABLE, "cipso_cache_enable" },
390 { NET_CIPSOV4_CACHE_BUCKET_SIZE, "cipso_cache_bucket_size" },
391 { NET_CIPSOV4_RBM_OPTFMT, "cipso_rbm_optfmt" },
392 { NET_CIPSOV4_RBM_STRICTVALID, "cipso_rbm_strictvalid" },
393 { NET_TCP_AVAIL_CONG_CONTROL, "tcp_available_congestion_control" },
394 { NET_TCP_ALLOWED_CONG_CONTROL, "tcp_allowed_congestion_control" },
395 { NET_TCP_MAX_SSTHRESH, "tcp_max_ssthresh" },
396 { NET_TCP_FRTO_RESPONSE, "tcp_frto_response" },
397 { 2088 /* NET_IPQ_QMAX */, "ip_queue_maxlen" },
401 static struct trans_ctl_table trans_net_ipx_table[] = {
402 { NET_IPX_PPROP_BROADCASTING, "ipx_pprop_broadcasting" },
403 /* NET_IPX_FORWARDING unused */
407 static struct trans_ctl_table trans_net_atalk_table[] = {
408 { NET_ATALK_AARP_EXPIRY_TIME, "aarp-expiry-time" },
409 { NET_ATALK_AARP_TICK_TIME, "aarp-tick-time" },
410 { NET_ATALK_AARP_RETRANSMIT_LIMIT, "aarp-retransmit-limit" },
411 { NET_ATALK_AARP_RESOLVE_TIME, "aarp-resolve-time" },
415 static struct trans_ctl_table trans_net_netrom_table[] = {
416 { NET_NETROM_DEFAULT_PATH_QUALITY, "default_path_quality" },
417 { NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER, "obsolescence_count_initialiser" },
418 { NET_NETROM_NETWORK_TTL_INITIALISER, "network_ttl_initialiser" },
419 { NET_NETROM_TRANSPORT_TIMEOUT, "transport_timeout" },
420 { NET_NETROM_TRANSPORT_MAXIMUM_TRIES, "transport_maximum_tries" },
421 { NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY, "transport_acknowledge_delay" },
422 { NET_NETROM_TRANSPORT_BUSY_DELAY, "transport_busy_delay" },
423 { NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE, "transport_requested_window_size" },
424 { NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT, "transport_no_activity_timeout" },
425 { NET_NETROM_ROUTING_CONTROL, "routing_control" },
426 { NET_NETROM_LINK_FAILS_COUNT, "link_fails_count" },
427 { NET_NETROM_RESET, "reset" },
431 static struct trans_ctl_table trans_net_ax25_param_table[] = {
432 { NET_AX25_IP_DEFAULT_MODE, "ip_default_mode" },
433 { NET_AX25_DEFAULT_MODE, "ax25_default_mode" },
434 { NET_AX25_BACKOFF_TYPE, "backoff_type" },
435 { NET_AX25_CONNECT_MODE, "connect_mode" },
436 { NET_AX25_STANDARD_WINDOW, "standard_window_size" },
437 { NET_AX25_EXTENDED_WINDOW, "extended_window_size" },
438 { NET_AX25_T1_TIMEOUT, "t1_timeout" },
439 { NET_AX25_T2_TIMEOUT, "t2_timeout" },
440 { NET_AX25_T3_TIMEOUT, "t3_timeout" },
441 { NET_AX25_IDLE_TIMEOUT, "idle_timeout" },
442 { NET_AX25_N2, "maximum_retry_count" },
443 { NET_AX25_PACLEN, "maximum_packet_length" },
444 { NET_AX25_PROTOCOL, "protocol" },
445 { NET_AX25_DAMA_SLAVE_TIMEOUT, "dama_slave_timeout" },
449 static struct trans_ctl_table trans_net_ax25_table[] = {
450 { 0, NULL, trans_net_ax25_param_table },
454 static struct trans_ctl_table trans_net_bridge_table[] = {
455 { NET_BRIDGE_NF_CALL_ARPTABLES, "bridge-nf-call-arptables" },
456 { NET_BRIDGE_NF_CALL_IPTABLES, "bridge-nf-call-iptables" },
457 { NET_BRIDGE_NF_CALL_IP6TABLES, "bridge-nf-call-ip6tables" },
458 { NET_BRIDGE_NF_FILTER_VLAN_TAGGED, "bridge-nf-filter-vlan-tagged" },
459 { NET_BRIDGE_NF_FILTER_PPPOE_TAGGED, "bridge-nf-filter-pppoe-tagged" },
463 static struct trans_ctl_table trans_net_rose_table[] = {
464 { NET_ROSE_RESTART_REQUEST_TIMEOUT, "restart_request_timeout" },
465 { NET_ROSE_CALL_REQUEST_TIMEOUT, "call_request_timeout" },
466 { NET_ROSE_RESET_REQUEST_TIMEOUT, "reset_request_timeout" },
467 { NET_ROSE_CLEAR_REQUEST_TIMEOUT, "clear_request_timeout" },
468 { NET_ROSE_ACK_HOLD_BACK_TIMEOUT, "acknowledge_hold_back_timeout" },
469 { NET_ROSE_ROUTING_CONTROL, "routing_control" },
470 { NET_ROSE_LINK_FAIL_TIMEOUT, "link_fail_timeout" },
471 { NET_ROSE_MAX_VCS, "maximum_virtual_circuits" },
472 { NET_ROSE_WINDOW_SIZE, "window_size" },
473 { NET_ROSE_NO_ACTIVITY_TIMEOUT, "no_activity_timeout" },
477 static struct trans_ctl_table trans_net_ipv6_conf_var_table[] = {
478 { NET_IPV6_FORWARDING, "forwarding" },
479 { NET_IPV6_HOP_LIMIT, "hop_limit" },
480 { NET_IPV6_MTU, "mtu" },
481 { NET_IPV6_ACCEPT_RA, "accept_ra" },
482 { NET_IPV6_ACCEPT_REDIRECTS, "accept_redirects" },
483 { NET_IPV6_AUTOCONF, "autoconf" },
484 { NET_IPV6_DAD_TRANSMITS, "dad_transmits" },
485 { NET_IPV6_RTR_SOLICITS, "router_solicitations" },
486 { NET_IPV6_RTR_SOLICIT_INTERVAL, "router_solicitation_interval" },
487 { NET_IPV6_RTR_SOLICIT_DELAY, "router_solicitation_delay" },
488 { NET_IPV6_USE_TEMPADDR, "use_tempaddr" },
489 { NET_IPV6_TEMP_VALID_LFT, "temp_valid_lft" },
490 { NET_IPV6_TEMP_PREFERED_LFT, "temp_prefered_lft" },
491 { NET_IPV6_REGEN_MAX_RETRY, "regen_max_retry" },
492 { NET_IPV6_MAX_DESYNC_FACTOR, "max_desync_factor" },
493 { NET_IPV6_MAX_ADDRESSES, "max_addresses" },
494 { NET_IPV6_FORCE_MLD_VERSION, "force_mld_version" },
495 { NET_IPV6_ACCEPT_RA_DEFRTR, "accept_ra_defrtr" },
496 { NET_IPV6_ACCEPT_RA_PINFO, "accept_ra_pinfo" },
497 { NET_IPV6_ACCEPT_RA_RTR_PREF, "accept_ra_rtr_pref" },
498 { NET_IPV6_RTR_PROBE_INTERVAL, "router_probe_interval" },
499 { NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN, "accept_ra_rt_info_max_plen" },
500 { NET_IPV6_PROXY_NDP, "proxy_ndp" },
501 { NET_IPV6_ACCEPT_SOURCE_ROUTE, "accept_source_route" },
505 static struct trans_ctl_table trans_net_ipv6_conf_table[] = {
506 { NET_PROTO_CONF_ALL, "all", trans_net_ipv6_conf_var_table },
507 { NET_PROTO_CONF_DEFAULT, "default", trans_net_ipv6_conf_var_table },
508 { 0, NULL, trans_net_ipv6_conf_var_table },
512 static struct trans_ctl_table trans_net_ipv6_route_table[] = {
513 { NET_IPV6_ROUTE_FLUSH, "flush" },
514 { NET_IPV6_ROUTE_GC_THRESH, "gc_thresh" },
515 { NET_IPV6_ROUTE_MAX_SIZE, "max_size" },
516 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "gc_min_interval" },
517 { NET_IPV6_ROUTE_GC_TIMEOUT, "gc_timeout" },
518 { NET_IPV6_ROUTE_GC_INTERVAL, "gc_interval" },
519 { NET_IPV6_ROUTE_GC_ELASTICITY, "gc_elasticity" },
520 { NET_IPV6_ROUTE_MTU_EXPIRES, "mtu_expires" },
521 { NET_IPV6_ROUTE_MIN_ADVMSS, "min_adv_mss" },
522 { NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS, "gc_min_interval_ms" },
526 static struct trans_ctl_table trans_net_ipv6_icmp_table[] = {
527 { NET_IPV6_ICMP_RATELIMIT, "ratelimit" },
531 static struct trans_ctl_table trans_net_ipv6_table[] = {
532 { NET_IPV6_CONF, "conf", trans_net_ipv6_conf_table },
533 { NET_IPV6_NEIGH, "neigh", trans_net_neigh_table },
534 { NET_IPV6_ROUTE, "route", trans_net_ipv6_route_table },
535 { NET_IPV6_ICMP, "icmp", trans_net_ipv6_icmp_table },
536 { NET_IPV6_BINDV6ONLY, "bindv6only" },
537 { NET_IPV6_IP6FRAG_HIGH_THRESH, "ip6frag_high_thresh" },
538 { NET_IPV6_IP6FRAG_LOW_THRESH, "ip6frag_low_thresh" },
539 { NET_IPV6_IP6FRAG_TIME, "ip6frag_time" },
540 { NET_IPV6_IP6FRAG_SECRET_INTERVAL, "ip6frag_secret_interval" },
541 { NET_IPV6_MLD_MAX_MSF, "mld_max_msf" },
542 { 2088 /* IPQ_QMAX */, "ip6_queue_maxlen" },
546 static struct trans_ctl_table trans_net_x25_table[] = {
547 { NET_X25_RESTART_REQUEST_TIMEOUT, "restart_request_timeout" },
548 { NET_X25_CALL_REQUEST_TIMEOUT, "call_request_timeout" },
549 { NET_X25_RESET_REQUEST_TIMEOUT, "reset_request_timeout" },
550 { NET_X25_CLEAR_REQUEST_TIMEOUT, "clear_request_timeout" },
551 { NET_X25_ACK_HOLD_BACK_TIMEOUT, "acknowledgement_hold_back_timeout" },
552 { NET_X25_FORWARD, "x25_forward" },
556 static struct trans_ctl_table trans_net_tr_table[] = {
557 { NET_TR_RIF_TIMEOUT, "rif_timeout" },
562 static struct trans_ctl_table trans_net_decnet_conf_vars[] = {
563 { NET_DECNET_CONF_DEV_FORWARDING, "forwarding" },
564 { NET_DECNET_CONF_DEV_PRIORITY, "priority" },
565 { NET_DECNET_CONF_DEV_T2, "t2" },
566 { NET_DECNET_CONF_DEV_T3, "t3" },
570 static struct trans_ctl_table trans_net_decnet_conf[] = {
571 { 0, NULL, trans_net_decnet_conf_vars },
575 static struct trans_ctl_table trans_net_decnet_table[] = {
576 { NET_DECNET_CONF, "conf", trans_net_decnet_conf },
577 { NET_DECNET_NODE_ADDRESS, "node_address" },
578 { NET_DECNET_NODE_NAME, "node_name" },
579 { NET_DECNET_DEFAULT_DEVICE, "default_device" },
580 { NET_DECNET_TIME_WAIT, "time_wait" },
581 { NET_DECNET_DN_COUNT, "dn_count" },
582 { NET_DECNET_DI_COUNT, "di_count" },
583 { NET_DECNET_DR_COUNT, "dr_count" },
584 { NET_DECNET_DST_GC_INTERVAL, "dst_gc_interval" },
585 { NET_DECNET_NO_FC_MAX_CWND, "no_fc_max_cwnd" },
586 { NET_DECNET_MEM, "decnet_mem" },
587 { NET_DECNET_RMEM, "decnet_rmem" },
588 { NET_DECNET_WMEM, "decnet_wmem" },
589 { NET_DECNET_DEBUG_LEVEL, "debug" },
593 static struct trans_ctl_table trans_net_sctp_table[] = {
594 { NET_SCTP_RTO_INITIAL, "rto_initial" },
595 { NET_SCTP_RTO_MIN, "rto_min" },
596 { NET_SCTP_RTO_MAX, "rto_max" },
597 { NET_SCTP_RTO_ALPHA, "rto_alpha_exp_divisor" },
598 { NET_SCTP_RTO_BETA, "rto_beta_exp_divisor" },
599 { NET_SCTP_VALID_COOKIE_LIFE, "valid_cookie_life" },
600 { NET_SCTP_ASSOCIATION_MAX_RETRANS, "association_max_retrans" },
601 { NET_SCTP_PATH_MAX_RETRANS, "path_max_retrans" },
602 { NET_SCTP_MAX_INIT_RETRANSMITS, "max_init_retransmits" },
603 { NET_SCTP_HB_INTERVAL, "hb_interval" },
604 { NET_SCTP_PRESERVE_ENABLE, "cookie_preserve_enable" },
605 { NET_SCTP_MAX_BURST, "max_burst" },
606 { NET_SCTP_ADDIP_ENABLE, "addip_enable" },
607 { NET_SCTP_PRSCTP_ENABLE, "prsctp_enable" },
608 { NET_SCTP_SNDBUF_POLICY, "sndbuf_policy" },
609 { NET_SCTP_SACK_TIMEOUT, "sack_timeout" },
610 { NET_SCTP_RCVBUF_POLICY, "rcvbuf_policy" },
614 static struct trans_ctl_table trans_net_llc_llc2_timeout_table[] = {
615 { NET_LLC2_ACK_TIMEOUT, "ack" },
616 { NET_LLC2_P_TIMEOUT, "p" },
617 { NET_LLC2_REJ_TIMEOUT, "rej" },
618 { NET_LLC2_BUSY_TIMEOUT, "busy" },
622 static struct trans_ctl_table trans_net_llc_station_table[] = {
623 { NET_LLC_STATION_ACK_TIMEOUT, "ack_timeout" },
627 static struct trans_ctl_table trans_net_llc_llc2_table[] = {
628 { NET_LLC2, "timeout", trans_net_llc_llc2_timeout_table },
632 static struct trans_ctl_table trans_net_llc_table[] = {
633 { NET_LLC2, "llc2", trans_net_llc_llc2_table },
634 { NET_LLC_STATION, "station", trans_net_llc_station_table },
638 static struct trans_ctl_table trans_net_netfilter_table[] = {
639 { NET_NF_CONNTRACK_MAX, "nf_conntrack_max" },
640 { NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, "nf_conntrack_tcp_timeout_syn_sent" },
641 { NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV, "nf_conntrack_tcp_timeout_syn_recv" },
642 { NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED, "nf_conntrack_tcp_timeout_established" },
643 { NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT, "nf_conntrack_tcp_timeout_fin_wait" },
644 { NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT, "nf_conntrack_tcp_timeout_close_wait" },
645 { NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK, "nf_conntrack_tcp_timeout_last_ack" },
646 { NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT, "nf_conntrack_tcp_timeout_time_wait" },
647 { NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE, "nf_conntrack_tcp_timeout_close" },
648 { NET_NF_CONNTRACK_UDP_TIMEOUT, "nf_conntrack_udp_timeout" },
649 { NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM, "nf_conntrack_udp_timeout_stream" },
650 { NET_NF_CONNTRACK_ICMP_TIMEOUT, "nf_conntrack_icmp_timeout" },
651 { NET_NF_CONNTRACK_GENERIC_TIMEOUT, "nf_conntrack_generic_timeout" },
652 { NET_NF_CONNTRACK_BUCKETS, "nf_conntrack_buckets" },
653 { NET_NF_CONNTRACK_LOG_INVALID, "nf_conntrack_log_invalid" },
654 { NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS, "nf_conntrack_tcp_timeout_max_retrans" },
655 { NET_NF_CONNTRACK_TCP_LOOSE, "nf_conntrack_tcp_loose" },
656 { NET_NF_CONNTRACK_TCP_BE_LIBERAL, "nf_conntrack_tcp_be_liberal" },
657 { NET_NF_CONNTRACK_TCP_MAX_RETRANS, "nf_conntrack_tcp_max_retrans" },
658 { NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED, "nf_conntrack_sctp_timeout_closed" },
659 { NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT, "nf_conntrack_sctp_timeout_cookie_wait" },
660 { NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED, "nf_conntrack_sctp_timeout_cookie_echoed" },
661 { NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED, "nf_conntrack_sctp_timeout_established" },
662 { NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT, "nf_conntrack_sctp_timeout_shutdown_sent" },
663 { NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD, "nf_conntrack_sctp_timeout_shutdown_recd" },
664 { NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT, "nf_conntrack_sctp_timeout_shutdown_ack_sent" },
665 { NET_NF_CONNTRACK_COUNT, "nf_conntrack_count" },
666 { NET_NF_CONNTRACK_ICMPV6_TIMEOUT, "nf_conntrack_icmpv6_timeout" },
667 { NET_NF_CONNTRACK_FRAG6_TIMEOUT, "nf_conntrack_frag6_timeout" },
668 { NET_NF_CONNTRACK_FRAG6_LOW_THRESH, "nf_conntrack_frag6_low_thresh" },
669 { NET_NF_CONNTRACK_FRAG6_HIGH_THRESH, "nf_conntrack_frag6_high_thresh" },
670 { NET_NF_CONNTRACK_CHECKSUM, "nf_conntrack_checksum" },
675 static struct trans_ctl_table trans_net_dccp_table[] = {
676 { NET_DCCP_DEFAULT, "default" },
680 static struct trans_ctl_table trans_net_irda_table[] = {
681 { NET_IRDA_DISCOVERY, "discovery" },
682 { NET_IRDA_DEVNAME, "devname" },
683 { NET_IRDA_DEBUG, "debug" },
684 { NET_IRDA_FAST_POLL, "fast_poll_increase" },
685 { NET_IRDA_DISCOVERY_SLOTS, "discovery_slots" },
686 { NET_IRDA_DISCOVERY_TIMEOUT, "discovery_timeout" },
687 { NET_IRDA_SLOT_TIMEOUT, "slot_timeout" },
688 { NET_IRDA_MAX_BAUD_RATE, "max_baud_rate" },
689 { NET_IRDA_MIN_TX_TURN_TIME, "min_tx_turn_time" },
690 { NET_IRDA_MAX_TX_DATA_SIZE, "max_tx_data_size" },
691 { NET_IRDA_MAX_TX_WINDOW, "max_tx_window" },
692 { NET_IRDA_MAX_NOREPLY_TIME, "max_noreply_time" },
693 { NET_IRDA_WARN_NOREPLY_TIME, "warn_noreply_time" },
694 { NET_IRDA_LAP_KEEPALIVE_TIME, "lap_keepalive_time" },
698 static struct trans_ctl_table trans_net_table[] = {
699 { NET_CORE, "core", trans_net_core_table },
700 /* NET_ETHER not used */
701 /* NET_802 not used */
702 { NET_UNIX, "unix", trans_net_unix_table },
703 { NET_IPV4, "ipv4", trans_net_ipv4_table },
704 { NET_IPX, "ipx", trans_net_ipx_table },
705 { NET_ATALK, "appletalk", trans_net_atalk_table },
706 { NET_NETROM, "netrom", trans_net_netrom_table },
707 { NET_AX25, "ax25", trans_net_ax25_table },
708 { NET_BRIDGE, "bridge", trans_net_bridge_table },
709 { NET_ROSE, "rose", trans_net_rose_table },
710 { NET_IPV6, "ipv6", trans_net_ipv6_table },
711 { NET_X25, "x25", trans_net_x25_table },
712 { NET_TR, "token-ring", trans_net_tr_table },
713 { NET_DECNET, "decnet", trans_net_decnet_table },
714 /* NET_ECONET not used */
715 { NET_SCTP, "sctp", trans_net_sctp_table },
716 { NET_LLC, "llc", trans_net_llc_table },
717 { NET_NETFILTER, "netfilter", trans_net_netfilter_table },
718 { NET_DCCP, "dccp", trans_net_dccp_table },
719 { NET_IRDA, "irda", trans_net_irda_table },
720 { 2089, "nf_conntrack_max" },
724 static struct trans_ctl_table trans_fs_quota_table[] = {
725 { FS_DQ_LOOKUPS, "lookups" },
726 { FS_DQ_DROPS, "drops" },
727 { FS_DQ_READS, "reads" },
728 { FS_DQ_WRITES, "writes" },
729 { FS_DQ_CACHE_HITS, "cache_hits" },
730 { FS_DQ_ALLOCATED, "allocated_dquots" },
731 { FS_DQ_FREE, "free_dquots" },
732 { FS_DQ_SYNCS, "syncs" },
733 { FS_DQ_WARNINGS, "warnings" },
737 static struct trans_ctl_table trans_fs_xfs_table[] = {
738 { XFS_RESTRICT_CHOWN, "restrict_chown" },
739 { XFS_SGID_INHERIT, "irix_sgid_inherit" },
740 { XFS_SYMLINK_MODE, "irix_symlink_mode" },
741 { XFS_PANIC_MASK, "panic_mask" },
743 { XFS_ERRLEVEL, "error_level" },
744 { XFS_SYNCD_TIMER, "xfssyncd_centisecs" },
745 { XFS_INHERIT_SYNC, "inherit_sync" },
746 { XFS_INHERIT_NODUMP, "inherit_nodump" },
747 { XFS_INHERIT_NOATIME, "inherit_noatime" },
748 { XFS_BUF_TIMER, "xfsbufd_centisecs" },
749 { XFS_BUF_AGE, "age_buffer_centisecs" },
750 { XFS_INHERIT_NOSYM, "inherit_nosymlinks" },
751 { XFS_ROTORSTEP, "rotorstep" },
752 { XFS_INHERIT_NODFRG, "inherit_nodefrag" },
753 { XFS_FILESTREAM_TIMER, "filestream_centisecs" },
754 { XFS_STATS_CLEAR, "stats_clear" },
758 static struct trans_ctl_table trans_fs_ocfs2_nm_table[] = {
759 { 1, "hb_ctl_path" },
763 static struct trans_ctl_table trans_fs_ocfs2_table[] = {
764 { 1, "nm", trans_fs_ocfs2_nm_table },
768 static struct trans_ctl_table trans_inotify_table[] = {
769 { INOTIFY_MAX_USER_INSTANCES, "max_user_instances" },
770 { INOTIFY_MAX_USER_WATCHES, "max_user_watches" },
771 { INOTIFY_MAX_QUEUED_EVENTS, "max_queued_events" },
775 static struct trans_ctl_table trans_fs_table[] = {
776 { FS_NRINODE, "inode-nr" },
777 { FS_STATINODE, "inode-state" },
778 /* FS_MAXINODE unused */
779 /* FS_NRDQUOT unused */
780 /* FS_MAXDQUOT unused */
781 { FS_NRFILE, "file-nr" },
782 { FS_MAXFILE, "file-max" },
783 { FS_DENTRY, "dentry-state" },
784 /* FS_NRSUPER unused */
785 /* FS_MAXUPSER unused */
786 { FS_OVERFLOWUID, "overflowuid" },
787 { FS_OVERFLOWGID, "overflowgid" },
788 { FS_LEASES, "leases-enable" },
789 { FS_DIR_NOTIFY, "dir-notify-enable" },
790 { FS_LEASE_TIME, "lease-break-time" },
791 { FS_DQSTATS, "quota", trans_fs_quota_table },
792 { FS_XFS, "xfs", trans_fs_xfs_table },
793 { FS_AIO_NR, "aio-nr" },
794 { FS_AIO_MAX_NR, "aio-max-nr" },
795 { FS_INOTIFY, "inotify", trans_inotify_table },
796 { FS_OCFS2, "ocfs2", trans_fs_ocfs2_table },
797 { KERN_SETUID_DUMPABLE, "suid_dumpable" },
801 static struct trans_ctl_table trans_debug_table[] = {
805 static struct trans_ctl_table trans_cdrom_table[] = {
806 { DEV_CDROM_INFO, "info" },
807 { DEV_CDROM_AUTOCLOSE, "autoclose" },
808 { DEV_CDROM_AUTOEJECT, "autoeject" },
809 { DEV_CDROM_DEBUG, "debug" },
810 { DEV_CDROM_LOCK, "lock" },
811 { DEV_CDROM_CHECK_MEDIA, "check_media" },
815 static struct trans_ctl_table trans_ipmi_table[] = {
816 { DEV_IPMI_POWEROFF_POWERCYCLE, "poweroff_powercycle" },
820 static struct trans_ctl_table trans_mac_hid_files[] = {
821 /* DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES unused */
822 /* DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES unused */
823 { DEV_MAC_HID_MOUSE_BUTTON_EMULATION, "mouse_button_emulation" },
824 { DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE, "mouse_button2_keycode" },
825 { DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE, "mouse_button3_keycode" },
826 /* DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES unused */
830 static struct trans_ctl_table trans_raid_table[] = {
831 { DEV_RAID_SPEED_LIMIT_MIN, "speed_limit_min" },
832 { DEV_RAID_SPEED_LIMIT_MAX, "speed_limit_max" },
836 static struct trans_ctl_table trans_scsi_table[] = {
837 { DEV_SCSI_LOGGING_LEVEL, "logging_level" },
841 static struct trans_ctl_table trans_parport_default_table[] = {
842 { DEV_PARPORT_DEFAULT_TIMESLICE, "timeslice" },
843 { DEV_PARPORT_DEFAULT_SPINTIME, "spintime" },
847 static struct trans_ctl_table trans_parport_device_table[] = {
848 { DEV_PARPORT_DEVICE_TIMESLICE, "timeslice" },
852 static struct trans_ctl_table trans_parport_devices_table[] = {
853 { DEV_PARPORT_DEVICES_ACTIVE, "active" },
854 { 0, NULL, trans_parport_device_table },
858 static struct trans_ctl_table trans_parport_parport_table[] = {
859 { DEV_PARPORT_SPINTIME, "spintime" },
860 { DEV_PARPORT_BASE_ADDR, "base-addr" },
861 { DEV_PARPORT_IRQ, "irq" },
862 { DEV_PARPORT_DMA, "dma" },
863 { DEV_PARPORT_MODES, "modes" },
864 { DEV_PARPORT_DEVICES, "devices", trans_parport_devices_table },
865 { DEV_PARPORT_AUTOPROBE, "autoprobe" },
866 { DEV_PARPORT_AUTOPROBE + 1, "autoprobe0" },
867 { DEV_PARPORT_AUTOPROBE + 2, "autoprobe1" },
868 { DEV_PARPORT_AUTOPROBE + 3, "autoprobe2" },
869 { DEV_PARPORT_AUTOPROBE + 4, "autoprobe3" },
872 static struct trans_ctl_table trans_parport_table[] = {
873 { DEV_PARPORT_DEFAULT, "default", trans_parport_default_table },
874 { 0, NULL, trans_parport_parport_table },
878 static struct trans_ctl_table trans_dev_table[] = {
879 { DEV_CDROM, "cdrom", trans_cdrom_table },
880 /* DEV_HWMON unused */
881 { DEV_PARPORT, "parport", trans_parport_table },
882 { DEV_RAID, "raid", trans_raid_table },
883 { DEV_MAC_HID, "mac_hid", trans_mac_hid_files },
884 { DEV_SCSI, "scsi", trans_scsi_table },
885 { DEV_IPMI, "ipmi", trans_ipmi_table },
889 static struct trans_ctl_table trans_bus_isa_table[] = {
890 { BUS_ISA_MEM_BASE, "membase" },
891 { BUS_ISA_PORT_BASE, "portbase" },
892 { BUS_ISA_PORT_SHIFT, "portshift" },
896 static struct trans_ctl_table trans_bus_table[] = {
897 { CTL_BUS_ISA, "isa", trans_bus_isa_table },
901 static struct trans_ctl_table trans_arlan_conf_table0[] = {
902 { 1, "spreadingCode" },
903 { 2, "channelNumber" },
904 { 3, "scramblingDisable" },
905 { 4, "txAttenuation" },
906 { 5, "systemId" },
907 { 6, "maxDatagramSize" },
908 { 7, "maxFrameSize" },
909 { 8, "maxRetries" },
910 { 9, "receiveMode" },
911 { 10, "priority" },
912 { 11, "rootOrRepeater" },
913 { 12, "SID" },
914 { 13, "registrationMode" },
915 { 14, "registrationFill" },
916 { 15, "localTalkAddress" },
917 { 16, "codeFormat" },
918 { 17, "numChannels" },
919 { 18, "channel1" },
920 { 19, "channel2" },
921 { 20, "channel3" },
922 { 21, "channel4" },
923 { 22, "txClear" },
924 { 23, "txRetries" },
925 { 24, "txRouting" },
926 { 25, "txScrambled" },
927 { 26, "rxParameter" },
928 { 27, "txTimeoutMs" },
929 { 28, "waitCardTimeout" },
930 { 29, "channelSet" },
931 { 30, "name" },
932 { 31, "waitTime" },
933 { 32, "lParameter" },
934 { 33, "_15" },
935 { 34, "headerSize" },
936 { 36, "tx_delay_ms" },
937 { 37, "retries" },
938 { 38, "ReTransmitPacketMaxSize" },
939 { 39, "waitReTransmitPacketMaxSize" },
940 { 40, "fastReTransCount" },
941 { 41, "driverRetransmissions" },
942 { 42, "txAckTimeoutMs" },
943 { 43, "registrationInterrupts" },
944 { 44, "hardwareType" },
945 { 45, "radioType" },
946 { 46, "writeEEPROM" },
947 { 47, "writeRadioType" },
948 { 48, "entry_exit_debug" },
949 { 49, "debug" },
950 { 50, "in_speed" },
951 { 51, "out_speed" },
952 { 52, "in_speed10" },
953 { 53, "out_speed10" },
954 { 54, "in_speed_max" },
955 { 55, "out_speed_max" },
956 { 56, "measure_rate" },
957 { 57, "pre_Command_Wait" },
958 { 58, "rx_tweak1" },
959 { 59, "rx_tweak2" },
960 { 60, "tx_queue_len" },
962 { 150, "arlan0-txRing" },
963 { 151, "arlan0-rxRing" },
964 { 152, "arlan0-18" },
965 { 153, "arlan0-ring" },
966 { 154, "arlan0-shm-cpy" },
967 { 155, "config0" },
968 { 156, "reset0" },
972 static struct trans_ctl_table trans_arlan_conf_table1[] = {
973 { 1, "spreadingCode" },
974 { 2, "channelNumber" },
975 { 3, "scramblingDisable" },
976 { 4, "txAttenuation" },
977 { 5, "systemId" },
978 { 6, "maxDatagramSize" },
979 { 7, "maxFrameSize" },
980 { 8, "maxRetries" },
981 { 9, "receiveMode" },
982 { 10, "priority" },
983 { 11, "rootOrRepeater" },
984 { 12, "SID" },
985 { 13, "registrationMode" },
986 { 14, "registrationFill" },
987 { 15, "localTalkAddress" },
988 { 16, "codeFormat" },
989 { 17, "numChannels" },
990 { 18, "channel1" },
991 { 19, "channel2" },
992 { 20, "channel3" },
993 { 21, "channel4" },
994 { 22, "txClear" },
995 { 23, "txRetries" },
996 { 24, "txRouting" },
997 { 25, "txScrambled" },
998 { 26, "rxParameter" },
999 { 27, "txTimeoutMs" },
1000 { 28, "waitCardTimeout" },
1001 { 29, "channelSet" },
1002 { 30, "name" },
1003 { 31, "waitTime" },
1004 { 32, "lParameter" },
1005 { 33, "_15" },
1006 { 34, "headerSize" },
1007 { 36, "tx_delay_ms" },
1008 { 37, "retries" },
1009 { 38, "ReTransmitPacketMaxSize" },
1010 { 39, "waitReTransmitPacketMaxSize" },
1011 { 40, "fastReTransCount" },
1012 { 41, "driverRetransmissions" },
1013 { 42, "txAckTimeoutMs" },
1014 { 43, "registrationInterrupts" },
1015 { 44, "hardwareType" },
1016 { 45, "radioType" },
1017 { 46, "writeEEPROM" },
1018 { 47, "writeRadioType" },
1019 { 48, "entry_exit_debug" },
1020 { 49, "debug" },
1021 { 50, "in_speed" },
1022 { 51, "out_speed" },
1023 { 52, "in_speed10" },
1024 { 53, "out_speed10" },
1025 { 54, "in_speed_max" },
1026 { 55, "out_speed_max" },
1027 { 56, "measure_rate" },
1028 { 57, "pre_Command_Wait" },
1029 { 58, "rx_tweak1" },
1030 { 59, "rx_tweak2" },
1031 { 60, "tx_queue_len" },
1033 { 150, "arlan1-txRing" },
1034 { 151, "arlan1-rxRing" },
1035 { 152, "arlan1-18" },
1036 { 153, "arlan1-ring" },
1037 { 154, "arlan1-shm-cpy" },
1038 { 155, "config1" },
1039 { 156, "reset1" },
1043 static struct trans_ctl_table trans_arlan_conf_table2[] = {
1044 { 1, "spreadingCode" },
1045 { 2, "channelNumber" },
1046 { 3, "scramblingDisable" },
1047 { 4, "txAttenuation" },
1048 { 5, "systemId" },
1049 { 6, "maxDatagramSize" },
1050 { 7, "maxFrameSize" },
1051 { 8, "maxRetries" },
1052 { 9, "receiveMode" },
1053 { 10, "priority" },
1054 { 11, "rootOrRepeater" },
1055 { 12, "SID" },
1056 { 13, "registrationMode" },
1057 { 14, "registrationFill" },
1058 { 15, "localTalkAddress" },
1059 { 16, "codeFormat" },
1060 { 17, "numChannels" },
1061 { 18, "channel1" },
1062 { 19, "channel2" },
1063 { 20, "channel3" },
1064 { 21, "channel4" },
1065 { 22, "txClear" },
1066 { 23, "txRetries" },
1067 { 24, "txRouting" },
1068 { 25, "txScrambled" },
1069 { 26, "rxParameter" },
1070 { 27, "txTimeoutMs" },
1071 { 28, "waitCardTimeout" },
1072 { 29, "channelSet" },
1073 { 30, "name" },
1074 { 31, "waitTime" },
1075 { 32, "lParameter" },
1076 { 33, "_15" },
1077 { 34, "headerSize" },
1078 { 36, "tx_delay_ms" },
1079 { 37, "retries" },
1080 { 38, "ReTransmitPacketMaxSize" },
1081 { 39, "waitReTransmitPacketMaxSize" },
1082 { 40, "fastReTransCount" },
1083 { 41, "driverRetransmissions" },
1084 { 42, "txAckTimeoutMs" },
1085 { 43, "registrationInterrupts" },
1086 { 44, "hardwareType" },
1087 { 45, "radioType" },
1088 { 46, "writeEEPROM" },
1089 { 47, "writeRadioType" },
1090 { 48, "entry_exit_debug" },
1091 { 49, "debug" },
1092 { 50, "in_speed" },
1093 { 51, "out_speed" },
1094 { 52, "in_speed10" },
1095 { 53, "out_speed10" },
1096 { 54, "in_speed_max" },
1097 { 55, "out_speed_max" },
1098 { 56, "measure_rate" },
1099 { 57, "pre_Command_Wait" },
1100 { 58, "rx_tweak1" },
1101 { 59, "rx_tweak2" },
1102 { 60, "tx_queue_len" },
1104 { 150, "arlan2-txRing" },
1105 { 151, "arlan2-rxRing" },
1106 { 152, "arlan2-18" },
1107 { 153, "arlan2-ring" },
1108 { 154, "arlan2-shm-cpy" },
1109 { 155, "config2" },
1110 { 156, "reset2" },
1114 static struct trans_ctl_table trans_arlan_conf_table3[] = {
1115 { 1, "spreadingCode" },
1116 { 2, "channelNumber" },
1117 { 3, "scramblingDisable" },
1118 { 4, "txAttenuation" },
1119 { 5, "systemId" },
1120 { 6, "maxDatagramSize" },
1121 { 7, "maxFrameSize" },
1122 { 8, "maxRetries" },
1123 { 9, "receiveMode" },
1124 { 10, "priority" },
1125 { 11, "rootOrRepeater" },
1126 { 12, "SID" },
1127 { 13, "registrationMode" },
1128 { 14, "registrationFill" },
1129 { 15, "localTalkAddress" },
1130 { 16, "codeFormat" },
1131 { 17, "numChannels" },
1132 { 18, "channel1" },
1133 { 19, "channel2" },
1134 { 20, "channel3" },
1135 { 21, "channel4" },
1136 { 22, "txClear" },
1137 { 23, "txRetries" },
1138 { 24, "txRouting" },
1139 { 25, "txScrambled" },
1140 { 26, "rxParameter" },
1141 { 27, "txTimeoutMs" },
1142 { 28, "waitCardTimeout" },
1143 { 29, "channelSet" },
1144 { 30, "name" },
1145 { 31, "waitTime" },
1146 { 32, "lParameter" },
1147 { 33, "_15" },
1148 { 34, "headerSize" },
1149 { 36, "tx_delay_ms" },
1150 { 37, "retries" },
1151 { 38, "ReTransmitPacketMaxSize" },
1152 { 39, "waitReTransmitPacketMaxSize" },
1153 { 40, "fastReTransCount" },
1154 { 41, "driverRetransmissions" },
1155 { 42, "txAckTimeoutMs" },
1156 { 43, "registrationInterrupts" },
1157 { 44, "hardwareType" },
1158 { 45, "radioType" },
1159 { 46, "writeEEPROM" },
1160 { 47, "writeRadioType" },
1161 { 48, "entry_exit_debug" },
1162 { 49, "debug" },
1163 { 50, "in_speed" },
1164 { 51, "out_speed" },
1165 { 52, "in_speed10" },
1166 { 53, "out_speed10" },
1167 { 54, "in_speed_max" },
1168 { 55, "out_speed_max" },
1169 { 56, "measure_rate" },
1170 { 57, "pre_Command_Wait" },
1171 { 58, "rx_tweak1" },
1172 { 59, "rx_tweak2" },
1173 { 60, "tx_queue_len" },
1175 { 150, "arlan3-txRing" },
1176 { 151, "arlan3-rxRing" },
1177 { 152, "arlan3-18" },
1178 { 153, "arlan3-ring" },
1179 { 154, "arlan3-shm-cpy" },
1180 { 155, "config3" },
1181 { 156, "reset3" },
1185 static struct trans_ctl_table trans_arlan_table[] = {
1186 { 1, "arlan0", trans_arlan_conf_table0 },
1187 { 2, "arlan1", trans_arlan_conf_table1 },
1188 { 3, "arlan2", trans_arlan_conf_table2 },
1189 { 4, "arlan3", trans_arlan_conf_table3 },
1193 static struct trans_ctl_table trans_s390dbf_table[] = {
1194 { 5678 /* CTL_S390DBF_STOPPABLE */, "debug_stoppable" },
1195 { 5679 /* CTL_S390DBF_ACTIVE */, "debug_active" },
1199 static struct trans_ctl_table trans_sunrpc_table[] = {
1200 { CTL_RPCDEBUG, "rpc_debug" },
1201 { CTL_NFSDEBUG, "nfs_debug" },
1202 { CTL_NFSDDEBUG, "nfsd_debug" },
1203 { CTL_NLMDEBUG, "nlm_debug" },
1204 { CTL_SLOTTABLE_UDP, "udp_slot_table_entries" },
1205 { CTL_SLOTTABLE_TCP, "tcp_slot_table_entries" },
1206 { CTL_MIN_RESVPORT, "min_resvport" },
1207 { CTL_MAX_RESVPORT, "max_resvport" },
1211 static struct trans_ctl_table trans_pm_table[] = {
1212 { 1 /* CTL_PM_SUSPEND */, "suspend" },
1213 { 2 /* CTL_PM_CMODE */, "cmode" },
1214 { 3 /* CTL_PM_P0 */, "p0" },
1215 { 4 /* CTL_PM_CM */, "cm" },
1219 static struct trans_ctl_table trans_frv_table[] = {
1220 { 1, "cache-mode" },
1221 { 2, "pin-cxnr" },
1225 static struct trans_ctl_table trans_root_table[] = {
1226 { CTL_KERN, "kernel", trans_kern_table },
1227 { CTL_VM, "vm", trans_vm_table },
1228 { CTL_NET, "net", trans_net_table },
1229 /* CTL_PROC not used */
1230 { CTL_FS, "fs", trans_fs_table },
1231 { CTL_DEBUG, "debug", trans_debug_table },
1232 { CTL_DEV, "dev", trans_dev_table },
1233 { CTL_BUS, "bus", trans_bus_table },
1234 { CTL_ABI, "abi" },
1235 /* CTL_CPU not used */
1236 { CTL_ARLAN, "arlan", trans_arlan_table },
1237 { CTL_S390DBF, "s390dbf", trans_s390dbf_table },
1238 { CTL_SUNRPC, "sunrpc", trans_sunrpc_table },
1239 { CTL_PM, "pm", trans_pm_table },
1240 { CTL_FRV, "frv", trans_frv_table },
1247 static int sysctl_depth(struct ctl_table *table)
1249 struct ctl_table *tmp;
1250 int depth;
1252 depth = 0;
1253 for (tmp = table; tmp->parent; tmp = tmp->parent)
1254 depth++;
1256 return depth;
1259 static struct ctl_table *sysctl_parent(struct ctl_table *table, int n)
1261 int i;
1263 for (i = 0; table && i < n; i++)
1264 table = table->parent;
1266 return table;
1269 static struct trans_ctl_table *sysctl_binary_lookup(struct ctl_table *table)
1271 struct ctl_table *test;
1272 struct trans_ctl_table *ref;
1273 int depth, cur_depth;
1275 depth = sysctl_depth(table);
1277 cur_depth = depth;
1278 ref = trans_root_table;
1279 repeat:
1280 test = sysctl_parent(table, cur_depth);
1281 for (; ref->ctl_name || ref->procname || ref->child; ref++) {
1282 int match = 0;
1284 if (cur_depth && !ref->child)
1285 continue;
1287 if (test->procname && ref->procname &&
1288 (strcmp(test->procname, ref->procname) == 0))
1289 match++;
1291 if (test->ctl_name && ref->ctl_name &&
1292 (test->ctl_name == ref->ctl_name))
1293 match++;
1295 if (!ref->ctl_name && !ref->procname)
1296 match++;
1298 if (match) {
1299 if (cur_depth != 0) {
1300 cur_depth--;
1301 ref = ref->child;
1302 goto repeat;
1304 goto out;
1307 ref = NULL;
1308 out:
1309 return ref;
1312 static void sysctl_print_path(struct ctl_table *table)
1314 struct ctl_table *tmp;
1315 int depth, i;
1316 depth = sysctl_depth(table);
1317 if (table->procname) {
1318 for (i = depth; i >= 0; i--) {
1319 tmp = sysctl_parent(table, i);
1320 printk("/%s", tmp->procname?tmp->procname:"");
1323 printk(" ");
1324 if (table->ctl_name) {
1325 for (i = depth; i >= 0; i--) {
1326 tmp = sysctl_parent(table, i);
1327 printk(".%d", tmp->ctl_name);
1332 static void sysctl_repair_table(struct ctl_table *table)
1334 /* Don't complain about the classic default
1335 * sysctl strategy routine. Maybe later we
1336 * can get the tables fixed and complain about
1337 * this.
1339 if (table->ctl_name && table->procname &&
1340 (table->proc_handler == proc_dointvec) &&
1341 (!table->strategy)) {
1342 table->strategy = sysctl_data;
1346 static struct ctl_table *sysctl_check_lookup(struct ctl_table *table)
1348 struct ctl_table_header *head;
1349 struct ctl_table *ref, *test;
1350 int depth, cur_depth;
1352 depth = sysctl_depth(table);
1354 for (head = sysctl_head_next(NULL); head;
1355 head = sysctl_head_next(head)) {
1356 cur_depth = depth;
1357 ref = head->ctl_table;
1358 repeat:
1359 test = sysctl_parent(table, cur_depth);
1360 for (; ref->ctl_name || ref->procname; ref++) {
1361 int match = 0;
1362 if (cur_depth && !ref->child)
1363 continue;
1365 if (test->procname && ref->procname &&
1366 (strcmp(test->procname, ref->procname) == 0))
1367 match++;
1369 if (test->ctl_name && ref->ctl_name &&
1370 (test->ctl_name == ref->ctl_name))
1371 match++;
1373 if (match) {
1374 if (cur_depth != 0) {
1375 cur_depth--;
1376 ref = ref->child;
1377 goto repeat;
1379 goto out;
1383 ref = NULL;
1384 out:
1385 sysctl_head_finish(head);
1386 return ref;
1389 static void set_fail(const char **fail, struct ctl_table *table, const char *str)
1391 if (*fail) {
1392 printk(KERN_ERR "sysctl table check failed: ");
1393 sysctl_print_path(table);
1394 printk(" %s\n", *fail);
1395 dump_stack();
1397 *fail = str;
1400 static int sysctl_check_dir(struct ctl_table *table)
1402 struct ctl_table *ref;
1403 int error;
1405 error = 0;
1406 ref = sysctl_check_lookup(table);
1407 if (ref) {
1408 int match = 0;
1409 if ((!table->procname && !ref->procname) ||
1410 (table->procname && ref->procname &&
1411 (strcmp(table->procname, ref->procname) == 0)))
1412 match++;
1414 if ((!table->ctl_name && !ref->ctl_name) ||
1415 (table->ctl_name && ref->ctl_name &&
1416 (table->ctl_name == ref->ctl_name)))
1417 match++;
1419 if (match != 2) {
1420 printk(KERN_ERR "%s: failed: ", __func__);
1421 sysctl_print_path(table);
1422 printk(" ref: ");
1423 sysctl_print_path(ref);
1424 printk("\n");
1425 error = -EINVAL;
1428 return error;
1431 static void sysctl_check_leaf(struct ctl_table *table, const char **fail)
1433 struct ctl_table *ref;
1435 ref = sysctl_check_lookup(table);
1436 if (ref && (ref != table))
1437 set_fail(fail, table, "Sysctl already exists");
1440 static void sysctl_check_bin_path(struct ctl_table *table, const char **fail)
1442 struct trans_ctl_table *ref;
1444 ref = sysctl_binary_lookup(table);
1445 if (table->ctl_name && !ref)
1446 set_fail(fail, table, "Unknown sysctl binary path");
1447 if (ref) {
1448 if (ref->procname &&
1449 (!table->procname ||
1450 (strcmp(table->procname, ref->procname) != 0)))
1451 set_fail(fail, table, "procname does not match binary path procname");
1453 if (ref->ctl_name && table->ctl_name &&
1454 (table->ctl_name != ref->ctl_name))
1455 set_fail(fail, table, "ctl_name does not match binary path ctl_name");
1459 int sysctl_check_table(struct ctl_table *table)
1461 int error = 0;
1462 for (; table->ctl_name || table->procname; table++) {
1463 const char *fail = NULL;
1465 sysctl_repair_table(table);
1466 if (table->parent) {
1467 if (table->procname && !table->parent->procname)
1468 set_fail(&fail, table, "Parent without procname");
1469 if (table->ctl_name && !table->parent->ctl_name)
1470 set_fail(&fail, table, "Parent without ctl_name");
1472 if (!table->procname)
1473 set_fail(&fail, table, "No procname");
1474 if (table->child) {
1475 if (table->data)
1476 set_fail(&fail, table, "Directory with data?");
1477 if (table->maxlen)
1478 set_fail(&fail, table, "Directory with maxlen?");
1479 if ((table->mode & (S_IRUGO|S_IXUGO)) != table->mode)
1480 set_fail(&fail, table, "Writable sysctl directory");
1481 if (table->proc_handler)
1482 set_fail(&fail, table, "Directory with proc_handler");
1483 if (table->strategy)
1484 set_fail(&fail, table, "Directory with strategy");
1485 if (table->extra1)
1486 set_fail(&fail, table, "Directory with extra1");
1487 if (table->extra2)
1488 set_fail(&fail, table, "Directory with extra2");
1489 if (sysctl_check_dir(table))
1490 set_fail(&fail, table, "Inconsistent directory names");
1491 } else {
1492 if ((table->strategy == sysctl_data) ||
1493 (table->strategy == sysctl_string) ||
1494 (table->strategy == sysctl_intvec) ||
1495 (table->strategy == sysctl_jiffies) ||
1496 (table->strategy == sysctl_ms_jiffies) ||
1497 (table->proc_handler == proc_dostring) ||
1498 (table->proc_handler == proc_dointvec) ||
1499 #ifdef CONFIG_SECURITY_CAPABILITIES
1500 (table->proc_handler == proc_dointvec_bset) ||
1501 #endif /* def CONFIG_SECURITY_CAPABILITIES */
1502 (table->proc_handler == proc_dointvec_minmax) ||
1503 (table->proc_handler == proc_dointvec_jiffies) ||
1504 (table->proc_handler == proc_dointvec_userhz_jiffies) ||
1505 (table->proc_handler == proc_dointvec_ms_jiffies) ||
1506 (table->proc_handler == proc_doulongvec_minmax) ||
1507 (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) {
1508 if (!table->data)
1509 set_fail(&fail, table, "No data");
1510 if (!table->maxlen)
1511 set_fail(&fail, table, "No maxlen");
1513 if ((table->proc_handler == proc_doulongvec_minmax) ||
1514 (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) {
1515 if (table->maxlen > sizeof (unsigned long)) {
1516 if (!table->extra1)
1517 set_fail(&fail, table, "No min");
1518 if (!table->extra2)
1519 set_fail(&fail, table, "No max");
1522 #ifdef CONFIG_SYSCTL_SYSCALL
1523 if (table->ctl_name && !table->strategy)
1524 set_fail(&fail, table, "Missing strategy");
1525 #endif
1526 #if 0
1527 if (!table->ctl_name && table->strategy)
1528 set_fail(&fail, table, "Strategy without ctl_name");
1529 #endif
1530 #ifdef CONFIG_PROC_FS
1531 if (table->procname && !table->proc_handler)
1532 set_fail(&fail, table, "No proc_handler");
1533 #endif
1534 #if 0
1535 if (!table->procname && table->proc_handler)
1536 set_fail(&fail, table, "proc_handler without procname");
1537 #endif
1538 sysctl_check_leaf(table, &fail);
1540 sysctl_check_bin_path(table, &fail);
1541 if (fail) {
1542 set_fail(&fail, table, NULL);
1543 error = -EINVAL;
1545 if (table->child)
1546 error |= sysctl_check_table(table->child);
1548 return error;