aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sysctl.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-12-18 16:42:06 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-18 16:42:06 -0500
commit143c9054949436cb05e468439dc5e46231f33d09 (patch)
treec2e972d8188fb1b36368e9acb5b6b59466c9d903 /net/sctp/sysctl.c
parent0b6807034791160d5e584138943d2daea765436d (diff)
parent35eecf052250f663f07a4cded7d3503fd1b50729 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/intel/i40e/i40e_main.c drivers/net/macvtap.c Both minor merge hassles, simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/sysctl.c')
-rw-r--r--net/sctp/sysctl.c76
1 files changed, 67 insertions, 9 deletions
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 80b17b5df6bb..9dd5ac084663 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -55,11 +55,16 @@ extern long sysctl_sctp_mem[3];
55extern int sysctl_sctp_rmem[3]; 55extern int sysctl_sctp_rmem[3];
56extern int sysctl_sctp_wmem[3]; 56extern int sysctl_sctp_wmem[3];
57 57
58static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, 58static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
59 int write, 59 void __user *buffer, size_t *lenp,
60 loff_t *ppos);
61static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
62 void __user *buffer, size_t *lenp,
63 loff_t *ppos);
64static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
60 void __user *buffer, size_t *lenp, 65 void __user *buffer, size_t *lenp,
61
62 loff_t *ppos); 66 loff_t *ppos);
67
63static struct ctl_table sctp_table[] = { 68static struct ctl_table sctp_table[] = {
64 { 69 {
65 .procname = "sctp_mem", 70 .procname = "sctp_mem",
@@ -101,17 +106,17 @@ static struct ctl_table sctp_net_table[] = {
101 .data = &init_net.sctp.rto_min, 106 .data = &init_net.sctp.rto_min,
102 .maxlen = sizeof(unsigned int), 107 .maxlen = sizeof(unsigned int),
103 .mode = 0644, 108 .mode = 0644,
104 .proc_handler = proc_dointvec_minmax, 109 .proc_handler = proc_sctp_do_rto_min,
105 .extra1 = &one, 110 .extra1 = &one,
106 .extra2 = &timer_max 111 .extra2 = &init_net.sctp.rto_max
107 }, 112 },
108 { 113 {
109 .procname = "rto_max", 114 .procname = "rto_max",
110 .data = &init_net.sctp.rto_max, 115 .data = &init_net.sctp.rto_max,
111 .maxlen = sizeof(unsigned int), 116 .maxlen = sizeof(unsigned int),
112 .mode = 0644, 117 .mode = 0644,
113 .proc_handler = proc_dointvec_minmax, 118 .proc_handler = proc_sctp_do_rto_max,
114 .extra1 = &one, 119 .extra1 = &init_net.sctp.rto_min,
115 .extra2 = &timer_max 120 .extra2 = &timer_max
116 }, 121 },
117 { 122 {
@@ -293,8 +298,7 @@ static struct ctl_table sctp_net_table[] = {
293 { /* sentinel */ } 298 { /* sentinel */ }
294}; 299};
295 300
296static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, 301static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
297 int write,
298 void __user *buffer, size_t *lenp, 302 void __user *buffer, size_t *lenp,
299 loff_t *ppos) 303 loff_t *ppos)
300{ 304{
@@ -341,6 +345,60 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl,
341 return ret; 345 return ret;
342} 346}
343 347
348static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
349 void __user *buffer, size_t *lenp,
350 loff_t *ppos)
351{
352 struct net *net = current->nsproxy->net_ns;
353 int new_value;
354 struct ctl_table tbl;
355 unsigned int min = *(unsigned int *) ctl->extra1;
356 unsigned int max = *(unsigned int *) ctl->extra2;
357 int ret;
358
359 memset(&tbl, 0, sizeof(struct ctl_table));
360 tbl.maxlen = sizeof(unsigned int);
361
362 if (write)
363 tbl.data = &new_value;
364 else
365 tbl.data = &net->sctp.rto_min;
366 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
367 if (write) {
368 if (ret || new_value > max || new_value < min)
369 return -EINVAL;
370 net->sctp.rto_min = new_value;
371 }
372 return ret;
373}
374
375static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
376 void __user *buffer, size_t *lenp,
377 loff_t *ppos)
378{
379 struct net *net = current->nsproxy->net_ns;
380 int new_value;
381 struct ctl_table tbl;
382 unsigned int min = *(unsigned int *) ctl->extra1;
383 unsigned int max = *(unsigned int *) ctl->extra2;
384 int ret;
385
386 memset(&tbl, 0, sizeof(struct ctl_table));
387 tbl.maxlen = sizeof(unsigned int);
388
389 if (write)
390 tbl.data = &new_value;
391 else
392 tbl.data = &net->sctp.rto_max;
393 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
394 if (write) {
395 if (ret || new_value > max || new_value < min)
396 return -EINVAL;
397 net->sctp.rto_max = new_value;
398 }
399 return ret;
400}
401
344int sctp_sysctl_net_register(struct net *net) 402int sctp_sysctl_net_register(struct net *net)
345{ 403{
346 struct ctl_table *table; 404 struct ctl_table *table;