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