1 // SPDX-License-Identifier: GPL-2.0-only 1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 2 /* 3 * net/dccp/sysctl.c 3 * net/dccp/sysctl.c 4 * 4 * 5 * An implementation of the DCCP protocol 5 * An implementation of the DCCP protocol 6 * Arnaldo Carvalho de Melo <acme@mandriva.co 6 * Arnaldo Carvalho de Melo <acme@mandriva.com> 7 */ 7 */ 8 8 9 #include <linux/mm.h> 9 #include <linux/mm.h> 10 #include <linux/sysctl.h> 10 #include <linux/sysctl.h> 11 #include "dccp.h" 11 #include "dccp.h" 12 #include "feat.h" 12 #include "feat.h" 13 13 14 #ifndef CONFIG_SYSCTL 14 #ifndef CONFIG_SYSCTL 15 #error This file should not be compiled withou 15 #error This file should not be compiled without CONFIG_SYSCTL defined 16 #endif 16 #endif 17 17 18 /* Boundary values */ 18 /* Boundary values */ 19 static int u8_max = 0xFF; !! 19 static int zero = 0, >> 20 one = 1, >> 21 u8_max = 0xFF; 20 static unsigned long seqw_min = DCCPF_SEQ_W 22 static unsigned long seqw_min = DCCPF_SEQ_WMIN, 21 seqw_max = 0xFFFFFFFF; 23 seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */ 22 24 23 static struct ctl_table dccp_default_table[] = 25 static struct ctl_table dccp_default_table[] = { 24 { 26 { 25 .procname = "seq_window" 27 .procname = "seq_window", 26 .data = &sysctl_dccp 28 .data = &sysctl_dccp_sequence_window, 27 .maxlen = sizeof(sysct 29 .maxlen = sizeof(sysctl_dccp_sequence_window), 28 .mode = 0644, 30 .mode = 0644, 29 .proc_handler = proc_doulong 31 .proc_handler = proc_doulongvec_minmax, 30 .extra1 = &seqw_min, 32 .extra1 = &seqw_min, /* RFC 4340, 7.5.2 */ 31 .extra2 = &seqw_max, 33 .extra2 = &seqw_max, 32 }, 34 }, 33 { 35 { 34 .procname = "rx_ccid", 36 .procname = "rx_ccid", 35 .data = &sysctl_dccp 37 .data = &sysctl_dccp_rx_ccid, 36 .maxlen = sizeof(sysct 38 .maxlen = sizeof(sysctl_dccp_rx_ccid), 37 .mode = 0644, 39 .mode = 0644, 38 .proc_handler = proc_dointve 40 .proc_handler = proc_dointvec_minmax, 39 .extra1 = SYSCTL_ZERO, !! 41 .extra1 = &zero, 40 .extra2 = &u8_max, 42 .extra2 = &u8_max, /* RFC 4340, 10. */ 41 }, 43 }, 42 { 44 { 43 .procname = "tx_ccid", 45 .procname = "tx_ccid", 44 .data = &sysctl_dccp 46 .data = &sysctl_dccp_tx_ccid, 45 .maxlen = sizeof(sysct 47 .maxlen = sizeof(sysctl_dccp_tx_ccid), 46 .mode = 0644, 48 .mode = 0644, 47 .proc_handler = proc_dointve 49 .proc_handler = proc_dointvec_minmax, 48 .extra1 = SYSCTL_ZERO, !! 50 .extra1 = &zero, 49 .extra2 = &u8_max, 51 .extra2 = &u8_max, /* RFC 4340, 10. */ 50 }, 52 }, 51 { 53 { 52 .procname = "request_ret 54 .procname = "request_retries", 53 .data = &sysctl_dccp 55 .data = &sysctl_dccp_request_retries, 54 .maxlen = sizeof(sysct 56 .maxlen = sizeof(sysctl_dccp_request_retries), 55 .mode = 0644, 57 .mode = 0644, 56 .proc_handler = proc_dointve 58 .proc_handler = proc_dointvec_minmax, 57 .extra1 = SYSCTL_ONE, !! 59 .extra1 = &one, 58 .extra2 = &u8_max, 60 .extra2 = &u8_max, 59 }, 61 }, 60 { 62 { 61 .procname = "retries1", 63 .procname = "retries1", 62 .data = &sysctl_dccp 64 .data = &sysctl_dccp_retries1, 63 .maxlen = sizeof(sysct 65 .maxlen = sizeof(sysctl_dccp_retries1), 64 .mode = 0644, 66 .mode = 0644, 65 .proc_handler = proc_dointve 67 .proc_handler = proc_dointvec_minmax, 66 .extra1 = SYSCTL_ZERO, !! 68 .extra1 = &zero, 67 .extra2 = &u8_max, 69 .extra2 = &u8_max, 68 }, 70 }, 69 { 71 { 70 .procname = "retries2", 72 .procname = "retries2", 71 .data = &sysctl_dccp 73 .data = &sysctl_dccp_retries2, 72 .maxlen = sizeof(sysct 74 .maxlen = sizeof(sysctl_dccp_retries2), 73 .mode = 0644, 75 .mode = 0644, 74 .proc_handler = proc_dointve 76 .proc_handler = proc_dointvec_minmax, 75 .extra1 = SYSCTL_ZERO, !! 77 .extra1 = &zero, 76 .extra2 = &u8_max, 78 .extra2 = &u8_max, 77 }, 79 }, 78 { 80 { 79 .procname = "tx_qlen", 81 .procname = "tx_qlen", 80 .data = &sysctl_dccp 82 .data = &sysctl_dccp_tx_qlen, 81 .maxlen = sizeof(sysct 83 .maxlen = sizeof(sysctl_dccp_tx_qlen), 82 .mode = 0644, 84 .mode = 0644, 83 .proc_handler = proc_dointve 85 .proc_handler = proc_dointvec_minmax, 84 .extra1 = SYSCTL_ZERO, !! 86 .extra1 = &zero, 85 }, 87 }, 86 { 88 { 87 .procname = "sync_rateli 89 .procname = "sync_ratelimit", 88 .data = &sysctl_dccp 90 .data = &sysctl_dccp_sync_ratelimit, 89 .maxlen = sizeof(sysct 91 .maxlen = sizeof(sysctl_dccp_sync_ratelimit), 90 .mode = 0644, 92 .mode = 0644, 91 .proc_handler = proc_dointve 93 .proc_handler = proc_dointvec_ms_jiffies, 92 }, 94 }, >> 95 >> 96 { } 93 }; 97 }; 94 98 95 static struct ctl_table_header *dccp_table_hea 99 static struct ctl_table_header *dccp_table_header; 96 100 97 int __init dccp_sysctl_init(void) 101 int __init dccp_sysctl_init(void) 98 { 102 { 99 dccp_table_header = register_net_sysct 103 dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default", 100 dccp_default_table); 104 dccp_default_table); 101 105 102 return dccp_table_header != NULL ? 0 : 106 return dccp_table_header != NULL ? 0 : -ENOMEM; 103 } 107 } 104 108 105 void dccp_sysctl_exit(void) 109 void dccp_sysctl_exit(void) 106 { 110 { 107 if (dccp_table_header != NULL) { 111 if (dccp_table_header != NULL) { 108 unregister_net_sysctl_table(dc 112 unregister_net_sysctl_table(dccp_table_header); 109 dccp_table_header = NULL; 113 dccp_table_header = NULL; 110 } 114 } 111 } 115 } 112 116
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.