1f8829a4aSRandall Stewart /*- 2*51369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 3*51369649SPedro F. Giffuni * 4830d754dSRandall Stewart * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 5807aad63SMichael Tuexen * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. 6807aad63SMichael Tuexen * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. 7f8829a4aSRandall Stewart * 8f8829a4aSRandall Stewart * Redistribution and use in source and binary forms, with or without 9f8829a4aSRandall Stewart * modification, are permitted provided that the following conditions are met: 10f8829a4aSRandall Stewart * 11f8829a4aSRandall Stewart * a) Redistributions of source code must retain the above copyright notice, 12f8829a4aSRandall Stewart * this list of conditions and the following disclaimer. 13f8829a4aSRandall Stewart * 14f8829a4aSRandall Stewart * b) Redistributions in binary form must reproduce the above copyright 15f8829a4aSRandall Stewart * notice, this list of conditions and the following disclaimer in 16f8829a4aSRandall Stewart * the documentation and/or other materials provided with the distribution. 17f8829a4aSRandall Stewart * 18f8829a4aSRandall Stewart * c) Neither the name of Cisco Systems, Inc. nor the names of its 19f8829a4aSRandall Stewart * contributors may be used to endorse or promote products derived 20f8829a4aSRandall Stewart * from this software without specific prior written permission. 21f8829a4aSRandall Stewart * 22f8829a4aSRandall Stewart * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23f8829a4aSRandall Stewart * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24f8829a4aSRandall Stewart * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25f8829a4aSRandall Stewart * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26f8829a4aSRandall Stewart * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27f8829a4aSRandall Stewart * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28f8829a4aSRandall Stewart * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29f8829a4aSRandall Stewart * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30f8829a4aSRandall Stewart * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31f8829a4aSRandall Stewart * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 32f8829a4aSRandall Stewart * THE POSSIBILITY OF SUCH DAMAGE. 33f8829a4aSRandall Stewart */ 34f8829a4aSRandall Stewart 35f8829a4aSRandall Stewart #include <sys/cdefs.h> 36f8829a4aSRandall Stewart __FBSDID("$FreeBSD$"); 37f8829a4aSRandall Stewart 38807aad63SMichael Tuexen #ifndef _NETINET_SCTP_CONSTANTS_H_ 39807aad63SMichael Tuexen #define _NETINET_SCTP_CONSTANTS_H_ 40f8829a4aSRandall Stewart 41fe96e285SMichael Tuexen 42c54a18d2SRandall Stewart /* IANA assigned port number for SCTP over UDP encapsulation */ 43fe96e285SMichael Tuexen #define SCTP_OVER_UDP_TUNNELING_PORT 9899 44fe96e285SMichael Tuexen 4542551e99SRandall Stewart /* Number of packets to get before sack sent by default */ 4642551e99SRandall Stewart #define SCTP_DEFAULT_SACK_FREQ 2 4742551e99SRandall Stewart 4842551e99SRandall Stewart /* Address limit - This variable is calculated 49bff64a4dSRandall Stewart * based on an 65535 byte max ip packet. We take out 100 bytes 5042551e99SRandall Stewart * for the cookie, 40 bytes for a v6 header and 32 5142551e99SRandall Stewart * bytes for the init structure. A second init structure 5242551e99SRandall Stewart * for the init-ack and then finally a third one for the 5342551e99SRandall Stewart * imbedded init. This yeilds 100+40+(3 * 32) = 236 bytes. 54bff64a4dSRandall Stewart * This leaves 65299 bytes for addresses. We throw out the 299 bytes. 55bff64a4dSRandall Stewart * Now whatever we send in the INIT() we need to allow to get back in the 5642551e99SRandall Stewart * INIT-ACK plus all the values from INIT and INIT-ACK 5742551e99SRandall Stewart * listed in the cookie. Plus we need some overhead for 5842551e99SRandall Stewart * maybe copied parameters in the COOKIE. If we 59bff64a4dSRandall Stewart * allow 1080 addresses, and each side has 1080 V6 addresses 60bff64a4dSRandall Stewart * that will be 21600 bytes. In the INIT-ACK we will 61bff64a4dSRandall Stewart * see the INIT-ACK 21600 + 43200 in the cookie. This leaves 62bff64a4dSRandall Stewart * about 500 bytes slack for misc things in the cookie. 6342551e99SRandall Stewart */ 64bff64a4dSRandall Stewart #define SCTP_ADDRESS_LIMIT 1080 6542551e99SRandall Stewart 662afb3e84SRandall Stewart /* We need at least 2k of space for us, inits 672afb3e84SRandall Stewart * larger than that lets abort. 682afb3e84SRandall Stewart */ 692afb3e84SRandall Stewart #define SCTP_LARGEST_INIT_ACCEPTED (65535 - 2048) 702afb3e84SRandall Stewart 71e629b9fcSMichael Tuexen /* Largest length of a chunk */ 72e629b9fcSMichael Tuexen #define SCTP_MAX_CHUNK_LENGTH 0xffff 739a8e3088SMichael Tuexen /* Largest length of an error cause */ 749a8e3088SMichael Tuexen #define SCTP_MAX_CAUSE_LENGTH 0xffff 7542551e99SRandall Stewart /* Number of addresses where we just skip the counting */ 7642551e99SRandall Stewart #define SCTP_COUNT_LIMIT 40 7742551e99SRandall Stewart 78d61a0ae0SRandall Stewart #define SCTP_ZERO_COPY_TICK_DELAY (((100 * hz) + 999) / 1000) 79ad21a364SRandall Stewart #define SCTP_ZERO_COPY_SENDQ_TICK_DELAY (((100 * hz) + 999) / 1000) 80d61a0ae0SRandall Stewart 8142551e99SRandall Stewart /* Number of ticks to delay before running 8242551e99SRandall Stewart * iterator on an address change. 8342551e99SRandall Stewart */ 8442551e99SRandall Stewart #define SCTP_ADDRESS_TICK_DELAY 2 85f8829a4aSRandall Stewart 86f8829a4aSRandall Stewart #define SCTP_VERSION_STRING "KAME-BSD 1.1" 87f8829a4aSRandall Stewart /* #define SCTP_AUDITING_ENABLED 1 used for debug/auditing */ 88f8829a4aSRandall Stewart #define SCTP_AUDIT_SIZE 256 89f8829a4aSRandall Stewart 9042551e99SRandall Stewart 9142551e99SRandall Stewart #define SCTP_KTRHEAD_NAME "sctp_iterator" 92dec7fa27SMichael Tuexen #define SCTP_KTHREAD_PAGES 0 9342551e99SRandall Stewart 94bfc46083SRandall Stewart #define SCTP_MCORE_NAME "sctp_core_worker" 95bfc46083SRandall Stewart 9642551e99SRandall Stewart 9742551e99SRandall Stewart /* If you support Multi-VRF how big to 9842551e99SRandall Stewart * make the initial array of VRF's to. 9942551e99SRandall Stewart */ 10042551e99SRandall Stewart #define SCTP_DEFAULT_VRF_SIZE 4 10142551e99SRandall Stewart 102b54d3a6cSRandall Stewart /* JRS - Values defined for the HTCP algorithm */ 103b54d3a6cSRandall Stewart #define ALPHA_BASE (1<<7) /* 1.0 with shift << 7 */ 104b54d3a6cSRandall Stewart #define BETA_MIN (1<<6) /* 0.5 with shift << 7 */ 105b54d3a6cSRandall Stewart #define BETA_MAX 102 /* 0.8 with shift << 7 */ 106b54d3a6cSRandall Stewart 107f8829a4aSRandall Stewart /* Places that CWND log can happen from */ 108f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_FR 1 109f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_RTX 2 110f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_BRST 3 111f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_SS 4 112f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_CA 5 113f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_SAT 6 114f8829a4aSRandall Stewart #define SCTP_BLOCK_LOG_INTO_BLK 7 115f8829a4aSRandall Stewart #define SCTP_BLOCK_LOG_OUTOF_BLK 8 116f8829a4aSRandall Stewart #define SCTP_BLOCK_LOG_CHECK 9 117f8829a4aSRandall Stewart #define SCTP_STR_LOG_FROM_INTO_STRD 10 118f8829a4aSRandall Stewart #define SCTP_STR_LOG_FROM_IMMED_DEL 11 119f8829a4aSRandall Stewart #define SCTP_STR_LOG_FROM_INSERT_HD 12 120f8829a4aSRandall Stewart #define SCTP_STR_LOG_FROM_INSERT_MD 13 121f8829a4aSRandall Stewart #define SCTP_STR_LOG_FROM_INSERT_TL 14 122f8829a4aSRandall Stewart #define SCTP_STR_LOG_FROM_MARK_TSN 15 123f8829a4aSRandall Stewart #define SCTP_STR_LOG_FROM_EXPRS_DEL 16 124f8829a4aSRandall Stewart #define SCTP_FR_LOG_BIGGEST_TSNS 17 125f8829a4aSRandall Stewart #define SCTP_FR_LOG_STRIKE_TEST 18 126f8829a4aSRandall Stewart #define SCTP_FR_LOG_STRIKE_CHUNK 19 127f8829a4aSRandall Stewart #define SCTP_FR_T3_TIMEOUT 20 128f8829a4aSRandall Stewart #define SCTP_MAP_PREPARE_SLIDE 21 129f8829a4aSRandall Stewart #define SCTP_MAP_SLIDE_FROM 22 130f8829a4aSRandall Stewart #define SCTP_MAP_SLIDE_RESULT 23 131f8829a4aSRandall Stewart #define SCTP_MAP_SLIDE_CLEARED 24 132f8829a4aSRandall Stewart #define SCTP_MAP_SLIDE_NONE 25 133f8829a4aSRandall Stewart #define SCTP_FR_T3_MARK_TIME 26 134f8829a4aSRandall Stewart #define SCTP_FR_T3_MARKED 27 135f8829a4aSRandall Stewart #define SCTP_FR_T3_STOPPED 28 136f8829a4aSRandall Stewart #define SCTP_FR_MARKED 30 137f8829a4aSRandall Stewart #define SCTP_CWND_LOG_NOADV_SS 31 138f8829a4aSRandall Stewart #define SCTP_CWND_LOG_NOADV_CA 32 139f8829a4aSRandall Stewart #define SCTP_MAX_BURST_APPLIED 33 140f8829a4aSRandall Stewart #define SCTP_MAX_IFP_APPLIED 34 141f8829a4aSRandall Stewart #define SCTP_MAX_BURST_ERROR_STOP 35 142f8829a4aSRandall Stewart #define SCTP_INCREASE_PEER_RWND 36 143f8829a4aSRandall Stewart #define SCTP_DECREASE_PEER_RWND 37 144f8829a4aSRandall Stewart #define SCTP_SET_PEER_RWND_VIA_SACK 38 145f8829a4aSRandall Stewart #define SCTP_LOG_MBCNT_INCREASE 39 146f8829a4aSRandall Stewart #define SCTP_LOG_MBCNT_DECREASE 40 147f8829a4aSRandall Stewart #define SCTP_LOG_MBCNT_CHKSET 41 148f8829a4aSRandall Stewart #define SCTP_LOG_NEW_SACK 42 149f8829a4aSRandall Stewart #define SCTP_LOG_TSN_ACKED 43 150f8829a4aSRandall Stewart #define SCTP_LOG_TSN_REVOKED 44 151f8829a4aSRandall Stewart #define SCTP_LOG_LOCK_TCB 45 152f8829a4aSRandall Stewart #define SCTP_LOG_LOCK_INP 46 153f8829a4aSRandall Stewart #define SCTP_LOG_LOCK_SOCK 47 154f8829a4aSRandall Stewart #define SCTP_LOG_LOCK_SOCKBUF_R 48 155f8829a4aSRandall Stewart #define SCTP_LOG_LOCK_SOCKBUF_S 49 156f8829a4aSRandall Stewart #define SCTP_LOG_LOCK_CREATE 50 157f8829a4aSRandall Stewart #define SCTP_LOG_INITIAL_RTT 51 158f8829a4aSRandall Stewart #define SCTP_LOG_RTTVAR 52 159f8829a4aSRandall Stewart #define SCTP_LOG_SBALLOC 53 160f8829a4aSRandall Stewart #define SCTP_LOG_SBFREE 54 161f8829a4aSRandall Stewart #define SCTP_LOG_SBRESULT 55 162f8829a4aSRandall Stewart #define SCTP_FR_DUPED 56 163f8829a4aSRandall Stewart #define SCTP_FR_MARKED_EARLY 57 164f8829a4aSRandall Stewart #define SCTP_FR_CWND_REPORT 58 165f8829a4aSRandall Stewart #define SCTP_FR_CWND_REPORT_START 59 166f8829a4aSRandall Stewart #define SCTP_FR_CWND_REPORT_STOP 60 167f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_SEND 61 168f8829a4aSRandall Stewart #define SCTP_CWND_INITIALIZATION 62 169f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_T3 63 170f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_SACK 64 171f8829a4aSRandall Stewart #define SCTP_CWND_LOG_NO_CUMACK 65 172f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FROM_RESEND 66 173f8829a4aSRandall Stewart #define SCTP_FR_LOG_CHECK_STRIKE 67 174f8829a4aSRandall Stewart #define SCTP_SEND_NOW_COMPLETES 68 175f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FILL_OUTQ_CALLED 69 176f8829a4aSRandall Stewart #define SCTP_CWND_LOG_FILL_OUTQ_FILLS 70 177f8829a4aSRandall Stewart #define SCTP_LOG_FREE_SENT 71 178f8829a4aSRandall Stewart #define SCTP_NAGLE_APPLIED 72 179f8829a4aSRandall Stewart #define SCTP_NAGLE_SKIPPED 73 180f8829a4aSRandall Stewart #define SCTP_WAKESND_FROM_SACK 74 181f8829a4aSRandall Stewart #define SCTP_WAKESND_FROM_FWDTSN 75 182f8829a4aSRandall Stewart #define SCTP_NOWAKE_FROM_SACK 76 183f8829a4aSRandall Stewart #define SCTP_CWNDLOG_PRESEND 77 184f8829a4aSRandall Stewart #define SCTP_CWNDLOG_ENDSEND 78 185f8829a4aSRandall Stewart #define SCTP_AT_END_OF_SACK 79 186f8829a4aSRandall Stewart #define SCTP_REASON_FOR_SC 80 187f8829a4aSRandall Stewart #define SCTP_BLOCK_LOG_INTO_BLKA 81 188f8829a4aSRandall Stewart #define SCTP_ENTER_USER_RECV 82 189f8829a4aSRandall Stewart #define SCTP_USER_RECV_SACKS 83 190f8829a4aSRandall Stewart #define SCTP_SORECV_BLOCKSA 84 191f8829a4aSRandall Stewart #define SCTP_SORECV_BLOCKSB 85 192f8829a4aSRandall Stewart #define SCTP_SORECV_DONE 86 193f8829a4aSRandall Stewart #define SCTP_SACK_RWND_UPDATE 87 194f8829a4aSRandall Stewart #define SCTP_SORECV_ENTER 88 195f8829a4aSRandall Stewart #define SCTP_SORECV_ENTERPL 89 196f8829a4aSRandall Stewart #define SCTP_MBUF_INPUT 90 197f8829a4aSRandall Stewart #define SCTP_MBUF_IALLOC 91 198f8829a4aSRandall Stewart #define SCTP_MBUF_IFREE 92 199f8829a4aSRandall Stewart #define SCTP_MBUF_ICOPY 93 2002a3eb019SRandall Stewart #define SCTP_MBUF_SPLIT 94 2012a3eb019SRandall Stewart #define SCTP_SORCV_FREECTL 95 2022a3eb019SRandall Stewart #define SCTP_SORCV_DOESCPY 96 2032a3eb019SRandall Stewart #define SCTP_SORCV_DOESLCK 97 2042a3eb019SRandall Stewart #define SCTP_SORCV_DOESADJ 98 2052a3eb019SRandall Stewart #define SCTP_SORCV_BOTWHILE 99 2062a3eb019SRandall Stewart #define SCTP_SORCV_PASSBF 100 2072a3eb019SRandall Stewart #define SCTP_SORCV_ADJD 101 2082a3eb019SRandall Stewart #define SCTP_UNKNOWN_MAX 102 2092a3eb019SRandall Stewart #define SCTP_RANDY_STUFF 103 2102a3eb019SRandall Stewart #define SCTP_RANDY_STUFF1 104 2112a3eb019SRandall Stewart #define SCTP_STRMOUT_LOG_ASSIGN 105 2122a3eb019SRandall Stewart #define SCTP_STRMOUT_LOG_SEND 106 2132a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_DOWN_CA 107 2142a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_UP 108 2152a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_DOWN_GAP 109 2162a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_DOWN_RSND 110 2172a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_UP_RSND 111 2182a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_DOWN_RSND_TO 112 2192a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_DOWN_WP 113 2202a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_UP_REVOKE 114 2212a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_DOWN_PDRP 115 2222a3eb019SRandall Stewart #define SCTP_FLIGHT_LOG_DOWN_PMTU 116 2232a3eb019SRandall Stewart #define SCTP_SACK_LOG_NORMAL 117 2242a3eb019SRandall Stewart #define SCTP_SACK_LOG_EXPRESS 118 2252a3eb019SRandall Stewart #define SCTP_MAP_TSN_ENTERS 119 2262a3eb019SRandall Stewart #define SCTP_THRESHOLD_CLEAR 120 2272a3eb019SRandall Stewart #define SCTP_THRESHOLD_INCR 121 228dfb11ef8SRandall Stewart #define SCTP_FLIGHT_LOG_DWN_WP_FWD 122 2290c0982b8SRandall Stewart #define SCTP_FWD_TSN_CHECK 123 2300c0982b8SRandall Stewart #define SCTP_LOG_MAX_TYPES 124 231f8829a4aSRandall Stewart /* 23280fefe0aSRandall Stewart * To turn on various logging, you must first enable 'options KTR' and 23380fefe0aSRandall Stewart * you might want to bump the entires 'options KTR_ENTRIES=80000'. 23480fefe0aSRandall Stewart * To get something to log you define one of the logging defines. 23580fefe0aSRandall Stewart * (see LINT). 236f8829a4aSRandall Stewart * 23780fefe0aSRandall Stewart * This gets the compile in place, but you still need to turn the 23880fefe0aSRandall Stewart * logging flag on too in the sysctl (see in sctp.h). 239f8829a4aSRandall Stewart */ 240c4739e2fSRandall Stewart 241f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_UNKNOWN 0 242f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_CWND 1 243f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_BLOCK 2 244f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_STRM 3 245f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_FR 4 246f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_MAP 5 247f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_MAXBURST 6 248f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_RWND 7 249f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_MBCNT 8 250f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_SACK 9 251f8829a4aSRandall Stewart #define SCTP_LOG_LOCK_EVENT 10 252f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_RTT 11 253f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_SB 12 254f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_NAGLE 13 255f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_WAKE 14 256f8829a4aSRandall Stewart #define SCTP_LOG_MISC_EVENT 15 257f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_CLOSE 16 258f8829a4aSRandall Stewart #define SCTP_LOG_EVENT_MBUF 17 25980fefe0aSRandall Stewart #define SCTP_LOG_CHUNK_PROC 18 26080fefe0aSRandall Stewart #define SCTP_LOG_ERROR_RET 19 261f8829a4aSRandall Stewart 26280fefe0aSRandall Stewart #define SCTP_LOG_MAX_EVENT 20 263f8829a4aSRandall Stewart 264f8829a4aSRandall Stewart #define SCTP_LOCK_UNKNOWN 2 265f8829a4aSRandall Stewart 266f8829a4aSRandall Stewart 267f8829a4aSRandall Stewart /* number of associations by default for zone allocation */ 268f8829a4aSRandall Stewart #define SCTP_MAX_NUM_OF_ASOC 40000 269f8829a4aSRandall Stewart /* how many addresses per assoc remote and local */ 270f8829a4aSRandall Stewart #define SCTP_SCALE_FOR_ADDR 2 271f8829a4aSRandall Stewart 272c54a18d2SRandall Stewart /* default MULTIPLE_ASCONF mode enable(1)/disable(0) value (sysctl) */ 273c54a18d2SRandall Stewart #define SCTP_DEFAULT_MULTIPLE_ASCONFS 0 274c54a18d2SRandall Stewart 275f8829a4aSRandall Stewart /* 276cd0a4ff6SPedro F. Giffuni * Threshold for rwnd updates, we have to read (sb_hiwat >> 277f8829a4aSRandall Stewart * SCTP_RWND_HIWAT_SHIFT) before we will look to see if we need to send a 278f8829a4aSRandall Stewart * window update sack. When we look, we compare the last rwnd we sent vs the 279f8829a4aSRandall Stewart * current rwnd. It too must be greater than this value. Using 3 divdes the 280f8829a4aSRandall Stewart * hiwat by 8, so for 200k rwnd we need to read 24k. For a 64k rwnd we need 281f8829a4aSRandall Stewart * to read 8k. This seems about right.. I hope :-D.. we do set a 282f8829a4aSRandall Stewart * min of a MTU on it so if the rwnd is real small we will insist 283f8829a4aSRandall Stewart * on a full MTU of 1500 bytes. 284f8829a4aSRandall Stewart */ 285f8829a4aSRandall Stewart #define SCTP_RWND_HIWAT_SHIFT 3 286f8829a4aSRandall Stewart 287f8829a4aSRandall Stewart /* How much of the rwnd must the 288f8829a4aSRandall Stewart * message be taking up to start partial delivery. 289f8829a4aSRandall Stewart * We calculate this by shifing the hi_water (recv_win) 290f8829a4aSRandall Stewart * left the following .. set to 1, when a message holds 291f8829a4aSRandall Stewart * 1/2 the rwnd. If we set it to 2 when a message holds 292f8829a4aSRandall Stewart * 1/4 the rwnd...etc.. 293f8829a4aSRandall Stewart */ 294f8829a4aSRandall Stewart 295f8829a4aSRandall Stewart #define SCTP_PARTIAL_DELIVERY_SHIFT 1 296f8829a4aSRandall Stewart 297f8829a4aSRandall Stewart /* 298f8829a4aSRandall Stewart * default HMAC for cookies, etc... use one of the AUTH HMAC id's 299f8829a4aSRandall Stewart * SCTP_HMAC is the HMAC_ID to use 300f8829a4aSRandall Stewart * SCTP_SIGNATURE_SIZE is the digest length 301f8829a4aSRandall Stewart */ 302f8829a4aSRandall Stewart #define SCTP_HMAC SCTP_AUTH_HMAC_ID_SHA1 303f8829a4aSRandall Stewart #define SCTP_SIGNATURE_SIZE SCTP_AUTH_DIGEST_LEN_SHA1 304f8829a4aSRandall Stewart #define SCTP_SIGNATURE_ALOC_SIZE SCTP_SIGNATURE_SIZE 305f8829a4aSRandall Stewart 306f8829a4aSRandall Stewart /* 307f8829a4aSRandall Stewart * the SCTP protocol signature this includes the version number encoded in 308f8829a4aSRandall Stewart * the last 4 bits of the signature. 309f8829a4aSRandall Stewart */ 310f8829a4aSRandall Stewart #define PROTO_SIGNATURE_A 0x30000000 311f8829a4aSRandall Stewart #define SCTP_VERSION_NUMBER 0x3 312f8829a4aSRandall Stewart 313f8829a4aSRandall Stewart #define MAX_TSN 0xffffffff 314f8829a4aSRandall Stewart 315f8829a4aSRandall Stewart /* how many executions every N tick's */ 316f8829a4aSRandall Stewart #define SCTP_ITERATOR_MAX_AT_ONCE 20 317f8829a4aSRandall Stewart 318f8829a4aSRandall Stewart /* number of clock ticks between iterator executions */ 319f8829a4aSRandall Stewart #define SCTP_ITERATOR_TICKS 1 320f8829a4aSRandall Stewart 321f8829a4aSRandall Stewart /* 322f8829a4aSRandall Stewart * option: If you comment out the following you will receive the old behavior 323f8829a4aSRandall Stewart * of obeying cwnd for the fast retransmit algorithm. With this defined a FR 324f8829a4aSRandall Stewart * happens right away with-out waiting for the flightsize to drop below the 325f8829a4aSRandall Stewart * cwnd value (which is reduced by the FR to 1/2 the inflight packets). 326f8829a4aSRandall Stewart */ 327f8829a4aSRandall Stewart #define SCTP_IGNORE_CWND_ON_FR 1 328f8829a4aSRandall Stewart 329f8829a4aSRandall Stewart /* 330f8829a4aSRandall Stewart * Adds implementors guide behavior to only use newest highest update in SACK 331f8829a4aSRandall Stewart * gap ack's to figure out if you need to stroke a chunk for FR. 332f8829a4aSRandall Stewart */ 333f8829a4aSRandall Stewart #define SCTP_NO_FR_UNLESS_SEGMENT_SMALLER 1 334f8829a4aSRandall Stewart 335f8cdf876SMichael Tuexen /* default max I can burst out after a fast retransmit, 0 disables it */ 336635b6ff7SMichael Tuexen #define SCTP_DEF_MAX_BURST 4 337899288aeSRandall Stewart #define SCTP_DEF_HBMAX_BURST 4 338899288aeSRandall Stewart #define SCTP_DEF_FRMAX_BURST 4 339899288aeSRandall Stewart 340899288aeSRandall Stewart /* RTO calculation flag to say if it 341899288aeSRandall Stewart * is safe to determine local lan or not. 342899288aeSRandall Stewart */ 343f79aab18SRandall Stewart #define SCTP_RTT_FROM_NON_DATA 0 344f79aab18SRandall Stewart #define SCTP_RTT_FROM_DATA 1 345899288aeSRandall Stewart 3468e1b295fSMichael Tuexen #define PR_SCTP_UNORDERED_FLAG 0x0001 347899288aeSRandall Stewart 348f8829a4aSRandall Stewart /* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */ 349f8829a4aSRandall Stewart #define SCTP_FIRST_MBUF_RESV 68 350f8829a4aSRandall Stewart /* Packet transmit states in the sent field */ 351f8829a4aSRandall Stewart #define SCTP_DATAGRAM_UNSENT 0 352f8829a4aSRandall Stewart #define SCTP_DATAGRAM_SENT 1 353f8829a4aSRandall Stewart #define SCTP_DATAGRAM_RESEND1 2 /* not used (in code, but may 354f8829a4aSRandall Stewart * hit this value) */ 355f8829a4aSRandall Stewart #define SCTP_DATAGRAM_RESEND2 3 /* not used (in code, but may 356f8829a4aSRandall Stewart * hit this value) */ 357f8829a4aSRandall Stewart #define SCTP_DATAGRAM_RESEND 4 358f8829a4aSRandall Stewart #define SCTP_DATAGRAM_ACKED 10010 359f8829a4aSRandall Stewart #define SCTP_DATAGRAM_MARKED 20010 360f8829a4aSRandall Stewart #define SCTP_FORWARD_TSN_SKIP 30010 361325c8c46SMichael Tuexen #define SCTP_DATAGRAM_NR_ACKED 40010 362f8829a4aSRandall Stewart 363f8829a4aSRandall Stewart /* chunk output send from locations */ 364f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_USR_SEND 0 365f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_T3 1 366f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_INPUT_ERROR 2 367f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_CONTROL_PROC 3 368f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_SACK_TMR 4 369f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_SHUT_TMR 5 370f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_HB_TMR 6 371f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_SHUT_ACK_TMR 7 372f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_ASCONF_TMR 8 373f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_STRRST_TMR 9 374f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_AUTOCLOSE_TMR 10 375f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_EARLY_FR_TMR 11 376f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_STRRST_REQ 12 377f8829a4aSRandall Stewart #define SCTP_OUTPUT_FROM_USR_RCVD 13 3787f34832bSRandall Stewart #define SCTP_OUTPUT_FROM_COOKIE_ACK 14 37942551e99SRandall Stewart #define SCTP_OUTPUT_FROM_DRAIN 15 3802afb3e84SRandall Stewart #define SCTP_OUTPUT_FROM_CLOSING 16 381972478a4SMichael Tuexen #define SCTP_OUTPUT_FROM_SOCKOPT 17 382972478a4SMichael Tuexen 383f8829a4aSRandall Stewart /* SCTP chunk types are moved sctp.h for application (NAT, FW) use */ 384f8829a4aSRandall Stewart 385f8829a4aSRandall Stewart /* align to 32-bit sizes */ 386f8829a4aSRandall Stewart #define SCTP_SIZE32(x) ((((x) + 3) >> 2) << 2) 387f8829a4aSRandall Stewart 38844249214SRandall Stewart #define IS_SCTP_CONTROL(a) (((a)->chunk_type != SCTP_DATA) && ((a)->chunk_type != SCTP_IDATA)) 38944249214SRandall Stewart #define IS_SCTP_DATA(a) (((a)->chunk_type == SCTP_DATA) || ((a)->chunk_type == SCTP_IDATA)) 390f8829a4aSRandall Stewart 391f8829a4aSRandall Stewart 392f8829a4aSRandall Stewart /* SCTP parameter types */ 393f8829a4aSRandall Stewart /*************0x0000 series*************/ 394f8829a4aSRandall Stewart #define SCTP_HEARTBEAT_INFO 0x0001 395f8829a4aSRandall Stewart #define SCTP_IPV4_ADDRESS 0x0005 396f8829a4aSRandall Stewart #define SCTP_IPV6_ADDRESS 0x0006 397f8829a4aSRandall Stewart #define SCTP_STATE_COOKIE 0x0007 398f8829a4aSRandall Stewart #define SCTP_UNRECOG_PARAM 0x0008 399f8829a4aSRandall Stewart #define SCTP_COOKIE_PRESERVE 0x0009 400f8829a4aSRandall Stewart #define SCTP_HOSTNAME_ADDRESS 0x000b 401f8829a4aSRandall Stewart #define SCTP_SUPPORTED_ADDRTYPE 0x000c 402f8829a4aSRandall Stewart 403ea44232bSRandall Stewart /* draft-ietf-stewart-tsvwg-strreset-xxx */ 404f8829a4aSRandall Stewart #define SCTP_STR_RESET_OUT_REQUEST 0x000d 405f8829a4aSRandall Stewart #define SCTP_STR_RESET_IN_REQUEST 0x000e 406f8829a4aSRandall Stewart #define SCTP_STR_RESET_TSN_REQUEST 0x000f 407f8829a4aSRandall Stewart #define SCTP_STR_RESET_RESPONSE 0x0010 408c4e848b7SRandall Stewart #define SCTP_STR_RESET_ADD_OUT_STREAMS 0x0011 409c4e848b7SRandall Stewart #define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 410f8829a4aSRandall Stewart 411f8829a4aSRandall Stewart #define SCTP_MAX_RESET_PARAMS 2 412f8829a4aSRandall Stewart #define SCTP_STREAM_RESET_TSN_DELTA 0x1000 413f8829a4aSRandall Stewart 414f8829a4aSRandall Stewart /*************0x4000 series*************/ 415f8829a4aSRandall Stewart 416f8829a4aSRandall Stewart /*************0x8000 series*************/ 417f8829a4aSRandall Stewart #define SCTP_ECN_CAPABLE 0x8000 418493d8e5aSRandall Stewart 419f8829a4aSRandall Stewart /* draft-ietf-tsvwg-auth-xxx */ 420f8829a4aSRandall Stewart #define SCTP_RANDOM 0x8002 421f8829a4aSRandall Stewart #define SCTP_CHUNK_LIST 0x8003 422f8829a4aSRandall Stewart #define SCTP_HMAC_LIST 0x8004 423f8829a4aSRandall Stewart /* 424f8829a4aSRandall Stewart * draft-ietf-tsvwg-addip-sctp-xx param=0x8008 len=0xNNNN Byte | Byte | Byte 425f8829a4aSRandall Stewart * | Byte Byte | Byte ... 426f8829a4aSRandall Stewart * 427f8829a4aSRandall Stewart * Where each byte is a chunk type extension supported. For example, to support 428f8829a4aSRandall Stewart * all chunks one would have (in hex): 429f8829a4aSRandall Stewart * 430f8829a4aSRandall Stewart * 80 01 00 09 C0 C1 80 81 82 00 00 00 431f8829a4aSRandall Stewart * 432f8829a4aSRandall Stewart * Has the parameter. C0 = PR-SCTP (RFC3758) C1, 80 = ASCONF (addip draft) 81 433f8829a4aSRandall Stewart * = Packet Drop 82 = Stream Reset 83 = Authentication 434f8829a4aSRandall Stewart */ 435f8829a4aSRandall Stewart #define SCTP_SUPPORTED_CHUNK_EXT 0x8008 436f8829a4aSRandall Stewart 437f8829a4aSRandall Stewart /*************0xC000 series*************/ 438f8829a4aSRandall Stewart #define SCTP_PRSCTP_SUPPORTED 0xc000 439f8829a4aSRandall Stewart /* draft-ietf-tsvwg-addip-sctp */ 440f8829a4aSRandall Stewart #define SCTP_ADD_IP_ADDRESS 0xc001 441f8829a4aSRandall Stewart #define SCTP_DEL_IP_ADDRESS 0xc002 442f8829a4aSRandall Stewart #define SCTP_ERROR_CAUSE_IND 0xc003 443f8829a4aSRandall Stewart #define SCTP_SET_PRIM_ADDR 0xc004 444f8829a4aSRandall Stewart #define SCTP_SUCCESS_REPORT 0xc005 445f8829a4aSRandall Stewart #define SCTP_ULP_ADAPTATION 0xc006 446830d754dSRandall Stewart /* behave-nat-draft */ 447830d754dSRandall Stewart #define SCTP_HAS_NAT_SUPPORT 0xc007 448830d754dSRandall Stewart #define SCTP_NAT_VTAGS 0xc008 449f8829a4aSRandall Stewart 450f8829a4aSRandall Stewart /* bits for TOS field */ 451f8829a4aSRandall Stewart #define SCTP_ECT0_BIT 0x02 452f8829a4aSRandall Stewart #define SCTP_ECT1_BIT 0x01 453f8829a4aSRandall Stewart #define SCTP_CE_BITS 0x03 454f8829a4aSRandall Stewart 455f8829a4aSRandall Stewart /* below turns off above */ 456f8829a4aSRandall Stewart #define SCTP_FLEXIBLE_ADDRESS 0x20 457f8829a4aSRandall Stewart #define SCTP_NO_HEARTBEAT 0x40 458f8829a4aSRandall Stewart 459f8829a4aSRandall Stewart /* mask to get sticky */ 460f8829a4aSRandall Stewart #define SCTP_STICKY_OPTIONS_MASK 0x0c 461f8829a4aSRandall Stewart 462f8829a4aSRandall Stewart 463f8829a4aSRandall Stewart /* 464e92c2a8dSMichael Tuexen * SCTP states for internal state machine 465f8829a4aSRandall Stewart */ 466f8829a4aSRandall Stewart #define SCTP_STATE_EMPTY 0x0000 467f8829a4aSRandall Stewart #define SCTP_STATE_INUSE 0x0001 468f8829a4aSRandall Stewart #define SCTP_STATE_COOKIE_WAIT 0x0002 469f8829a4aSRandall Stewart #define SCTP_STATE_COOKIE_ECHOED 0x0004 470f8829a4aSRandall Stewart #define SCTP_STATE_OPEN 0x0008 471f8829a4aSRandall Stewart #define SCTP_STATE_SHUTDOWN_SENT 0x0010 472f8829a4aSRandall Stewart #define SCTP_STATE_SHUTDOWN_RECEIVED 0x0020 473f8829a4aSRandall Stewart #define SCTP_STATE_SHUTDOWN_ACK_SENT 0x0040 474f8829a4aSRandall Stewart #define SCTP_STATE_SHUTDOWN_PENDING 0x0080 475f8829a4aSRandall Stewart #define SCTP_STATE_CLOSED_SOCKET 0x0100 476f8829a4aSRandall Stewart #define SCTP_STATE_ABOUT_TO_BE_FREED 0x0200 477f8829a4aSRandall Stewart #define SCTP_STATE_PARTIAL_MSG_LEFT 0x0400 47863981c2bSRandall Stewart #define SCTP_STATE_WAS_ABORTED 0x0800 47988a7eb29SRandall Stewart #define SCTP_STATE_IN_ACCEPT_QUEUE 0x1000 480f8829a4aSRandall Stewart #define SCTP_STATE_MASK 0x007f 481f8829a4aSRandall Stewart 482f8829a4aSRandall Stewart #define SCTP_GET_STATE(asoc) ((asoc)->state & SCTP_STATE_MASK) 483c4739e2fSRandall Stewart #define SCTP_SET_STATE(asoc, newstate) ((asoc)->state = ((asoc)->state & ~SCTP_STATE_MASK) | newstate) 484b201f536SRandall Stewart #define SCTP_CLEAR_SUBSTATE(asoc, substate) ((asoc)->state &= ~substate) 485b201f536SRandall Stewart #define SCTP_ADD_SUBSTATE(asoc, substate) ((asoc)->state |= substate) 486f8829a4aSRandall Stewart 487f8829a4aSRandall Stewart /* SCTP reachability state for each address */ 488f8829a4aSRandall Stewart #define SCTP_ADDR_REACHABLE 0x001 48980c79bbeSMichael Tuexen #define SCTP_ADDR_NO_PMTUD 0x002 490f8829a4aSRandall Stewart #define SCTP_ADDR_NOHB 0x004 491f8829a4aSRandall Stewart #define SCTP_ADDR_BEING_DELETED 0x008 492f8829a4aSRandall Stewart #define SCTP_ADDR_NOT_IN_ASSOC 0x010 493f8829a4aSRandall Stewart #define SCTP_ADDR_OUT_OF_SCOPE 0x080 494f8829a4aSRandall Stewart #define SCTP_ADDR_UNCONFIRMED 0x200 49542551e99SRandall Stewart #define SCTP_ADDR_REQ_PRIMARY 0x400 496b54d3a6cSRandall Stewart /* JRS 5/13/07 - Added potentially failed state for CMT PF */ 497b54d3a6cSRandall Stewart #define SCTP_ADDR_PF 0x800 498f8829a4aSRandall Stewart 499f8829a4aSRandall Stewart /* bound address types (e.g. valid address types to allow) */ 500f8829a4aSRandall Stewart #define SCTP_BOUND_V6 0x01 501f8829a4aSRandall Stewart #define SCTP_BOUND_V4 0x02 502f8829a4aSRandall Stewart 503f8829a4aSRandall Stewart /* 504f8829a4aSRandall Stewart * what is the default number of mbufs in a chain I allow before switching to 505f8829a4aSRandall Stewart * a cluster 506f8829a4aSRandall Stewart */ 507f8829a4aSRandall Stewart #define SCTP_DEFAULT_MBUFS_IN_CHAIN 5 508f8829a4aSRandall Stewart 5093c503c28SRandall Stewart /* How long a cookie lives in milli-seconds */ 5103c503c28SRandall Stewart #define SCTP_DEFAULT_COOKIE_LIFE 60000 511f8829a4aSRandall Stewart 512f8829a4aSRandall Stewart /* Maximum the mapping array will grow to (TSN mapping array) */ 513f8829a4aSRandall Stewart #define SCTP_MAPPING_ARRAY 512 514f8829a4aSRandall Stewart 515cd0a4ff6SPedro F. Giffuni /* size of the initial malloc on the mapping array */ 516f8829a4aSRandall Stewart #define SCTP_INITIAL_MAPPING_ARRAY 16 517f8829a4aSRandall Stewart /* how much we grow the mapping array each call */ 518f8829a4aSRandall Stewart #define SCTP_MAPPING_ARRAY_INCR 32 519b5c16493SMichael Tuexen 520f8829a4aSRandall Stewart /* 521f8829a4aSRandall Stewart * Here we define the timer types used by the implementation as arguments in 522f8829a4aSRandall Stewart * the set/get timer type calls. 523f8829a4aSRandall Stewart */ 524f8829a4aSRandall Stewart #define SCTP_TIMER_INIT 0 525f8829a4aSRandall Stewart #define SCTP_TIMER_RECV 1 526f8829a4aSRandall Stewart #define SCTP_TIMER_SEND 2 527f8829a4aSRandall Stewart #define SCTP_TIMER_HEARTBEAT 3 528f8829a4aSRandall Stewart #define SCTP_TIMER_PMTU 4 529f8829a4aSRandall Stewart #define SCTP_TIMER_MAXSHUTDOWN 5 530f8829a4aSRandall Stewart #define SCTP_TIMER_SIGNATURE 6 531f8829a4aSRandall Stewart /* 532f8829a4aSRandall Stewart * number of timer types in the base SCTP structure used in the set/get and 533f8829a4aSRandall Stewart * has the base default. 534f8829a4aSRandall Stewart */ 535f8829a4aSRandall Stewart #define SCTP_NUM_TMRS 7 536f8829a4aSRandall Stewart 537f8829a4aSRandall Stewart /* timer types */ 538f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_NONE 0 539f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_SEND 1 540f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_INIT 2 541f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_RECV 3 542f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_SHUTDOWN 4 543f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_HEARTBEAT 5 544f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_COOKIE 6 545f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_NEWCOOKIE 7 546f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_PATHMTURAISE 8 547f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_SHUTDOWNACK 9 548f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_ASCONF 10 549f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_SHUTDOWNGUARD 11 550f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_AUTOCLOSE 12 551f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_EVENTWAKE 13 552f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_STRRESET 14 553f8829a4aSRandall Stewart #define SCTP_TIMER_TYPE_INPKILL 15 554ca85e948SMichael Tuexen #define SCTP_TIMER_TYPE_ASOCKILL 16 555ca85e948SMichael Tuexen #define SCTP_TIMER_TYPE_ADDR_WQ 17 556fe40f49bSMichael Tuexen #define SCTP_TIMER_TYPE_PRIM_DELETED 18 557f8829a4aSRandall Stewart /* add new timers here - and increment LAST */ 558fe40f49bSMichael Tuexen #define SCTP_TIMER_TYPE_LAST 19 559f8829a4aSRandall Stewart 560f8829a4aSRandall Stewart #define SCTP_IS_TIMER_TYPE_VALID(t) (((t) > SCTP_TIMER_TYPE_NONE) && \ 561f8829a4aSRandall Stewart ((t) < SCTP_TIMER_TYPE_LAST)) 562f8829a4aSRandall Stewart 563f8829a4aSRandall Stewart 564f8829a4aSRandall Stewart 565f8829a4aSRandall Stewart /* max number of TSN's dup'd that I will hold */ 566f8829a4aSRandall Stewart #define SCTP_MAX_DUP_TSNS 20 567f8829a4aSRandall Stewart 568f8829a4aSRandall Stewart /* 569f8829a4aSRandall Stewart * Here we define the types used when setting the retry amounts. 570f8829a4aSRandall Stewart */ 571f8829a4aSRandall Stewart /* How many drop re-attempts we make on INIT/COOKIE-ECHO */ 572f8829a4aSRandall Stewart #define SCTP_RETRY_DROPPED_THRESH 4 573f8829a4aSRandall Stewart 574f8829a4aSRandall Stewart /* 575f8829a4aSRandall Stewart * Maxmium number of chunks a single association can have on it. Note that 576f8829a4aSRandall Stewart * this is a squishy number since the count can run over this if the user 577f8829a4aSRandall Stewart * sends a large message down .. the fragmented chunks don't count until 578f8829a4aSRandall Stewart * AFTER the message is on queue.. it would be the next send that blocks 579f8829a4aSRandall Stewart * things. This number will get tuned up at boot in the sctp_init and use the 580f8829a4aSRandall Stewart * number of clusters as a base. This way high bandwidth environments will 581f8829a4aSRandall Stewart * not get impacted by the lower bandwidth sending a bunch of 1 byte chunks 582f8829a4aSRandall Stewart */ 583f8829a4aSRandall Stewart #define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512 584f8829a4aSRandall Stewart 585851b7298SRandall Stewart 58642551e99SRandall Stewart /* The conversion from time to ticks and vice versa is done by rounding 58742551e99SRandall Stewart * upwards. This way we can test in the code the time to be positive and 58842551e99SRandall Stewart * know that this corresponds to a positive number of ticks. 58942551e99SRandall Stewart */ 59042551e99SRandall Stewart #define MSEC_TO_TICKS(x) ((hz == 1000) ? x : ((((x) * hz) + 999) / 1000)) 59142551e99SRandall Stewart #define TICKS_TO_MSEC(x) ((hz == 1000) ? x : ((((x) * 1000) + (hz - 1)) / hz)) 592f8829a4aSRandall Stewart 593f8829a4aSRandall Stewart #define SEC_TO_TICKS(x) ((x) * hz) 59442551e99SRandall Stewart #define TICKS_TO_SEC(x) (((x) + (hz - 1)) / hz) 595f8829a4aSRandall Stewart 596f8829a4aSRandall Stewart /* 597f8829a4aSRandall Stewart * Basically the minimum amount of time before I do a early FR. Making this 598f8829a4aSRandall Stewart * value to low will cause duplicate retransmissions. 599f8829a4aSRandall Stewart */ 600f8829a4aSRandall Stewart #define SCTP_MINFR_MSEC_TIMER 250 601f8829a4aSRandall Stewart /* The floor this value is allowed to fall to when starting a timer. */ 602f8829a4aSRandall Stewart #define SCTP_MINFR_MSEC_FLOOR 20 603f8829a4aSRandall Stewart 604f8829a4aSRandall Stewart /* init timer def = 1 sec */ 605f8829a4aSRandall Stewart #define SCTP_INIT_SEC 1 606f8829a4aSRandall Stewart 607f8829a4aSRandall Stewart /* send timer def = 1 seconds */ 608f8829a4aSRandall Stewart #define SCTP_SEND_SEC 1 609f8829a4aSRandall Stewart 610f8829a4aSRandall Stewart /* recv timer def = 200ms */ 611f8829a4aSRandall Stewart #define SCTP_RECV_MSEC 200 612f8829a4aSRandall Stewart 613f8829a4aSRandall Stewart /* 30 seconds + RTO (in ms) */ 614f8829a4aSRandall Stewart #define SCTP_HB_DEFAULT_MSEC 30000 615f8829a4aSRandall Stewart 616f8829a4aSRandall Stewart /* 617f8829a4aSRandall Stewart * This is how long a secret lives, NOT how long a cookie lives how many 618f8829a4aSRandall Stewart * ticks the current secret will live. 619f8829a4aSRandall Stewart */ 620f8829a4aSRandall Stewart #define SCTP_DEFAULT_SECRET_LIFE_SEC 3600 621f8829a4aSRandall Stewart 622f8829a4aSRandall Stewart #define SCTP_RTO_UPPER_BOUND (60000) /* 60 sec in ms */ 623ca85e948SMichael Tuexen #define SCTP_RTO_LOWER_BOUND (1000) /* 1 sec is ms */ 624f8829a4aSRandall Stewart #define SCTP_RTO_INITIAL (3000) /* 3 sec in ms */ 625f8829a4aSRandall Stewart 626f8829a4aSRandall Stewart 627f8829a4aSRandall Stewart #define SCTP_INP_KILL_TIMEOUT 20/* number of ms to retry kill of inpcb */ 628f8829a4aSRandall Stewart #define SCTP_ASOC_KILL_TIMEOUT 10 /* number of ms to retry kill of inpcb */ 629f8829a4aSRandall Stewart 630f8829a4aSRandall Stewart #define SCTP_DEF_MAX_INIT 8 631f8829a4aSRandall Stewart #define SCTP_DEF_MAX_SEND 10 632d61a0ae0SRandall Stewart #define SCTP_DEF_MAX_PATH_RTX 5 633ca85e948SMichael Tuexen #define SCTP_DEF_PATH_PF_THRESHOLD SCTP_DEF_MAX_PATH_RTX 634f8829a4aSRandall Stewart 635f8829a4aSRandall Stewart #define SCTP_DEF_PMTU_RAISE_SEC 600 /* 10 min between raise attempts */ 636f8829a4aSRandall Stewart 637d61a0ae0SRandall Stewart 638cd0a4ff6SPedro F. Giffuni /* How many streams I request initially by default */ 639f8829a4aSRandall Stewart #define SCTP_OSTREAM_INITIAL 10 640ee1ccd92SMichael Tuexen #define SCTP_ISTREAM_INITIAL 2048 641f8829a4aSRandall Stewart 642f8829a4aSRandall Stewart /* 643f8829a4aSRandall Stewart * How many smallest_mtu's need to increase before a window update sack is 644f8829a4aSRandall Stewart * sent (should be a power of 2). 645f8829a4aSRandall Stewart */ 646f8829a4aSRandall Stewart /* Send window update (incr * this > hiwat). Should be a power of 2 */ 647f8829a4aSRandall Stewart #define SCTP_MINIMAL_RWND (4096) /* minimal rwnd */ 648f8829a4aSRandall Stewart 649ca85e948SMichael Tuexen #define SCTP_ADDRMAX 16 650f8829a4aSRandall Stewart 651f8829a4aSRandall Stewart /* SCTP DEBUG Switch parameters */ 652f8829a4aSRandall Stewart #define SCTP_DEBUG_TIMER1 0x00000001 653ad21a364SRandall Stewart #define SCTP_DEBUG_TIMER2 0x00000002 /* unused */ 654ad21a364SRandall Stewart #define SCTP_DEBUG_TIMER3 0x00000004 /* unused */ 655f8829a4aSRandall Stewart #define SCTP_DEBUG_TIMER4 0x00000008 656f8829a4aSRandall Stewart #define SCTP_DEBUG_OUTPUT1 0x00000010 657f8829a4aSRandall Stewart #define SCTP_DEBUG_OUTPUT2 0x00000020 658f8829a4aSRandall Stewart #define SCTP_DEBUG_OUTPUT3 0x00000040 659f8829a4aSRandall Stewart #define SCTP_DEBUG_OUTPUT4 0x00000080 660f8829a4aSRandall Stewart #define SCTP_DEBUG_UTIL1 0x00000100 661ad21a364SRandall Stewart #define SCTP_DEBUG_UTIL2 0x00000200 /* unused */ 662f8829a4aSRandall Stewart #define SCTP_DEBUG_AUTH1 0x00000400 663ad21a364SRandall Stewart #define SCTP_DEBUG_AUTH2 0x00000800 /* unused */ 664f8829a4aSRandall Stewart #define SCTP_DEBUG_INPUT1 0x00001000 665f8829a4aSRandall Stewart #define SCTP_DEBUG_INPUT2 0x00002000 666f8829a4aSRandall Stewart #define SCTP_DEBUG_INPUT3 0x00004000 667ad21a364SRandall Stewart #define SCTP_DEBUG_INPUT4 0x00008000 /* unused */ 668f8829a4aSRandall Stewart #define SCTP_DEBUG_ASCONF1 0x00010000 669f8829a4aSRandall Stewart #define SCTP_DEBUG_ASCONF2 0x00020000 670ad21a364SRandall Stewart #define SCTP_DEBUG_OUTPUT5 0x00040000 /* unused */ 671ad21a364SRandall Stewart #define SCTP_DEBUG_XXX 0x00080000 /* unused */ 672f8829a4aSRandall Stewart #define SCTP_DEBUG_PCB1 0x00100000 673ad21a364SRandall Stewart #define SCTP_DEBUG_PCB2 0x00200000 /* unused */ 674f8829a4aSRandall Stewart #define SCTP_DEBUG_PCB3 0x00400000 675baf3da66SRandall Stewart #define SCTP_DEBUG_PCB4 0x00800000 676f8829a4aSRandall Stewart #define SCTP_DEBUG_INDATA1 0x01000000 677ad21a364SRandall Stewart #define SCTP_DEBUG_INDATA2 0x02000000 /* unused */ 678ad21a364SRandall Stewart #define SCTP_DEBUG_INDATA3 0x04000000 /* unused */ 679a99b6783SRandall Stewart #define SCTP_DEBUG_CRCOFFLOAD 0x08000000 /* unused */ 680ad21a364SRandall Stewart #define SCTP_DEBUG_USRREQ1 0x10000000 /* unused */ 681ad21a364SRandall Stewart #define SCTP_DEBUG_USRREQ2 0x20000000 /* unused */ 682f8829a4aSRandall Stewart #define SCTP_DEBUG_PEEL1 0x40000000 683ad21a364SRandall Stewart #define SCTP_DEBUG_XXXXX 0x80000000 /* unused */ 684f8829a4aSRandall Stewart #define SCTP_DEBUG_ALL 0x7ff3ffff 685f8829a4aSRandall Stewart #define SCTP_DEBUG_NOISY 0x00040000 686f8829a4aSRandall Stewart 687f8829a4aSRandall Stewart /* What sender needs to see to avoid SWS or we consider peers rwnd 0 */ 688f8829a4aSRandall Stewart #define SCTP_SWS_SENDER_DEF 1420 689f8829a4aSRandall Stewart 690f8829a4aSRandall Stewart /* 691f8829a4aSRandall Stewart * SWS is scaled to the sb_hiwat of the socket. A value of 2 is hiwat/4, 1 692f8829a4aSRandall Stewart * would be hiwat/2 etc. 693f8829a4aSRandall Stewart */ 694f8829a4aSRandall Stewart /* What receiver needs to see in sockbuf or we tell peer its 1 */ 695f8829a4aSRandall Stewart #define SCTP_SWS_RECEIVER_DEF 3000 696f8829a4aSRandall Stewart 697f8829a4aSRandall Stewart #define SCTP_INITIAL_CWND 4380 698f8829a4aSRandall Stewart 699a99b6783SRandall Stewart #define SCTP_DEFAULT_MTU 1500 /* emergency default MTU */ 700f8829a4aSRandall Stewart /* amount peer is obligated to have in rwnd or I will abort */ 701f8829a4aSRandall Stewart #define SCTP_MIN_RWND 1500 702f8829a4aSRandall Stewart 703f8829a4aSRandall Stewart #define SCTP_DEFAULT_MAXSEGMENT 65535 704f8829a4aSRandall Stewart 7059a972525SRandall Stewart #define SCTP_CHUNK_BUFFER_SIZE 512 706f42a358aSRandall Stewart #define SCTP_PARAM_BUFFER_SIZE 512 707f8829a4aSRandall Stewart 7082afb3e84SRandall Stewart /* small chunk store for looking at chunk_list in auth */ 7092afb3e84SRandall Stewart #define SCTP_SMALL_CHUNK_STORE 260 7102afb3e84SRandall Stewart 711f8829a4aSRandall Stewart #define SCTP_HOW_MANY_SECRETS 2 /* how many secrets I keep */ 712f8829a4aSRandall Stewart 713f8829a4aSRandall Stewart #define SCTP_NUMBER_OF_SECRETS 8 /* or 8 * 4 = 32 octets */ 714f8829a4aSRandall Stewart #define SCTP_SECRET_SIZE 32 /* number of octets in a 256 bits */ 715f8829a4aSRandall Stewart 716f8829a4aSRandall Stewart 717f8829a4aSRandall Stewart /* 718f8829a4aSRandall Stewart * SCTP upper layer notifications 719f8829a4aSRandall Stewart */ 720f8829a4aSRandall Stewart #define SCTP_NOTIFY_ASSOC_UP 1 721f8829a4aSRandall Stewart #define SCTP_NOTIFY_ASSOC_DOWN 2 722f8829a4aSRandall Stewart #define SCTP_NOTIFY_INTERFACE_DOWN 3 723f8829a4aSRandall Stewart #define SCTP_NOTIFY_INTERFACE_UP 4 7241edc9dbaSMichael Tuexen #define SCTP_NOTIFY_SENT_DG_FAIL 5 7251edc9dbaSMichael Tuexen #define SCTP_NOTIFY_UNSENT_DG_FAIL 6 7261edc9dbaSMichael Tuexen #define SCTP_NOTIFY_SPECIAL_SP_FAIL 7 7271edc9dbaSMichael Tuexen #define SCTP_NOTIFY_ASSOC_LOC_ABORTED 8 7281edc9dbaSMichael Tuexen #define SCTP_NOTIFY_ASSOC_REM_ABORTED 9 7291edc9dbaSMichael Tuexen #define SCTP_NOTIFY_ASSOC_RESTART 10 7301edc9dbaSMichael Tuexen #define SCTP_NOTIFY_PEER_SHUTDOWN 11 7311edc9dbaSMichael Tuexen #define SCTP_NOTIFY_ASCONF_ADD_IP 12 7321edc9dbaSMichael Tuexen #define SCTP_NOTIFY_ASCONF_DELETE_IP 13 7331edc9dbaSMichael Tuexen #define SCTP_NOTIFY_ASCONF_SET_PRIMARY 14 7341edc9dbaSMichael Tuexen #define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 15 7351edc9dbaSMichael Tuexen #define SCTP_NOTIFY_INTERFACE_CONFIRMED 16 7361edc9dbaSMichael Tuexen #define SCTP_NOTIFY_STR_RESET_RECV 17 7371edc9dbaSMichael Tuexen #define SCTP_NOTIFY_STR_RESET_SEND 18 7381edc9dbaSMichael Tuexen #define SCTP_NOTIFY_STR_RESET_FAILED_OUT 19 7391edc9dbaSMichael Tuexen #define SCTP_NOTIFY_STR_RESET_FAILED_IN 20 7401edc9dbaSMichael Tuexen #define SCTP_NOTIFY_STR_RESET_DENIED_OUT 21 7411edc9dbaSMichael Tuexen #define SCTP_NOTIFY_STR_RESET_DENIED_IN 22 7421edc9dbaSMichael Tuexen #define SCTP_NOTIFY_AUTH_NEW_KEY 23 7431edc9dbaSMichael Tuexen #define SCTP_NOTIFY_AUTH_FREE_KEY 24 7441edc9dbaSMichael Tuexen #define SCTP_NOTIFY_NO_PEER_AUTH 25 7451edc9dbaSMichael Tuexen #define SCTP_NOTIFY_SENDER_DRY 26 746389b1b11SMichael Tuexen #define SCTP_NOTIFY_REMOTE_ERROR 27 747f8829a4aSRandall Stewart 748f8829a4aSRandall Stewart /* This is the value for messages that are NOT completely 749f8829a4aSRandall Stewart * copied down where we will start to split the message. 750f8829a4aSRandall Stewart * So, with our default, we split only if the piece we 751f8829a4aSRandall Stewart * want to take will fill up a full MTU (assuming 752f8829a4aSRandall Stewart * a 1500 byte MTU). 753f8829a4aSRandall Stewart */ 7545e54f665SRandall Stewart #define SCTP_DEFAULT_SPLIT_POINT_MIN 2904 755f8829a4aSRandall Stewart 756ff1ffd74SMichael Tuexen /* Maximum length of diagnostic information in error causes */ 7571a7abbb3SMichael Tuexen #define SCTP_DIAG_INFO_LEN 128 758ff1ffd74SMichael Tuexen 759a5d547adSRandall Stewart /* ABORT CODES and other tell-tale location 760a5d547adSRandall Stewart * codes are generated by adding the below 761a5d547adSRandall Stewart * to the instance id. 762a5d547adSRandall Stewart */ 763a5d547adSRandall Stewart 764a5d547adSRandall Stewart /* File defines */ 765a5d547adSRandall Stewart #define SCTP_FROM_SCTP_INPUT 0x10000000 766a5d547adSRandall Stewart #define SCTP_FROM_SCTP_PCB 0x20000000 767a5d547adSRandall Stewart #define SCTP_FROM_SCTP_INDATA 0x30000000 768a5d547adSRandall Stewart #define SCTP_FROM_SCTP_TIMER 0x40000000 769a5d547adSRandall Stewart #define SCTP_FROM_SCTP_USRREQ 0x50000000 770a5d547adSRandall Stewart #define SCTP_FROM_SCTPUTIL 0x60000000 771a5d547adSRandall Stewart #define SCTP_FROM_SCTP6_USRREQ 0x70000000 772a5d547adSRandall Stewart #define SCTP_FROM_SCTP_ASCONF 0x80000000 773a5d547adSRandall Stewart #define SCTP_FROM_SCTP_OUTPUT 0x90000000 774a5d547adSRandall Stewart #define SCTP_FROM_SCTP_PEELOFF 0xa0000000 775d61a0ae0SRandall Stewart #define SCTP_FROM_SCTP_PANDA 0xb0000000 776c4739e2fSRandall Stewart #define SCTP_FROM_SCTP_SYSCTL 0xc0000000 777b7d130beSMichael Tuexen #define SCTP_FROM_SCTP_CC_FUNCTIONS 0xd0000000 778a5d547adSRandall Stewart 779a5d547adSRandall Stewart /* Location ID's */ 780a5d547adSRandall Stewart #define SCTP_LOC_1 0x00000001 781a5d547adSRandall Stewart #define SCTP_LOC_2 0x00000002 782a5d547adSRandall Stewart #define SCTP_LOC_3 0x00000003 783a5d547adSRandall Stewart #define SCTP_LOC_4 0x00000004 784a5d547adSRandall Stewart #define SCTP_LOC_5 0x00000005 785a5d547adSRandall Stewart #define SCTP_LOC_6 0x00000006 786a5d547adSRandall Stewart #define SCTP_LOC_7 0x00000007 787a5d547adSRandall Stewart #define SCTP_LOC_8 0x00000008 788a5d547adSRandall Stewart #define SCTP_LOC_9 0x00000009 789a5d547adSRandall Stewart #define SCTP_LOC_10 0x0000000a 790a5d547adSRandall Stewart #define SCTP_LOC_11 0x0000000b 791a5d547adSRandall Stewart #define SCTP_LOC_12 0x0000000c 792a5d547adSRandall Stewart #define SCTP_LOC_13 0x0000000d 793a5d547adSRandall Stewart #define SCTP_LOC_14 0x0000000e 794a5d547adSRandall Stewart #define SCTP_LOC_15 0x0000000f 795a5d547adSRandall Stewart #define SCTP_LOC_16 0x00000010 796a5d547adSRandall Stewart #define SCTP_LOC_17 0x00000011 797a5d547adSRandall Stewart #define SCTP_LOC_18 0x00000012 798a5d547adSRandall Stewart #define SCTP_LOC_19 0x00000013 799a5d547adSRandall Stewart #define SCTP_LOC_20 0x00000014 800a5d547adSRandall Stewart #define SCTP_LOC_21 0x00000015 801a5d547adSRandall Stewart #define SCTP_LOC_22 0x00000016 802a5d547adSRandall Stewart #define SCTP_LOC_23 0x00000017 803a5d547adSRandall Stewart #define SCTP_LOC_24 0x00000018 804a5d547adSRandall Stewart #define SCTP_LOC_25 0x00000019 805a5d547adSRandall Stewart #define SCTP_LOC_26 0x0000001a 806a5d547adSRandall Stewart #define SCTP_LOC_27 0x0000001b 807a5d547adSRandall Stewart #define SCTP_LOC_28 0x0000001c 808a5d547adSRandall Stewart #define SCTP_LOC_29 0x0000001d 809a5d547adSRandall Stewart #define SCTP_LOC_30 0x0000001e 810a5d547adSRandall Stewart #define SCTP_LOC_31 0x0000001f 811a5d547adSRandall Stewart #define SCTP_LOC_32 0x00000020 81217205eccSRandall Stewart #define SCTP_LOC_33 0x00000021 813b7d130beSMichael Tuexen #define SCTP_LOC_34 0x00000022 814b7d130beSMichael Tuexen #define SCTP_LOC_35 0x00000023 815a5d547adSRandall Stewart 816a5d547adSRandall Stewart 817a5d547adSRandall Stewart /* Free assoc codes */ 818a5d547adSRandall Stewart #define SCTP_NORMAL_PROC 0 819a5d547adSRandall Stewart #define SCTP_PCBFREE_NOFORCE 1 820a5d547adSRandall Stewart #define SCTP_PCBFREE_FORCE 2 821a5d547adSRandall Stewart 822a5d547adSRandall Stewart /* From codes for adding addresses */ 823a5d547adSRandall Stewart #define SCTP_ADDR_IS_CONFIRMED 8 824a5d547adSRandall Stewart #define SCTP_ADDR_DYNAMIC_ADDED 6 825a5d547adSRandall Stewart #define SCTP_IN_COOKIE_PROC 100 826a5d547adSRandall Stewart #define SCTP_ALLOC_ASOC 1 827a5d547adSRandall Stewart #define SCTP_LOAD_ADDR_2 2 828a5d547adSRandall Stewart #define SCTP_LOAD_ADDR_3 3 829a5d547adSRandall Stewart #define SCTP_LOAD_ADDR_4 4 830a5d547adSRandall Stewart #define SCTP_LOAD_ADDR_5 5 831a5d547adSRandall Stewart 832a5d547adSRandall Stewart #define SCTP_DONOT_SETSCOPE 0 833a5d547adSRandall Stewart #define SCTP_DO_SETSCOPE 1 834a5d547adSRandall Stewart 835a5d547adSRandall Stewart 836f8829a4aSRandall Stewart /* This value determines the default for when 837f8829a4aSRandall Stewart * we try to add more on the send queue., if 838f8829a4aSRandall Stewart * there is room. This prevents us from cycling 839f8829a4aSRandall Stewart * into the copy_resume routine to often if 840f8829a4aSRandall Stewart * we have not got enough space to add a decent 841f8829a4aSRandall Stewart * enough size message. Note that if we have enough 842f8829a4aSRandall Stewart * space to complete the message copy we will always 843f8829a4aSRandall Stewart * add to the message, no matter what the size. Its 844f8829a4aSRandall Stewart * only when we reach the point that we have some left 845f8829a4aSRandall Stewart * to add, there is only room for part of it that we 846f8829a4aSRandall Stewart * will use this threshold. Its also a sysctl. 847f8829a4aSRandall Stewart */ 848f8829a4aSRandall Stewart #define SCTP_DEFAULT_ADD_MORE 1452 849f8829a4aSRandall Stewart 850f8829a4aSRandall Stewart #ifndef SCTP_PCBHASHSIZE 851f8829a4aSRandall Stewart /* default number of association hash buckets in each endpoint */ 852f8829a4aSRandall Stewart #define SCTP_PCBHASHSIZE 256 853f8829a4aSRandall Stewart #endif 854f8829a4aSRandall Stewart #ifndef SCTP_TCBHASHSIZE 855f8829a4aSRandall Stewart #define SCTP_TCBHASHSIZE 1024 856f8829a4aSRandall Stewart #endif 857f8829a4aSRandall Stewart 858f8829a4aSRandall Stewart #ifndef SCTP_CHUNKQUEUE_SCALE 859f8829a4aSRandall Stewart #define SCTP_CHUNKQUEUE_SCALE 10 860f8829a4aSRandall Stewart #endif 861f8829a4aSRandall Stewart 862f8829a4aSRandall Stewart /* clock variance is 1 ms */ 863f8829a4aSRandall Stewart #define SCTP_CLOCK_GRANULARITY 1 864f8829a4aSRandall Stewart #define IP_HDR_SIZE 40 /* we use the size of a IP6 header here this 865f8829a4aSRandall Stewart * detracts a small amount for ipv4 but it 866f8829a4aSRandall Stewart * simplifies the ipv6 addition */ 867f8829a4aSRandall Stewart 868b0552ae2SRandall Stewart /* Argument magic number for sctp_inpcb_free() */ 869b0552ae2SRandall Stewart 870b0552ae2SRandall Stewart /* third argument */ 871b0552ae2SRandall Stewart #define SCTP_CALLED_DIRECTLY_NOCMPSET 0 872b0552ae2SRandall Stewart #define SCTP_CALLED_AFTER_CMPSET_OFCLOSE 1 8730c7dc840SRandall Stewart #define SCTP_CALLED_FROM_INPKILL_TIMER 2 874b0552ae2SRandall Stewart /* second argument */ 875b0552ae2SRandall Stewart #define SCTP_FREE_SHOULD_USE_ABORT 1 876b0552ae2SRandall Stewart #define SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE 0 877b0552ae2SRandall Stewart 878f8829a4aSRandall Stewart #ifndef IPPROTO_SCTP 879f8829a4aSRandall Stewart #define IPPROTO_SCTP 132 /* the Official IANA number :-) */ 880f8829a4aSRandall Stewart #endif /* !IPPROTO_SCTP */ 881f8829a4aSRandall Stewart 882f8829a4aSRandall Stewart #define SCTP_MAX_DATA_BUNDLING 256 883f8829a4aSRandall Stewart 884f8829a4aSRandall Stewart /* modular comparison */ 88520b07a4dSMichael Tuexen /* See RFC 1982 for details. */ 88644249214SRandall Stewart #define SCTP_UINT16_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \ 887dec0177dSRandall Stewart ((a > b) && ((uint16_t)(a - b) < (1U<<15)))) 88844249214SRandall Stewart #define SCTP_UINT16_GE(a, b) (SCTP_UINT16_GT(a, b) || (a == b)) 88944249214SRandall Stewart #define SCTP_UINT32_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \ 890dec0177dSRandall Stewart ((a > b) && ((uint32_t)(a - b) < (1U<<31)))) 89144249214SRandall Stewart #define SCTP_UINT32_GE(a, b) (SCTP_UINT32_GT(a, b) || (a == b)) 89244249214SRandall Stewart 89344249214SRandall Stewart #define SCTP_SSN_GT(a, b) SCTP_UINT16_GT(a, b) 89444249214SRandall Stewart #define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b) 89544249214SRandall Stewart #define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b) 89644249214SRandall Stewart #define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b) 89749656eefSMichael Tuexen #define SCTP_MID_GT(i, a, b) (((i) == 1) ? SCTP_UINT32_GT(a, b) : SCTP_UINT16_GT((uint16_t)a, (uint16_t)b)) 89849656eefSMichael Tuexen #define SCTP_MID_GE(i, a, b) (((i) == 1) ? SCTP_UINT32_GE(a, b) : SCTP_UINT16_GE((uint16_t)a, (uint16_t)b)) 89949656eefSMichael Tuexen #define SCTP_MID_EQ(i, a, b) (((i) == 1) ? a == b : (uint16_t)a == (uint16_t)b) 900f8829a4aSRandall Stewart 901f8829a4aSRandall Stewart /* Mapping array manipulation routines */ 902f8829a4aSRandall Stewart #define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) 903f8829a4aSRandall Stewart #define SCTP_SET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] |= (0x01 << ((gap & 0x07)))) 904f8829a4aSRandall Stewart #define SCTP_UNSET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] &= ((~(0x01 << ((gap & 0x07)))) & 0xff)) 905b5c16493SMichael Tuexen #define SCTP_CALC_TSN_TO_GAP(gap, tsn, mapping_tsn) do { \ 906b5c16493SMichael Tuexen if (tsn >= mapping_tsn) { \ 907b5c16493SMichael Tuexen gap = tsn - mapping_tsn; \ 908b5c16493SMichael Tuexen } else { \ 909b5c16493SMichael Tuexen gap = (MAX_TSN - mapping_tsn) + tsn + 1; \ 910b5c16493SMichael Tuexen } \ 911b5c16493SMichael Tuexen } while (0) 912f8829a4aSRandall Stewart 913f8829a4aSRandall Stewart 9145e54f665SRandall Stewart #define SCTP_RETRAN_DONE -1 9155e54f665SRandall Stewart #define SCTP_RETRAN_EXIT -2 9165e54f665SRandall Stewart 917f8829a4aSRandall Stewart /* 918f8829a4aSRandall Stewart * This value defines the number of vtag block time wait entry's per list 919f8829a4aSRandall Stewart * element. Each entry will take 2 4 byte ints (and of course the overhead 920f8829a4aSRandall Stewart * of the next pointer as well). Using 15 as an example will yield * ((8 * 921f8829a4aSRandall Stewart * 15) + 8) or 128 bytes of overhead for each timewait block that gets 922cd0a4ff6SPedro F. Giffuni * initialized. Increasing it to 31 would yield 256 bytes per block. 923f8829a4aSRandall Stewart */ 924f8829a4aSRandall Stewart #define SCTP_NUMBER_IN_VTAG_BLOCK 15 925f8829a4aSRandall Stewart /* 926f8829a4aSRandall Stewart * If we use the STACK option, we have an array of this size head pointers. 927f8829a4aSRandall Stewart * This array is mod'd the with the size to find which bucket and then all 928f8829a4aSRandall Stewart * entries must be searched to see if the tag is in timed wait. If so we 929f8829a4aSRandall Stewart * reject it. 930f8829a4aSRandall Stewart */ 931a1e13272SRandall Stewart #define SCTP_STACK_VTAG_HASH_SIZE 32 9320696e120SRandall Stewart 933f8829a4aSRandall Stewart /* 934fb8fb8f8SRandall Stewart * Number of seconds of time wait for a vtag. 935f8829a4aSRandall Stewart */ 936fb8fb8f8SRandall Stewart #define SCTP_TIME_WAIT 60 937f8829a4aSRandall Stewart 938899288aeSRandall Stewart /* How many micro seconds is the cutoff from 939899288aeSRandall Stewart * local lan type rtt's 940899288aeSRandall Stewart */ 941899288aeSRandall Stewart /* 94248b6c649SRandall Stewart * We allow 900us for the rtt. 943899288aeSRandall Stewart */ 94448b6c649SRandall Stewart #define SCTP_LOCAL_LAN_RTT 900 945899288aeSRandall Stewart #define SCTP_LAN_UNKNOWN 0 946899288aeSRandall Stewart #define SCTP_LAN_LOCAL 1 947899288aeSRandall Stewart #define SCTP_LAN_INTERNET 2 948899288aeSRandall Stewart 94925a2a187SMichael Tuexen #define SCTP_SEND_BUFFER_SPLITTING 0x00000001 95025a2a187SMichael Tuexen #define SCTP_RECV_BUFFER_SPLITTING 0x00000002 95125a2a187SMichael Tuexen 952f8829a4aSRandall Stewart /* The system retains a cache of free chunks such to 953f8829a4aSRandall Stewart * cut down on calls the memory allocation system. There 954f8829a4aSRandall Stewart * is a per association limit of free items and a overall 955f8829a4aSRandall Stewart * system limit. If either one gets hit then the resource 956f8829a4aSRandall Stewart * stops being cached. 957f8829a4aSRandall Stewart */ 958f8829a4aSRandall Stewart 959f8829a4aSRandall Stewart #define SCTP_DEF_ASOC_RESC_LIMIT 10 960f8829a4aSRandall Stewart #define SCTP_DEF_SYSTEM_RESC_LIMIT 1000 961f8829a4aSRandall Stewart 962ceaad40aSRandall Stewart /*- 963ceaad40aSRandall Stewart * defines for socket lock states. 964ceaad40aSRandall Stewart * Used by __APPLE__ and SCTP_SO_LOCK_TESTING 965ceaad40aSRandall Stewart */ 966ceaad40aSRandall Stewart #define SCTP_SO_LOCKED 1 967ceaad40aSRandall Stewart #define SCTP_SO_NOT_LOCKED 0 968ceaad40aSRandall Stewart 969f8829a4aSRandall Stewart 970851b7298SRandall Stewart /*- 971851b7298SRandall Stewart * For address locks, do we hold the lock? 972851b7298SRandall Stewart */ 973851b7298SRandall Stewart #define SCTP_ADDR_LOCKED 1 974851b7298SRandall Stewart #define SCTP_ADDR_NOT_LOCKED 0 975851b7298SRandall Stewart 976f8829a4aSRandall Stewart #define IN4_ISPRIVATE_ADDRESS(a) \ 977f42a358aSRandall Stewart ((((uint8_t *)&(a)->s_addr)[0] == 10) || \ 978f42a358aSRandall Stewart ((((uint8_t *)&(a)->s_addr)[0] == 172) && \ 979f42a358aSRandall Stewart (((uint8_t *)&(a)->s_addr)[1] >= 16) && \ 980f42a358aSRandall Stewart (((uint8_t *)&(a)->s_addr)[1] <= 32)) || \ 981f42a358aSRandall Stewart ((((uint8_t *)&(a)->s_addr)[0] == 192) && \ 982f42a358aSRandall Stewart (((uint8_t *)&(a)->s_addr)[1] == 168))) 983f8829a4aSRandall Stewart 984f8829a4aSRandall Stewart #define IN4_ISLOOPBACK_ADDRESS(a) \ 985e51963a7SMichael Tuexen (((uint8_t *)&(a)->s_addr)[0] == 127) 986f8829a4aSRandall Stewart 987ebae9987SMichael Tuexen #define IN4_ISLINKLOCAL_ADDRESS(a) \ 988ebae9987SMichael Tuexen ((((uint8_t *)&(a)->s_addr)[0] == 169) && \ 989ebae9987SMichael Tuexen (((uint8_t *)&(a)->s_addr)[1] == 254)) 990ebae9987SMichael Tuexen 991f8829a4aSRandall Stewart 992f8829a4aSRandall Stewart #if defined(_KERNEL) 993f8829a4aSRandall Stewart #define SCTP_GETTIME_TIMEVAL(x) (getmicrouptime(x)) 994f8829a4aSRandall Stewart #define SCTP_GETPTIME_TIMEVAL(x) (microuptime(x)) 995fc14de76SRandall Stewart #endif 996f8829a4aSRandall Stewart 997fc14de76SRandall Stewart #if defined(_KERNEL) || defined(__Userspace__) 998f8829a4aSRandall Stewart #define sctp_sowwakeup(inp, so) \ 999f8829a4aSRandall Stewart do { \ 1000f8829a4aSRandall Stewart if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1001f8829a4aSRandall Stewart inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ 1002f8829a4aSRandall Stewart } else { \ 1003f8829a4aSRandall Stewart sowwakeup(so); \ 1004f8829a4aSRandall Stewart } \ 1005f8829a4aSRandall Stewart } while (0) 1006f8829a4aSRandall Stewart 1007f8829a4aSRandall Stewart #define sctp_sowwakeup_locked(inp, so) \ 1008f8829a4aSRandall Stewart do { \ 1009f8829a4aSRandall Stewart if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1010f8829a4aSRandall Stewart SOCKBUF_UNLOCK(&((so)->so_snd)); \ 1011f8829a4aSRandall Stewart inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ 1012f8829a4aSRandall Stewart } else { \ 1013f8829a4aSRandall Stewart sowwakeup_locked(so); \ 1014f8829a4aSRandall Stewart } \ 1015f8829a4aSRandall Stewart } while (0) 1016f8829a4aSRandall Stewart 1017f8829a4aSRandall Stewart #define sctp_sorwakeup(inp, so) \ 1018f8829a4aSRandall Stewart do { \ 1019f8829a4aSRandall Stewart if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1020f8829a4aSRandall Stewart inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ 1021f8829a4aSRandall Stewart } else { \ 1022f8829a4aSRandall Stewart sorwakeup(so); \ 1023f8829a4aSRandall Stewart } \ 1024f8829a4aSRandall Stewart } while (0) 1025f8829a4aSRandall Stewart 1026f8829a4aSRandall Stewart #define sctp_sorwakeup_locked(inp, so) \ 1027f8829a4aSRandall Stewart do { \ 1028f8829a4aSRandall Stewart if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ 1029f8829a4aSRandall Stewart inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ 1030f8829a4aSRandall Stewart SOCKBUF_UNLOCK(&((so)->so_rcv)); \ 1031f8829a4aSRandall Stewart } else { \ 1032f8829a4aSRandall Stewart sorwakeup_locked(so); \ 1033f8829a4aSRandall Stewart } \ 1034f8829a4aSRandall Stewart } while (0) 1035f8829a4aSRandall Stewart 1036fc14de76SRandall Stewart #endif /* _KERNEL || __Userspace__ */ 1037f8829a4aSRandall Stewart #endif 1038