Lines Matching +full:write +full:- +full:data
1 // SPDX-License-Identifier: GPL-2.0-or-later
12 * lksctp developers <linux-sctp@vger.kernel.org>
46 static int proc_sctp_do_hmac_alg(const struct ctl_table *ctl, int write,
48 static int proc_sctp_do_rto_min(const struct ctl_table *ctl, int write,
50 static int proc_sctp_do_rto_max(const struct ctl_table *ctl, int write, void *buffer,
52 static int proc_sctp_do_udp_port(const struct ctl_table *ctl, int write, void *buffer,
54 static int proc_sctp_do_alpha_beta(const struct ctl_table *ctl, int write,
56 static int proc_sctp_do_auth(const struct ctl_table *ctl, int write,
58 static int proc_sctp_do_probe_interval(const struct ctl_table *ctl, int write,
64 .data = &sysctl_sctp_mem,
71 .data = &sysctl_sctp_rmem,
78 .data = &sysctl_sctp_wmem,
98 .data = &init_net.sctp.rto_min,
107 .data = &init_net.sctp.rto_max,
116 .data = &init_net.sctp.pf_retrans,
125 .data = &init_net.sctp.ps_retrans,
134 .data = &init_net.sctp.rto_initial,
143 .data = &init_net.sctp.rto_alpha,
152 .data = &init_net.sctp.rto_beta,
161 .data = &init_net.sctp.max_burst,
170 .data = &init_net.sctp.cookie_preserve_enable,
177 .data = &init_net.sctp.sctp_hmac_alg,
184 .data = &init_net.sctp.valid_cookie_life,
193 .data = &init_net.sctp.sack_timeout,
202 .data = &init_net.sctp.hb_interval,
211 .data = &init_net.sctp.max_retrans_association,
220 .data = &init_net.sctp.max_retrans_path,
229 .data = &init_net.sctp.max_retrans_init,
238 .data = &init_net.sctp.sndbuf_policy,
245 .data = &init_net.sctp.rcvbuf_policy,
252 .data = &init_net.sctp.default_auto_asconf,
259 .data = &init_net.sctp.addip_enable,
266 .data = &init_net.sctp.addip_noauth,
273 .data = &init_net.sctp.prsctp_enable,
280 .data = &init_net.sctp.reconf_enable,
287 .data = &init_net.sctp.auth_enable,
294 .data = &init_net.sctp.intl_enable,
301 .data = &init_net.sctp.ecn_enable,
308 .data = &init_net.sctp.probe_interval,
315 .data = &init_net.sctp.udp_port,
324 .data = &init_net.sctp.encap_port,
333 .data = &init_net.sctp.scope_policy,
342 .data = &init_net.sctp.rwnd_upd_shift,
351 .data = &init_net.sctp.max_autoclose,
361 .data = &init_net.sctp.l3mdev_accept,
371 .data = &init_net.sctp.pf_enable,
378 .data = &init_net.sctp.pf_expose,
387 static int proc_sctp_do_hmac_alg(const struct ctl_table *ctl, int write, in proc_sctp_do_hmac_alg() argument
390 struct net *net = current->nsproxy->net_ns; in proc_sctp_do_hmac_alg()
399 if (write) { in proc_sctp_do_hmac_alg()
400 tbl.data = tmp; in proc_sctp_do_hmac_alg()
403 tbl.data = net->sctp.sctp_hmac_alg ? : none; in proc_sctp_do_hmac_alg()
404 tbl.maxlen = strlen(tbl.data); in proc_sctp_do_hmac_alg()
407 ret = proc_dostring(&tbl, write, buffer, lenp, ppos); in proc_sctp_do_hmac_alg()
408 if (write && ret == 0) { in proc_sctp_do_hmac_alg()
411 net->sctp.sctp_hmac_alg = "md5"; in proc_sctp_do_hmac_alg()
417 net->sctp.sctp_hmac_alg = "sha1"; in proc_sctp_do_hmac_alg()
422 net->sctp.sctp_hmac_alg = NULL; in proc_sctp_do_hmac_alg()
426 ret = -EINVAL; in proc_sctp_do_hmac_alg()
432 static int proc_sctp_do_rto_min(const struct ctl_table *ctl, int write, in proc_sctp_do_rto_min() argument
435 struct net *net = current->nsproxy->net_ns; in proc_sctp_do_rto_min()
436 unsigned int min = *(unsigned int *) ctl->extra1; in proc_sctp_do_rto_min()
437 unsigned int max = *(unsigned int *) ctl->extra2; in proc_sctp_do_rto_min()
444 if (write) in proc_sctp_do_rto_min()
445 tbl.data = &new_value; in proc_sctp_do_rto_min()
447 tbl.data = &net->sctp.rto_min; in proc_sctp_do_rto_min()
449 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); in proc_sctp_do_rto_min()
450 if (write && ret == 0) { in proc_sctp_do_rto_min()
452 return -EINVAL; in proc_sctp_do_rto_min()
454 net->sctp.rto_min = new_value; in proc_sctp_do_rto_min()
460 static int proc_sctp_do_rto_max(const struct ctl_table *ctl, int write, in proc_sctp_do_rto_max() argument
463 struct net *net = current->nsproxy->net_ns; in proc_sctp_do_rto_max()
464 unsigned int min = *(unsigned int *) ctl->extra1; in proc_sctp_do_rto_max()
465 unsigned int max = *(unsigned int *) ctl->extra2; in proc_sctp_do_rto_max()
472 if (write) in proc_sctp_do_rto_max()
473 tbl.data = &new_value; in proc_sctp_do_rto_max()
475 tbl.data = &net->sctp.rto_max; in proc_sctp_do_rto_max()
477 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); in proc_sctp_do_rto_max()
478 if (write && ret == 0) { in proc_sctp_do_rto_max()
480 return -EINVAL; in proc_sctp_do_rto_max()
482 net->sctp.rto_max = new_value; in proc_sctp_do_rto_max()
488 static int proc_sctp_do_alpha_beta(const struct ctl_table *ctl, int write, in proc_sctp_do_alpha_beta() argument
491 if (write) in proc_sctp_do_alpha_beta()
495 return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos); in proc_sctp_do_alpha_beta()
498 static int proc_sctp_do_auth(const struct ctl_table *ctl, int write, in proc_sctp_do_auth() argument
501 struct net *net = current->nsproxy->net_ns; in proc_sctp_do_auth()
508 if (write) in proc_sctp_do_auth()
509 tbl.data = &new_value; in proc_sctp_do_auth()
511 tbl.data = &net->sctp.auth_enable; in proc_sctp_do_auth()
513 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); in proc_sctp_do_auth()
514 if (write && ret == 0) { in proc_sctp_do_auth()
515 struct sock *sk = net->sctp.ctl_sock; in proc_sctp_do_auth()
517 net->sctp.auth_enable = new_value; in proc_sctp_do_auth()
520 sctp_sk(sk)->ep->auth_enable = new_value; in proc_sctp_do_auth()
527 static int proc_sctp_do_udp_port(const struct ctl_table *ctl, int write, in proc_sctp_do_udp_port() argument
530 struct net *net = current->nsproxy->net_ns; in proc_sctp_do_udp_port()
531 unsigned int min = *(unsigned int *)ctl->extra1; in proc_sctp_do_udp_port()
532 unsigned int max = *(unsigned int *)ctl->extra2; in proc_sctp_do_udp_port()
539 if (write) in proc_sctp_do_udp_port()
540 tbl.data = &new_value; in proc_sctp_do_udp_port()
542 tbl.data = &net->sctp.udp_port; in proc_sctp_do_udp_port()
544 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); in proc_sctp_do_udp_port()
545 if (write && ret == 0) { in proc_sctp_do_udp_port()
546 struct sock *sk = net->sctp.ctl_sock; in proc_sctp_do_udp_port()
549 return -EINVAL; in proc_sctp_do_udp_port()
551 net->sctp.udp_port = new_value; in proc_sctp_do_udp_port()
556 net->sctp.udp_port = 0; in proc_sctp_do_udp_port()
561 sctp_sk(sk)->udp_port = htons(net->sctp.udp_port); in proc_sctp_do_udp_port()
568 static int proc_sctp_do_probe_interval(const struct ctl_table *ctl, int write, in proc_sctp_do_probe_interval() argument
571 struct net *net = current->nsproxy->net_ns; in proc_sctp_do_probe_interval()
578 if (write) in proc_sctp_do_probe_interval()
579 tbl.data = &new_value; in proc_sctp_do_probe_interval()
581 tbl.data = &net->sctp.probe_interval; in proc_sctp_do_probe_interval()
583 ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); in proc_sctp_do_probe_interval()
584 if (write && ret == 0) { in proc_sctp_do_probe_interval()
586 return -EINVAL; in proc_sctp_do_probe_interval()
588 net->sctp.probe_interval = new_value; in proc_sctp_do_probe_interval()
602 return -ENOMEM; in sctp_sysctl_net_register()
605 table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp; in sctp_sysctl_net_register()
607 table[SCTP_RTO_MIN_IDX].extra2 = &net->sctp.rto_max; in sctp_sysctl_net_register()
608 table[SCTP_RTO_MAX_IDX].extra1 = &net->sctp.rto_min; in sctp_sysctl_net_register()
609 table[SCTP_PF_RETRANS_IDX].extra2 = &net->sctp.ps_retrans; in sctp_sysctl_net_register()
610 table[SCTP_PS_RETRANS_IDX].extra1 = &net->sctp.pf_retrans; in sctp_sysctl_net_register()
612 net->sctp.sysctl_header = register_net_sysctl_sz(net, "net/sctp", in sctp_sysctl_net_register()
614 if (net->sctp.sysctl_header == NULL) { in sctp_sysctl_net_register()
616 return -ENOMEM; in sctp_sysctl_net_register()
625 table = net->sctp.sysctl_header->ctl_table_arg; in sctp_sysctl_net_unregister()
626 unregister_net_sysctl_table(net->sctp.sysctl_header); in sctp_sysctl_net_unregister()