hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/net/sctp/sysctl.c
....@@ -79,17 +79,18 @@
7979 { /* sentinel */ }
8080 };
8181
82
+/* The following index defines are used in sctp_sysctl_net_register().
83
+ * If you add new items to the sctp_net_table, please ensure that
84
+ * the index values of these defines hold the same meaning indicated by
85
+ * their macro names when they appear in sctp_net_table.
86
+ */
87
+#define SCTP_RTO_MIN_IDX 0
88
+#define SCTP_RTO_MAX_IDX 1
89
+#define SCTP_PF_RETRANS_IDX 2
90
+#define SCTP_PS_RETRANS_IDX 3
91
+
8292 static struct ctl_table sctp_net_table[] = {
83
- {
84
- .procname = "rto_initial",
85
- .data = &init_net.sctp.rto_initial,
86
- .maxlen = sizeof(unsigned int),
87
- .mode = 0644,
88
- .proc_handler = proc_dointvec_minmax,
89
- .extra1 = SYSCTL_ONE,
90
- .extra2 = &timer_max
91
- },
92
- {
93
+ [SCTP_RTO_MIN_IDX] = {
9394 .procname = "rto_min",
9495 .data = &init_net.sctp.rto_min,
9596 .maxlen = sizeof(unsigned int),
....@@ -98,13 +99,40 @@
9899 .extra1 = SYSCTL_ONE,
99100 .extra2 = &init_net.sctp.rto_max
100101 },
101
- {
102
+ [SCTP_RTO_MAX_IDX] = {
102103 .procname = "rto_max",
103104 .data = &init_net.sctp.rto_max,
104105 .maxlen = sizeof(unsigned int),
105106 .mode = 0644,
106107 .proc_handler = proc_sctp_do_rto_max,
107108 .extra1 = &init_net.sctp.rto_min,
109
+ .extra2 = &timer_max
110
+ },
111
+ [SCTP_PF_RETRANS_IDX] = {
112
+ .procname = "pf_retrans",
113
+ .data = &init_net.sctp.pf_retrans,
114
+ .maxlen = sizeof(int),
115
+ .mode = 0644,
116
+ .proc_handler = proc_dointvec_minmax,
117
+ .extra1 = SYSCTL_ZERO,
118
+ .extra2 = &init_net.sctp.ps_retrans,
119
+ },
120
+ [SCTP_PS_RETRANS_IDX] = {
121
+ .procname = "ps_retrans",
122
+ .data = &init_net.sctp.ps_retrans,
123
+ .maxlen = sizeof(int),
124
+ .mode = 0644,
125
+ .proc_handler = proc_dointvec_minmax,
126
+ .extra1 = &init_net.sctp.pf_retrans,
127
+ .extra2 = &ps_retrans_max,
128
+ },
129
+ {
130
+ .procname = "rto_initial",
131
+ .data = &init_net.sctp.rto_initial,
132
+ .maxlen = sizeof(unsigned int),
133
+ .mode = 0644,
134
+ .proc_handler = proc_dointvec_minmax,
135
+ .extra1 = SYSCTL_ONE,
108136 .extra2 = &timer_max
109137 },
110138 {
....@@ -201,24 +229,6 @@
201229 .proc_handler = proc_dointvec_minmax,
202230 .extra1 = SYSCTL_ONE,
203231 .extra2 = SYSCTL_INT_MAX,
204
- },
205
- {
206
- .procname = "pf_retrans",
207
- .data = &init_net.sctp.pf_retrans,
208
- .maxlen = sizeof(int),
209
- .mode = 0644,
210
- .proc_handler = proc_dointvec_minmax,
211
- .extra1 = SYSCTL_ZERO,
212
- .extra2 = &init_net.sctp.ps_retrans,
213
- },
214
- {
215
- .procname = "ps_retrans",
216
- .data = &init_net.sctp.ps_retrans,
217
- .maxlen = sizeof(int),
218
- .mode = 0644,
219
- .proc_handler = proc_dointvec_minmax,
220
- .extra1 = &init_net.sctp.pf_retrans,
221
- .extra2 = &ps_retrans_max,
222232 },
223233 {
224234 .procname = "sndbuf_policy",
....@@ -489,6 +499,11 @@
489499 for (i = 0; table[i].data; i++)
490500 table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
491501
502
+ table[SCTP_RTO_MIN_IDX].extra2 = &net->sctp.rto_max;
503
+ table[SCTP_RTO_MAX_IDX].extra1 = &net->sctp.rto_min;
504
+ table[SCTP_PF_RETRANS_IDX].extra2 = &net->sctp.ps_retrans;
505
+ table[SCTP_PS_RETRANS_IDX].extra1 = &net->sctp.pf_retrans;
506
+
492507 net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table);
493508 if (net->sctp.sysctl_header == NULL) {
494509 kfree(table);