1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 24db67e80SEric W. Biederman #ifndef __NETNS_SCTP_H__ 34db67e80SEric W. Biederman #define __NETNS_SCTP_H__ 44db67e80SEric W. Biederman 5949d6b40SJakub Kicinski #include <linux/timer.h> 6949d6b40SJakub Kicinski #include <net/snmp.h> 7949d6b40SJakub Kicinski 82ce95503SEric W. Biederman struct sock; 913d782f6SEric W. Biederman struct proc_dir_entry; 10b01a2407SEric W. Biederman struct sctp_mib; 11ebb7e95dSEric W. Biederman struct ctl_table_header; 122ce95503SEric W. Biederman 134db67e80SEric W. Biederman struct netns_sctp { 14b01a2407SEric W. Biederman DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics); 15b01a2407SEric W. Biederman 1613d782f6SEric W. Biederman #ifdef CONFIG_PROC_FS 1713d782f6SEric W. Biederman struct proc_dir_entry *proc_net_sctp; 1813d782f6SEric W. Biederman #endif 19ebb7e95dSEric W. Biederman #ifdef CONFIG_SYSCTL 20ebb7e95dSEric W. Biederman struct ctl_table_header *sysctl_header; 21ebb7e95dSEric W. Biederman #endif 222ce95503SEric W. Biederman /* This is the global socket data structure used for responding to 232ce95503SEric W. Biederman * the Out-of-the-blue (OOTB) packets. A control sock will be created 242ce95503SEric W. Biederman * for this socket at the initialization time. 252ce95503SEric W. Biederman */ 262ce95503SEric W. Biederman struct sock *ctl_sock; 272ce95503SEric W. Biederman 28965ae444SXin Long /* UDP tunneling listening sock. */ 29965ae444SXin Long struct sock *udp4_sock; 309d6ba260SXin Long struct sock *udp6_sock; 31965ae444SXin Long /* UDP tunneling listening port. */ 32965ae444SXin Long int udp_port; 33e8a3001cSXin Long /* UDP tunneling remote encap port. */ 34e8a3001cSXin Long int encap_port; 35965ae444SXin Long 364db67e80SEric W. Biederman /* This is the global local address list. 374db67e80SEric W. Biederman * We actively maintain this complete list of addresses on 384db67e80SEric W. Biederman * the system by catching address add/delete events. 394db67e80SEric W. Biederman * 404db67e80SEric W. Biederman * It is a list of sctp_sockaddr_entry. 414db67e80SEric W. Biederman */ 424db67e80SEric W. Biederman struct list_head local_addr_list; 434db67e80SEric W. Biederman struct list_head addr_waitq; 444db67e80SEric W. Biederman struct timer_list addr_wq_timer; 454db67e80SEric W. Biederman struct list_head auto_asconf_splist; 462d45a02dSMarcelo Ricardo Leitner /* Lock that protects both addr_waitq and auto_asconf_splist */ 474db67e80SEric W. Biederman spinlock_t addr_wq_lock; 484db67e80SEric W. Biederman 494db67e80SEric W. Biederman /* Lock that protects the local_addr_list writers */ 504db67e80SEric W. Biederman spinlock_t local_addr_lock; 51ebb7e95dSEric W. Biederman 52e1fc3b14SEric W. Biederman /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values 53e1fc3b14SEric W. Biederman * 54e1fc3b14SEric W. Biederman * The following protocol parameters are RECOMMENDED: 55e1fc3b14SEric W. Biederman * 56e1fc3b14SEric W. Biederman * RTO.Initial - 3 seconds 57e1fc3b14SEric W. Biederman * RTO.Min - 1 second 58e1fc3b14SEric W. Biederman * RTO.Max - 60 seconds 59e1fc3b14SEric W. Biederman * RTO.Alpha - 1/8 (3 when converted to right shifts.) 60e1fc3b14SEric W. Biederman * RTO.Beta - 1/4 (2 when converted to right shifts.) 61e1fc3b14SEric W. Biederman */ 62e1fc3b14SEric W. Biederman unsigned int rto_initial; 63e1fc3b14SEric W. Biederman unsigned int rto_min; 64e1fc3b14SEric W. Biederman unsigned int rto_max; 65e1fc3b14SEric W. Biederman 66e1fc3b14SEric W. Biederman /* Note: rto_alpha and rto_beta are really defined as inverse 67e1fc3b14SEric W. Biederman * powers of two to facilitate integer operations. 68e1fc3b14SEric W. Biederman */ 69e1fc3b14SEric W. Biederman int rto_alpha; 70e1fc3b14SEric W. Biederman int rto_beta; 71e1fc3b14SEric W. Biederman 72e1fc3b14SEric W. Biederman /* Max.Burst - 4 */ 73e1fc3b14SEric W. Biederman int max_burst; 74e1fc3b14SEric W. Biederman 75e1fc3b14SEric W. Biederman /* Whether Cookie Preservative is enabled(1) or not(0) */ 76e1fc3b14SEric W. Biederman int cookie_preserve_enable; 77e1fc3b14SEric W. Biederman 783c68198eSNeil Horman /* The namespace default hmac alg */ 793c68198eSNeil Horman char *sctp_hmac_alg; 803c68198eSNeil Horman 81e1fc3b14SEric W. Biederman /* Valid.Cookie.Life - 60 seconds */ 82e1fc3b14SEric W. Biederman unsigned int valid_cookie_life; 83e1fc3b14SEric W. Biederman 84e1fc3b14SEric W. Biederman /* Delayed SACK timeout 200ms default*/ 85e1fc3b14SEric W. Biederman unsigned int sack_timeout; 86e1fc3b14SEric W. Biederman 87e1fc3b14SEric W. Biederman /* HB.interval - 30 seconds */ 88e1fc3b14SEric W. Biederman unsigned int hb_interval; 89e1fc3b14SEric W. Biederman 90d1e462a7SXin Long /* The interval for PLPMTUD probe timer */ 91d1e462a7SXin Long unsigned int probe_interval; 92d1e462a7SXin Long 93e1fc3b14SEric W. Biederman /* Association.Max.Retrans - 10 attempts 94e1fc3b14SEric W. Biederman * Path.Max.Retrans - 5 attempts (per destination address) 95e1fc3b14SEric W. Biederman * Max.Init.Retransmits - 8 attempts 96e1fc3b14SEric W. Biederman */ 97e1fc3b14SEric W. Biederman int max_retrans_association; 98e1fc3b14SEric W. Biederman int max_retrans_path; 99e1fc3b14SEric W. Biederman int max_retrans_init; 100e1fc3b14SEric W. Biederman /* Potentially-Failed.Max.Retrans sysctl value 101e1fc3b14SEric W. Biederman * taken from: 102e1fc3b14SEric W. Biederman * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05 103e1fc3b14SEric W. Biederman */ 104e1fc3b14SEric W. Biederman int pf_retrans; 105e1fc3b14SEric W. Biederman 10634515e94SXin Long /* Primary.Switchover.Max.Retrans sysctl value 10734515e94SXin Long * taken from: 10834515e94SXin Long * https://tools.ietf.org/html/rfc7829 10934515e94SXin Long */ 11034515e94SXin Long int ps_retrans; 11134515e94SXin Long 112e1fc3b14SEric W. Biederman /* 113566178f8SZhu Yanjun * Disable Potentially-Failed feature, the feature is enabled by default 114566178f8SZhu Yanjun * pf_enable - 0 : disable pf 115566178f8SZhu Yanjun * - >0 : enable pf 116566178f8SZhu Yanjun */ 117566178f8SZhu Yanjun int pf_enable; 118566178f8SZhu Yanjun 119566178f8SZhu Yanjun /* 120aef587beSXin Long * Disable Potentially-Failed state exposure, ignored by default 121aef587beSXin Long * pf_expose - 0 : compatible with old applications (by default) 122aef587beSXin Long * - 1 : disable pf state exposure 123aef587beSXin Long * - 2 : enable pf state exposure 124aef587beSXin Long */ 125aef587beSXin Long int pf_expose; 126aef587beSXin Long 127aef587beSXin Long /* 128e1fc3b14SEric W. Biederman * Policy for preforming sctp/socket accounting 129e1fc3b14SEric W. Biederman * 0 - do socket level accounting, all assocs share sk_sndbuf 130e1fc3b14SEric W. Biederman * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes 131e1fc3b14SEric W. Biederman */ 132e1fc3b14SEric W. Biederman int sndbuf_policy; 133e1fc3b14SEric W. Biederman 134e1fc3b14SEric W. Biederman /* 135e1fc3b14SEric W. Biederman * Policy for preforming sctp/socket accounting 136e1fc3b14SEric W. Biederman * 0 - do socket level accounting, all assocs share sk_rcvbuf 137e1fc3b14SEric W. Biederman * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes 138e1fc3b14SEric W. Biederman */ 139e1fc3b14SEric W. Biederman int rcvbuf_policy; 140e1fc3b14SEric W. Biederman 141e1fc3b14SEric W. Biederman int default_auto_asconf; 142e1fc3b14SEric W. Biederman 143e1fc3b14SEric W. Biederman /* Flag to indicate if addip is enabled. */ 144e1fc3b14SEric W. Biederman int addip_enable; 145e1fc3b14SEric W. Biederman int addip_noauth; 146e1fc3b14SEric W. Biederman 147e1fc3b14SEric W. Biederman /* Flag to indicate if PR-SCTP is enabled. */ 148e1fc3b14SEric W. Biederman int prsctp_enable; 149e1fc3b14SEric W. Biederman 150c28445c3SXin Long /* Flag to indicate if PR-CONFIG is enabled. */ 151c28445c3SXin Long int reconf_enable; 152c28445c3SXin Long 153772a5869SXin Long /* Flag to indicate if SCTP-AUTH is enabled */ 154e1fc3b14SEric W. Biederman int auth_enable; 155e1fc3b14SEric W. Biederman 156772a5869SXin Long /* Flag to indicate if stream interleave is enabled */ 157772a5869SXin Long int intl_enable; 158772a5869SXin Long 1591b0b8114SXin Long /* Flag to indicate if ecn is enabled */ 1601b0b8114SXin Long int ecn_enable; 1611b0b8114SXin Long 162e1fc3b14SEric W. Biederman /* 163e1fc3b14SEric W. Biederman * Policy to control SCTP IPv4 address scoping 164e1fc3b14SEric W. Biederman * 0 - Disable IPv4 address scoping 165e1fc3b14SEric W. Biederman * 1 - Enable IPv4 address scoping 166e1fc3b14SEric W. Biederman * 2 - Selectively allow only IPv4 private addresses 167e1fc3b14SEric W. Biederman * 3 - Selectively allow only IPv4 link local address 168e1fc3b14SEric W. Biederman */ 169e1fc3b14SEric W. Biederman int scope_policy; 170e1fc3b14SEric W. Biederman 171e1fc3b14SEric W. Biederman /* Threshold for rwnd update SACKS. Receive buffer shifted this many 172e1fc3b14SEric W. Biederman * bits is an indicator of when to send and window update SACK. 173e1fc3b14SEric W. Biederman */ 174e1fc3b14SEric W. Biederman int rwnd_upd_shift; 175e1fc3b14SEric W. Biederman 176e1fc3b14SEric W. Biederman /* Threshold for autoclose timeout, in seconds. */ 177e1fc3b14SEric W. Biederman unsigned long max_autoclose; 178*0af03170SXin Long 179*0af03170SXin Long #ifdef CONFIG_NET_L3_MASTER_DEV 180*0af03170SXin Long int l3mdev_accept; 181*0af03170SXin Long #endif 1824db67e80SEric W. Biederman }; 1834db67e80SEric W. Biederman 1844db67e80SEric W. Biederman #endif /* __NETNS_SCTP_H__ */ 185