1e55d912fSArnaldo Carvalho de Melo /* 2e55d912fSArnaldo Carvalho de Melo * net/dccp/sysctl.c 3e55d912fSArnaldo Carvalho de Melo * 4e55d912fSArnaldo Carvalho de Melo * An implementation of the DCCP protocol 5e55d912fSArnaldo Carvalho de Melo * Arnaldo Carvalho de Melo <acme@mandriva.com> 6e55d912fSArnaldo Carvalho de Melo * 7e55d912fSArnaldo Carvalho de Melo * This program is free software; you can redistribute it and/or 8e55d912fSArnaldo Carvalho de Melo * modify it under the terms of the GNU General Public License v2 9e55d912fSArnaldo Carvalho de Melo * as published by the Free Software Foundation. 10e55d912fSArnaldo Carvalho de Melo */ 11e55d912fSArnaldo Carvalho de Melo 12e55d912fSArnaldo Carvalho de Melo #include <linux/mm.h> 13e55d912fSArnaldo Carvalho de Melo #include <linux/sysctl.h> 142e2e9e92SGerrit Renker #include "dccp.h" 152a0109a7SIan McDonald #include "feat.h" 16e55d912fSArnaldo Carvalho de Melo 17e55d912fSArnaldo Carvalho de Melo #ifndef CONFIG_SYSCTL 18e55d912fSArnaldo Carvalho de Melo #error This file should not be compiled without CONFIG_SYSCTL defined 19e55d912fSArnaldo Carvalho de Melo #endif 20e55d912fSArnaldo Carvalho de Melo 21883ca833SGerrit Renker /* Boundary values */ 22883ca833SGerrit Renker static int zero = 0, 23883ca833SGerrit Renker u8_max = 0xFF; 24bfbb2346SGerrit Renker static unsigned long seqw_min = DCCPF_SEQ_WMIN, 25bfbb2346SGerrit Renker seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */ 26883ca833SGerrit Renker 27e55d912fSArnaldo Carvalho de Melo static struct ctl_table dccp_default_table[] = { 28e55d912fSArnaldo Carvalho de Melo { 29e55d912fSArnaldo Carvalho de Melo .procname = "seq_window", 30883ca833SGerrit Renker .data = &sysctl_dccp_sequence_window, 31883ca833SGerrit Renker .maxlen = sizeof(sysctl_dccp_sequence_window), 32e55d912fSArnaldo Carvalho de Melo .mode = 0644, 33883ca833SGerrit Renker .proc_handler = proc_doulongvec_minmax, 34883ca833SGerrit Renker .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */ 35bfbb2346SGerrit Renker .extra2 = &seqw_max, 36e55d912fSArnaldo Carvalho de Melo }, 37e55d912fSArnaldo Carvalho de Melo { 38e55d912fSArnaldo Carvalho de Melo .procname = "rx_ccid", 39883ca833SGerrit Renker .data = &sysctl_dccp_rx_ccid, 40883ca833SGerrit Renker .maxlen = sizeof(sysctl_dccp_rx_ccid), 41e55d912fSArnaldo Carvalho de Melo .mode = 0644, 42883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax, 43883ca833SGerrit Renker .extra1 = &zero, 44883ca833SGerrit Renker .extra2 = &u8_max, /* RFC 4340, 10. */ 45e55d912fSArnaldo Carvalho de Melo }, 46e55d912fSArnaldo Carvalho de Melo { 47e55d912fSArnaldo Carvalho de Melo .procname = "tx_ccid", 48883ca833SGerrit Renker .data = &sysctl_dccp_tx_ccid, 49883ca833SGerrit Renker .maxlen = sizeof(sysctl_dccp_tx_ccid), 50e55d912fSArnaldo Carvalho de Melo .mode = 0644, 51883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax, 52883ca833SGerrit Renker .extra1 = &zero, 53883ca833SGerrit Renker .extra2 = &u8_max, /* RFC 4340, 10. */ 54e55d912fSArnaldo Carvalho de Melo }, 55e55d912fSArnaldo Carvalho de Melo { 562e2e9e92SGerrit Renker .procname = "request_retries", 572e2e9e92SGerrit Renker .data = &sysctl_dccp_request_retries, 582e2e9e92SGerrit Renker .maxlen = sizeof(sysctl_dccp_request_retries), 592e2e9e92SGerrit Renker .mode = 0644, 60883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax, 61883ca833SGerrit Renker .extra1 = &zero, 62883ca833SGerrit Renker .extra2 = &u8_max, 632e2e9e92SGerrit Renker }, 642e2e9e92SGerrit Renker { 652e2e9e92SGerrit Renker .procname = "retries1", 662e2e9e92SGerrit Renker .data = &sysctl_dccp_retries1, 672e2e9e92SGerrit Renker .maxlen = sizeof(sysctl_dccp_retries1), 682e2e9e92SGerrit Renker .mode = 0644, 69883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax, 70883ca833SGerrit Renker .extra1 = &zero, 71883ca833SGerrit Renker .extra2 = &u8_max, 722e2e9e92SGerrit Renker }, 732e2e9e92SGerrit Renker { 742e2e9e92SGerrit Renker .procname = "retries2", 752e2e9e92SGerrit Renker .data = &sysctl_dccp_retries2, 762e2e9e92SGerrit Renker .maxlen = sizeof(sysctl_dccp_retries2), 772e2e9e92SGerrit Renker .mode = 0644, 78883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax, 79883ca833SGerrit Renker .extra1 = &zero, 80883ca833SGerrit Renker .extra2 = &u8_max, 812e2e9e92SGerrit Renker }, 8282e3ab9dSIan McDonald { 8382e3ab9dSIan McDonald .procname = "tx_qlen", 8482e3ab9dSIan McDonald .data = &sysctl_dccp_tx_qlen, 8582e3ab9dSIan McDonald .maxlen = sizeof(sysctl_dccp_tx_qlen), 8682e3ab9dSIan McDonald .mode = 0644, 87883ca833SGerrit Renker .proc_handler = proc_dointvec_minmax, 88883ca833SGerrit Renker .extra1 = &zero, 8982e3ab9dSIan McDonald }, 90a94f0f97SGerrit Renker { 91a94f0f97SGerrit Renker .procname = "sync_ratelimit", 92a94f0f97SGerrit Renker .data = &sysctl_dccp_sync_ratelimit, 93a94f0f97SGerrit Renker .maxlen = sizeof(sysctl_dccp_sync_ratelimit), 94a94f0f97SGerrit Renker .mode = 0644, 95a94f0f97SGerrit Renker .proc_handler = proc_dointvec_ms_jiffies, 96a94f0f97SGerrit Renker }, 9782e3ab9dSIan McDonald 98f8572d8fSEric W. Biederman { } 99e55d912fSArnaldo Carvalho de Melo }; 100e55d912fSArnaldo Carvalho de Melo 101e55d912fSArnaldo Carvalho de Melo static struct ctl_table_header *dccp_table_header; 102e55d912fSArnaldo Carvalho de Melo 103e55d912fSArnaldo Carvalho de Melo int __init dccp_sysctl_init(void) 104e55d912fSArnaldo Carvalho de Melo { 105*ec8f23ceSEric W. Biederman dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default", 106b5ccd792SPavel Emelyanov dccp_default_table); 107e55d912fSArnaldo Carvalho de Melo 108e55d912fSArnaldo Carvalho de Melo return dccp_table_header != NULL ? 0 : -ENOMEM; 109e55d912fSArnaldo Carvalho de Melo } 110e55d912fSArnaldo Carvalho de Melo 111e55d912fSArnaldo Carvalho de Melo void dccp_sysctl_exit(void) 112e55d912fSArnaldo Carvalho de Melo { 113e55d912fSArnaldo Carvalho de Melo if (dccp_table_header != NULL) { 1145dd3df10SEric W. Biederman unregister_net_sysctl_table(dccp_table_header); 115e55d912fSArnaldo Carvalho de Melo dccp_table_header = NULL; 116e55d912fSArnaldo Carvalho de Melo } 117e55d912fSArnaldo Carvalho de Melo } 118