sctp.h 4.6 KB

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