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