linux/net/sctp/sysctl.c
<<
>>
Prefs
   1/* SCTP kernel implementation
   2 * (C) Copyright IBM Corp. 2002, 2004
   3 * Copyright (c) 2002 Intel Corp.
   4 *
   5 * This file is part of the SCTP kernel implementation
   6 *
   7 * Sysctl related interfaces for SCTP.
   8 *
   9 * This SCTP implementation is free software;
  10 * you can redistribute it and/or modify it under the terms of
  11 * the GNU General Public License as published by
  12 * the Free Software Foundation; either version 2, or (at your option)
  13 * any later version.
  14 *
  15 * This SCTP implementation is distributed in the hope that it
  16 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
  17 *                 ************************
  18 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  19 * See the GNU General Public License for more details.
  20 *
  21 * You should have received a copy of the GNU General Public License
  22 * along with GNU CC; see the file COPYING.  If not, write to
  23 * the Free Software Foundation, 59 Temple Place - Suite 330,
  24 * Boston, MA 02111-1307, USA.
  25 *
  26 * Please send any bug reports or fixes you make to the
  27 * email address(es):
  28 *    lksctp developers <lksctp-developers@lists.sourceforge.net>
  29 *
  30 * Or submit a bug report through the following website:
  31 *    http://www.sf.net/projects/lksctp
  32 *
  33 * Written or modified by:
  34 *    Mingqin Liu           <liuming@us.ibm.com>
  35 *    Jon Grimm             <jgrimm@us.ibm.com>
  36 *    Ardelle Fan           <ardelle.fan@intel.com>
  37 *    Ryan Layer            <rmlayer@us.ibm.com>
  38 *    Sridhar Samudrala     <sri@us.ibm.com>
  39 *
  40 * Any bugs reported given to us we will try to fix... any fixes shared will
  41 * be incorporated into the next SCTP release.
  42 */
  43
  44#include <net/sctp/structs.h>
  45#include <net/sctp/sctp.h>
  46#include <linux/sysctl.h>
  47
  48static int zero = 0;
  49static int one = 1;
  50static int timer_max = 86400000; /* ms in one day */
  51static int int_max = INT_MAX;
  52static int sack_timer_min = 1;
  53static int sack_timer_max = 500;
  54static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
  55static int rwnd_scale_max = 16;
  56static unsigned long max_autoclose_min = 0;
  57static unsigned long max_autoclose_max =
  58        (MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX)
  59        ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;
  60
  61extern long sysctl_sctp_mem[3];
  62extern int sysctl_sctp_rmem[3];
  63extern int sysctl_sctp_wmem[3];
  64
  65static int proc_sctp_do_hmac_alg(ctl_table *ctl,
  66                                int write,
  67                                void __user *buffer, size_t *lenp,
  68
  69                                loff_t *ppos);
  70static ctl_table sctp_table[] = {
  71        {
  72                .procname       = "sctp_mem",
  73                .data           = &sysctl_sctp_mem,
  74                .maxlen         = sizeof(sysctl_sctp_mem),
  75                .mode           = 0644,
  76                .proc_handler   = proc_doulongvec_minmax
  77        },
  78        {
  79                .procname       = "sctp_rmem",
  80                .data           = &sysctl_sctp_rmem,
  81                .maxlen         = sizeof(sysctl_sctp_rmem),
  82                .mode           = 0644,
  83                .proc_handler   = proc_dointvec,
  84        },
  85        {
  86                .procname       = "sctp_wmem",
  87                .data           = &sysctl_sctp_wmem,
  88                .maxlen         = sizeof(sysctl_sctp_wmem),
  89                .mode           = 0644,
  90                .proc_handler   = proc_dointvec,
  91        },
  92
  93        { /* sentinel */ }
  94};
  95
  96static ctl_table sctp_net_table[] = {
  97        {
  98                .procname       = "rto_initial",
  99                .data           = &init_net.sctp.rto_initial,
 100                .maxlen         = sizeof(unsigned int),
 101                .mode           = 0644,
 102                .proc_handler   = proc_dointvec_minmax,
 103                .extra1         = &one,
 104                .extra2         = &timer_max
 105        },
 106        {
 107                .procname       = "rto_min",
 108                .data           = &init_net.sctp.rto_min,
 109                .maxlen         = sizeof(unsigned int),
 110                .mode           = 0644,
 111                .proc_handler   = proc_dointvec_minmax,
 112                .extra1         = &one,
 113                .extra2         = &timer_max
 114        },
 115        {
 116                .procname       = "rto_max",
 117                .data           = &init_net.sctp.rto_max,
 118                .maxlen         = sizeof(unsigned int),
 119                .mode           = 0644,
 120                .proc_handler   = proc_dointvec_minmax,
 121                .extra1         = &one,
 122                .extra2         = &timer_max
 123        },
 124        {
 125                .procname       = "rto_alpha_exp_divisor",
 126                .data           = &init_net.sctp.rto_alpha,
 127                .maxlen         = sizeof(int),
 128                .mode           = 0444,
 129                .proc_handler   = proc_dointvec,
 130        },
 131        {
 132                .procname       = "rto_beta_exp_divisor",
 133                .data           = &init_net.sctp.rto_beta,
 134                .maxlen         = sizeof(int),
 135                .mode           = 0444,
 136                .proc_handler   = proc_dointvec,
 137        },
 138        {
 139                .procname       = "max_burst",
 140                .data           = &init_net.sctp.max_burst,
 141                .maxlen         = sizeof(int),
 142                .mode           = 0644,
 143                .proc_handler   = proc_dointvec_minmax,
 144                .extra1         = &zero,
 145                .extra2         = &int_max
 146        },
 147        {
 148                .procname       = "cookie_preserve_enable",
 149                .data           = &init_net.sctp.cookie_preserve_enable,
 150                .maxlen         = sizeof(int),
 151                .mode           = 0644,
 152                .proc_handler   = proc_dointvec,
 153        },
 154        {
 155                .procname       = "cookie_hmac_alg",
 156                .maxlen         = 8,
 157                .mode           = 0644,
 158                .proc_handler   = proc_sctp_do_hmac_alg,
 159        },
 160        {
 161                .procname       = "valid_cookie_life",
 162                .data           = &init_net.sctp.valid_cookie_life,
 163                .maxlen         = sizeof(unsigned int),
 164                .mode           = 0644,
 165                .proc_handler   = proc_dointvec_minmax,
 166                .extra1         = &one,
 167                .extra2         = &timer_max
 168        },
 169        {
 170                .procname       = "sack_timeout",
 171                .data           = &init_net.sctp.sack_timeout,
 172                .maxlen         = sizeof(int),
 173                .mode           = 0644,
 174                .proc_handler   = proc_dointvec_minmax,
 175                .extra1         = &sack_timer_min,
timer_max
sack_timer_max = 500;
  17  781     1  {
  791     1          .procname       = "sctp_rmem&quhb_or SCvan>,
  801     1          .data           = &init_net.sctp.sctp.  811     1          .maxlen         = sizeof(  821     1          .mode           = 0644,
  831     1          .proc_handler   = proc_dointvec_minmax,
  841     18         .extra1         = &one,
  851     18         .extra2         = &timer_max
  861     18 },
  871     18 {
  881     1          .procname       = "sctp_rmem&qu>&qocimple href_re   ns>,
  891     1          .data           = &init_net.sctp.max_burst,
&qocimple f="net/sctp/sysctl.c#L167" id="L167 class="l1ine" name="L90">  901     1          .maxlen         = sizeof(int),
  911     19         .mode           = 0644,
  921
proc_handler   = proc_dointvec_minmax,
  931     19         .extra1         = &one,
  941};
extra2         = &int_max
  951
  961stati19 {
  971     19         .procname       = "rto_min"pathhref_re   ns>,
  981     1          .data           = &init_net.sctp.max_burst,
  19maxlen         = sizeof(int),
 100mode           = 0644,
 101proc_handler   = proc_dointvec_minmax,
 102extra1         = &one,
 103extra2         = &int_max
 104 105 106procname       = "rto_max">,
<.,
 107data           = &init_net.sctp.max_burst,
 108maxlen         = sizeof(int),
 109mode           = 0644,
 110proc_handler   = proc_dointvec_minmax,
 111extra1         = &one,
 112extra2         = &int_max
 113 114 115procname       = "cookie_hmac_pf_re   ns>,
 116data           = &init_net.sctp.procname f_re   nsf="net/sctp/sysctl.c#L104" id="L102" class="2ine" name="L117"> 117maxlen         = sizeof(int),
 118mode           = 0644,
 119proc_handler   = proc_dointvec_minmax,
 120extra1         = &zero,
 121extra2         = &int_max
 122 123 124procname       = "sack_timeout&ndbuf includ>,
 125data           = &init_net.sctp.sctp. 126maxlen         = sizeof(int),
 127mode           = 0644,
 128proc_handler   = proc_dointvec,
 129 130 131procname       = "valid_cookiercvbuf includ>,
 132data           = &init_net.sctp.sctp. 133maxlen         = sizeof(int),
 134mode           = 0644,
 135proc_handler   = proc_dointvec,
 136 137 138procname       = "sctp_rmem&qudefaultax,
 139data           = &init_net.sctp.data     efaultax 140maxlen         = sizeof(int),
 141mode           = 0644,
 142proc_handler   = proc_dointvec,
 143 144 145procname       = "sctp_rmem&qu>ddip;,
 146data           = &init_net.sctp.sctp.ddip; 147maxlen         = sizeof(int),
 148mode           = 0644,
 149proc_handler   = proc_dointvec,
 150 151 152procname       = "sctp_rmem&qu>ddip;nox,
 153data           = &init_net.sctp.ddip;noxsctp.ddip;nox 154maxlen         = sizeof(int),
 155mode           = 0644,
 156proc_handler   = proc_dointvec,
 157 158 159procname       = "sctp_rmem&quprc#L7;,
 160data           = &init_net.sctp.procname  c#L7; 161maxlen         = sizeof(int),
 162mode           = 0644,
 163proc_handler   = proc_dointvec,
 164 165 166procname       = "sctp_rmem&qu>,
 167data           = &init_net.sctp.sctp. 168maxlen         = sizeof(int),
 169mode           = 0644,
 170proc_handler   = proc_dointvec,
 171 172 173procname       = "sctp_rmem&qu>ddr_scope includ>,
 174data           = &init_net.sctp.sctp. 175maxlen         = sizeof(int),
mode           = 0644,
  172s    27         .proc_handler   = proc_dointvec_minmax,
  782     27         .extra1         = &zero,
  792     2          .extra2         = &ddr_scope sref">proc_dointve>ddr_scope sref="net/sctp/sysctl.c#L145" id="L142 class="l2ine" name="L80">  802     28 },
  812     28         .  822     2          .procname       = "valid_cookierwnd_up   e_shifn>,
  832     2          .data           = &init_net.sctp.sctp.  842     28         .maxlen         = sizeof(int),
  852     28         .mode           = 0644,
  862     28         .proc_handler   = proc_dointvec_minmax,
  872     28         .extra1         = &one,
  882     2          .extra2         = &proc_dointverwnd_scale sref="net/sctp/sysctl.c#L104" id="L102 class="l2ine" name="L89">  892     28 },
  902     29 {
  912     29         .procname       = "rto_max">,
,
  922
data           = &init_net.sctp.maxlen       932     29         .maxlen         = sizeof(  942};
mode           = 0644,
  952
proc_handler   = proc_dointvec_minmaulongclass="sref="net/sctp/sysctl.c#L104" id="L102 class="l2ine" name="L96">  962stati29         .extra1         = &sack_timer_m     972     29         .extra2         = &proc_dointve     982     2          .  192s    2      t/sctp/sysctl.c#L160" id="L163" class="3ine" name="L100"> 100&quocomment">/* sent100l */href="n }t/sctp/sysctl.c#L160" id="L163"1class="3ine" name="L91">  913     3      };t/sctp/sysctl.c#L160" id="L163"2class="3ine" name="L92">  923     3      t/sctp/sysctl.c#L160" id="L163"3class="3ine" name="L93">  933     3      staticef="ode=proc_sctp_do_hmac_alg" class="sref">proc_sctp_do_hmac_alg,
cookie_preserd=_t"sre     *de=proc_sctp_doid=f">cookie_preserd=f="net/sctp/sysctl.c#L104" id="L103" class="3ine" name="L104"> 104cookie_presewritef="net/sctp/sysctl.c#L104" id="L103"5class="3ine" name="L95">  953     30         .proc_handler__usre     *de=proc_sctp_dobuffref">proc_handlerbuffref="neode=proc_sctp_doef="_ef">sack_timeoutsctp.  963     30         .sack_timeout off_e     *de=proc_sctp_dopposf">procname pos    )t/sctp/sysctl.c#L104" id="L103"7class="3ine" name="L97">  973     3      et/sctp/sysctl.c#L161" id="L163"class="l3to_min"pathhref_re  3     3160" id="L163" class="sref">extra2         = &amnet/sctp/sysctl.c#L175" id="L175" class="line" name="L175"> 175                .  currtl.ccccccccccccccf=urrtl.sctl->e="L98">  98ns"nexhref="+code=extrns"nexhsctl->e="L98">  98netp/#L161" id="L163"netp/#sctline" name="L93">  933     3 9"L175" cl&quocomme32" cl3ss="2ine" namechare" name="L78">  tmcccccccccccccccctmc="2i[8]ine" name="L93">  933     3href="+co3e=proc_dointvec_minmax" 3lass=3sref">proc_doid="L103" class="3ine" name="L104"> 104  tbcccccccccccccccftbcsctline" name="L93">  933     3ref="+cod3=one" class="sref">one,
  933     3r     stat=timer_max" css="sref">i3t_max3/a>
 104  933     3r/a>,
2
dine" name="L93">  933     3rritef="ne         .  933     3rr__usre  ng">"cookie_hmac_pf3re   3s>,
  982emsine" name="L96"202emsin04" i/a>1     18 },
 104  933     3r_e     *dysctl_sctp_ass="sref">in3t_net3/a>.  933     3r160" id="f="net/sctp/sysctl.c#L173" id=3L172" class="2if id="L103" class=f="+cccccccccccccccccvoidode=)ef">procname       =     18 },
sctp.  tmcccccccccccccccctmc="2iine" name="L93">  933     3r9"L175" ce=proc_dointvec_minmax" 3lass=3sref">proc_dointvec_mi    18 },
">  942};
  933     3ref="+cod3=zero" class="sref">zero3/a>,
3a href="net/sc} elseef">procname       = i3t_max3/a>
sctp.  3ine" name="L96"20/sysctl->e="L98">  98 class="2ine" name="L175"> 175cookie_preserd=f=  tp/id=f">co=sack? :e" name="L78">  3code=maxlen" classn="sref"ine" name="L93">  933     3r     stat  },
">  942};
2};
sctp.  933     3/a2     23         .  923    lass="str3ng">"sack_timeout&n3buf i3clud>,
  782    .1     18 },
  7.c#L161" id="L163"class="l3ine" name="L93">  933     3/r__usre  ysctl_sctp_ass="sref">in3t_net3/a>.  933     3/_e     *df="net/sctp/sysctl.c#L173" id=3L172" class="2if id="L103" class=f="+cccccccccccccccccvoidode=)ef">procname       =   CONFIG_CRYPTO_MD5cccccccccccccccCONFIG_CRYPTO_MD5>.  933     3/f="net/s3e=proc_dointvec" class="3ref">3roc_dointvec,
2
da 3))ef">procname       = proc_dointvec_mi="net/sc        .  98 class="2ine" name="L175"> 175cookie_preserd=f=  tp/id=f">co=sacka>2
dine" name="L93">  933     3/a2     23         . 104  933     3/ef="+cod3ng">"valid_cookierc3buf i3clud>,
  923    f="+code=3ysctl_sctp_ass="sref">in3t_net3/a>.  923    fa2     23f="net/sctp/sysctl.c#L173" id=3L172" #ifdefe" name="L78">  CONFIG_CRYPTO_SHAsysctl.c#L104" iCONFIG_CRYPTO_SHAs>.  933     3ef="net/s3tp/sysctl.c#L152" id="L132" cl3ss="2ine" name="L135">if i!752
da 4))ef">procname       = 3roc_dointvec,
  98 class="2ine" name="L175"> 175cookie_preserd=f=  tp/id=f">co=sacka>2
dine" name="L93">  933     3/_e     *d3 {
 104  933     3/f="net/s3         .  923    ff="net/s3ng">"sctp_rmem&qude3aulta3  923    f9"L175" cysctl_sctp_ass="sref">in3t_net3/a>.2
da 4))ef">procname       =   98 class="2ine" name="L175"> 175cookie_preserd=f=  tp/id=f">co=sacka>25  933     3ef="net/s3tp/sysctl.c#L152" id="L132" cl3ss="2ine" name="L142">tl.c#L10        . 104  933     3href="+co3e=proc_dointvec" class="3ref">3roc_dointvec,
  923      923    if i!75 104"sctp_rmem&qu>d3ip;,
  933     3e_e     *dysctl_sctp_ass="sref">in3t_net3/a>.  923      923      933     3href="+co3e=proc_dointvec" class="3ref">3roc_do"3ine" name="L92">  923      923    "sctp_rmem&qu>d3ip;no3procname       = in3t_net3/a>. 104 104<    30   ine" name="L93">  933     3t),
 104  933     3tass="str3tp/sysctl.c#L152" id="L132" cl355>.  933     3href="+co3e=proc_dointvec" class="3ref">3roc_dointvec 104<    30   ka>25 104<  tp//sy_e" na="2i,>=extra2d="L103" class=  tp//sy_e" name="L104"> 104<  tp//sy_e" na="2i)se" name="L78">  GFP_KERNELokie_preserd=f=GFP_KERNELs="l3ine" name="L93">  933     3 104<    30   3to_min"pathhref_re  3     lf="net/s3         .  933     3tref="+co3ng">"sctp_rmem&qupr3#L7;<35ent100l */href="n }t/sctp/sysctl.c#f="+code=3ysctl_sctp_ass="sref">in3t_net3/a>. 104 104<    30   [d="L103" class=ime="L104"> 104sctp. 104 104<    30   [d="L103" class=ime="L104"> 104sctp.  98 class="2ine" name="L175"> ) - (chare )xmaxlen     ine" name="L93">  933     3ef="net/s3tp/sysctl.c#L152" id="L132" cl36 class="sref">proc_sctp_do_hmac_alghref="+co3e=proc_dointvec" class="3ref">3roc_dointvec  98 class="2ine" name="L175"> 175pheadnet/sctp/sysctl.c 2pheadne0   ka>25e" name="L96"20rsgistne//sy_ 204" id="L103" class=3ine" name="L96"20/sysctl,>2
da 75 104<    30   3ine" name="L93">  933     3e),
  933     3/a2     23         .  923    lass="str3ng">"sctp_rmem&qu><3h;.  933     3f="+code=3ysctl_sctp_ass="sref">in3t_net3/a>.sack_timeout<  tp/92p/sy_unregistnet/sctp/sysctl.c  tp/92p/sy_unregistne04" i   .procname       =  104 104<    30   ine" name="L93">  933     3href="+co3e=proc_dointvec" class="3ref">37155" 3ine" name="L92">  923     104<    30   ka>25  98 class="2ine" name="L175"> 175pheadnet/sctp/sysctl.c 2pheadne0   ->e="L98">  98/a3     3_arookie_preserd=f=/a3     3_aro0   ine" name="L93">  933     3hf="net/s3         .  98unregistne//sy_ 2ne" name="L104"> 104ne" na04" id="L103" class=3ine" name="L96"20/sysctl->e="L98">  98 class="2ine" name="L175"> 175pheadnet/sctp/sysctl.c 2pheadne0   3ine" name="L93">  933     3lass="str3ng">"sctp_rmem&qu>d3r_sco37oc_dointvec 104 104<    30   3ine" name="L93">  933     3f="+code=3ysctl_sctp_ass="sref">in3t_net3/a>.  923    t),
.  933     3ef="net/s3tp/sysctl.c#L152" id="L132" cl3ss="2nkie_pre   .sack_timeout<  tp/92pheadnet/sctp/sysctl.c  tp/92pheadne0   ine" name="L93">  933     3h="+code=3e=proc_dointvec_minmax" 3lass=37172" 3ine" name="L92">  923    ref="+cod3=zero" class="sref">zero3/a>,
3a href    };t/sctp/sysctl.c#L16S2 registre_pon. 163"2class3ine" name="L92">  923    rf="net/s3=timer_max" c>ddr_scope 3ref">3roc_do="_ef">sack_timeout<  tp/92pregistnet/sctp/sysctl.c  tp/92pregistne04" i="_e3to_min"pathhref_re  3     /a>2     38         .procname       = 2     23         .04" ixmaxlen     da 75 104<  tp/    30   3ine" name="L93">  933     3lass="str3ng">"valid_cookierw3d_up 3 e_shi"3ine" name="L92">  923    f="+code=3ysctl_sctp_ass="sref">in3t_net38155" 3ine" name="L92">  923    t),
 dneegistre_pon. 163"2class3ine" name="L92">  923    ef="net/s3tp/sysctl.c#L152" id="L132 cla3s="l2i="_ef">sack_timeout<  tp/92punregistnet/sctp/sysctl.c  tp/92punregistne04" i="_e3to_min"pathhref_re  3     /f="net/s3"+code=sysctl_sctp_c_min3ax" c3ass="sf">procname       = one,
  98unregistne//sy_ 2ne" name="L104"> 104ne" na04" id="L103" class=  tp/92pheadnet/sctp/sysctl.c  tp/92pheadne0   3ine" name="L93">  933     3lef="+cod3=timer_max" crwnd_scale 3ref">3roc_do"3ine" name="L92">  923    ff="net/s39 {



The original LXR software by the ine" namehttp://sourceforge.="L9projects/lxet>LXR syscusctsref"> this experictl.al verspon by ine" namemailto:lxe@="nux.no">lxe@="nux.no5"> 1
lxe.="nux.no kindly hostnd by ine" namehttp://www.redpill-="npro.no">Redpill L"npro ASref"> providne of L"nux synsult .< and opere_pons services since 1995.