1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef __NETNS_SCTP_H__ 3*4882a593Smuzhiyun #define __NETNS_SCTP_H__ 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun struct sock; 6*4882a593Smuzhiyun struct proc_dir_entry; 7*4882a593Smuzhiyun struct sctp_mib; 8*4882a593Smuzhiyun struct ctl_table_header; 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun struct netns_sctp { 11*4882a593Smuzhiyun DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics); 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun #ifdef CONFIG_PROC_FS 14*4882a593Smuzhiyun struct proc_dir_entry *proc_net_sctp; 15*4882a593Smuzhiyun #endif 16*4882a593Smuzhiyun #ifdef CONFIG_SYSCTL 17*4882a593Smuzhiyun struct ctl_table_header *sysctl_header; 18*4882a593Smuzhiyun #endif 19*4882a593Smuzhiyun /* This is the global socket data structure used for responding to 20*4882a593Smuzhiyun * the Out-of-the-blue (OOTB) packets. A control sock will be created 21*4882a593Smuzhiyun * for this socket at the initialization time. 22*4882a593Smuzhiyun */ 23*4882a593Smuzhiyun struct sock *ctl_sock; 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun /* This is the global local address list. 26*4882a593Smuzhiyun * We actively maintain this complete list of addresses on 27*4882a593Smuzhiyun * the system by catching address add/delete events. 28*4882a593Smuzhiyun * 29*4882a593Smuzhiyun * It is a list of sctp_sockaddr_entry. 30*4882a593Smuzhiyun */ 31*4882a593Smuzhiyun struct list_head local_addr_list; 32*4882a593Smuzhiyun struct list_head addr_waitq; 33*4882a593Smuzhiyun struct timer_list addr_wq_timer; 34*4882a593Smuzhiyun struct list_head auto_asconf_splist; 35*4882a593Smuzhiyun /* Lock that protects both addr_waitq and auto_asconf_splist */ 36*4882a593Smuzhiyun spinlock_t addr_wq_lock; 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun /* Lock that protects the local_addr_list writers */ 39*4882a593Smuzhiyun spinlock_t local_addr_lock; 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values 42*4882a593Smuzhiyun * 43*4882a593Smuzhiyun * The following protocol parameters are RECOMMENDED: 44*4882a593Smuzhiyun * 45*4882a593Smuzhiyun * RTO.Initial - 3 seconds 46*4882a593Smuzhiyun * RTO.Min - 1 second 47*4882a593Smuzhiyun * RTO.Max - 60 seconds 48*4882a593Smuzhiyun * RTO.Alpha - 1/8 (3 when converted to right shifts.) 49*4882a593Smuzhiyun * RTO.Beta - 1/4 (2 when converted to right shifts.) 50*4882a593Smuzhiyun */ 51*4882a593Smuzhiyun unsigned int rto_initial; 52*4882a593Smuzhiyun unsigned int rto_min; 53*4882a593Smuzhiyun unsigned int rto_max; 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun /* Note: rto_alpha and rto_beta are really defined as inverse 56*4882a593Smuzhiyun * powers of two to facilitate integer operations. 57*4882a593Smuzhiyun */ 58*4882a593Smuzhiyun int rto_alpha; 59*4882a593Smuzhiyun int rto_beta; 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun /* Max.Burst - 4 */ 62*4882a593Smuzhiyun int max_burst; 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun /* Whether Cookie Preservative is enabled(1) or not(0) */ 65*4882a593Smuzhiyun int cookie_preserve_enable; 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun /* The namespace default hmac alg */ 68*4882a593Smuzhiyun char *sctp_hmac_alg; 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun /* Valid.Cookie.Life - 60 seconds */ 71*4882a593Smuzhiyun unsigned int valid_cookie_life; 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun /* Delayed SACK timeout 200ms default*/ 74*4882a593Smuzhiyun unsigned int sack_timeout; 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun /* HB.interval - 30 seconds */ 77*4882a593Smuzhiyun unsigned int hb_interval; 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun /* Association.Max.Retrans - 10 attempts 80*4882a593Smuzhiyun * Path.Max.Retrans - 5 attempts (per destination address) 81*4882a593Smuzhiyun * Max.Init.Retransmits - 8 attempts 82*4882a593Smuzhiyun */ 83*4882a593Smuzhiyun int max_retrans_association; 84*4882a593Smuzhiyun int max_retrans_path; 85*4882a593Smuzhiyun int max_retrans_init; 86*4882a593Smuzhiyun /* Potentially-Failed.Max.Retrans sysctl value 87*4882a593Smuzhiyun * taken from: 88*4882a593Smuzhiyun * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05 89*4882a593Smuzhiyun */ 90*4882a593Smuzhiyun int pf_retrans; 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun /* Primary.Switchover.Max.Retrans sysctl value 93*4882a593Smuzhiyun * taken from: 94*4882a593Smuzhiyun * https://tools.ietf.org/html/rfc7829 95*4882a593Smuzhiyun */ 96*4882a593Smuzhiyun int ps_retrans; 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun /* 99*4882a593Smuzhiyun * Disable Potentially-Failed feature, the feature is enabled by default 100*4882a593Smuzhiyun * pf_enable - 0 : disable pf 101*4882a593Smuzhiyun * - >0 : enable pf 102*4882a593Smuzhiyun */ 103*4882a593Smuzhiyun int pf_enable; 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun /* 106*4882a593Smuzhiyun * Disable Potentially-Failed state exposure, ignored by default 107*4882a593Smuzhiyun * pf_expose - 0 : compatible with old applications (by default) 108*4882a593Smuzhiyun * - 1 : disable pf state exposure 109*4882a593Smuzhiyun * - 2 : enable pf state exposure 110*4882a593Smuzhiyun */ 111*4882a593Smuzhiyun int pf_expose; 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun /* 114*4882a593Smuzhiyun * Policy for preforming sctp/socket accounting 115*4882a593Smuzhiyun * 0 - do socket level accounting, all assocs share sk_sndbuf 116*4882a593Smuzhiyun * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes 117*4882a593Smuzhiyun */ 118*4882a593Smuzhiyun int sndbuf_policy; 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun /* 121*4882a593Smuzhiyun * Policy for preforming sctp/socket accounting 122*4882a593Smuzhiyun * 0 - do socket level accounting, all assocs share sk_rcvbuf 123*4882a593Smuzhiyun * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes 124*4882a593Smuzhiyun */ 125*4882a593Smuzhiyun int rcvbuf_policy; 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun int default_auto_asconf; 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun /* Flag to indicate if addip is enabled. */ 130*4882a593Smuzhiyun int addip_enable; 131*4882a593Smuzhiyun int addip_noauth; 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun /* Flag to indicate if PR-SCTP is enabled. */ 134*4882a593Smuzhiyun int prsctp_enable; 135*4882a593Smuzhiyun 136*4882a593Smuzhiyun /* Flag to indicate if PR-CONFIG is enabled. */ 137*4882a593Smuzhiyun int reconf_enable; 138*4882a593Smuzhiyun 139*4882a593Smuzhiyun /* Flag to indicate if SCTP-AUTH is enabled */ 140*4882a593Smuzhiyun int auth_enable; 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun /* Flag to indicate if stream interleave is enabled */ 143*4882a593Smuzhiyun int intl_enable; 144*4882a593Smuzhiyun 145*4882a593Smuzhiyun /* Flag to indicate if ecn is enabled */ 146*4882a593Smuzhiyun int ecn_enable; 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun /* 149*4882a593Smuzhiyun * Policy to control SCTP IPv4 address scoping 150*4882a593Smuzhiyun * 0 - Disable IPv4 address scoping 151*4882a593Smuzhiyun * 1 - Enable IPv4 address scoping 152*4882a593Smuzhiyun * 2 - Selectively allow only IPv4 private addresses 153*4882a593Smuzhiyun * 3 - Selectively allow only IPv4 link local address 154*4882a593Smuzhiyun */ 155*4882a593Smuzhiyun int scope_policy; 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun /* Threshold for rwnd update SACKS. Receive buffer shifted this many 158*4882a593Smuzhiyun * bits is an indicator of when to send and window update SACK. 159*4882a593Smuzhiyun */ 160*4882a593Smuzhiyun int rwnd_upd_shift; 161*4882a593Smuzhiyun 162*4882a593Smuzhiyun /* Threshold for autoclose timeout, in seconds. */ 163*4882a593Smuzhiyun unsigned long max_autoclose; 164*4882a593Smuzhiyun }; 165*4882a593Smuzhiyun 166*4882a593Smuzhiyun #endif /* __NETNS_SCTP_H__ */ 167