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