| 1 |
SCTP Module |
| 2 |
|
| 3 |
Daniel-Constantin Mierla |
| 4 |
|
| 5 |
<[email protected]> |
| 6 |
|
| 7 |
Andrei Pelinescu-Onciul |
| 8 |
__________________________________________________________________ |
| 9 |
|
| 10 |
Table of Contents |
| 11 |
|
| 12 |
1. Admin Guide |
| 13 |
|
| 14 |
1. Overview |
| 15 |
2. Dependencies |
| 16 |
|
| 17 |
2.1. Kamailio Modules |
| 18 |
2.2. External Libraries or Applications |
| 19 |
|
| 20 |
3. Parameters |
| 21 |
|
| 22 |
3.1. sctp_socket_rcvbuf (int) |
| 23 |
3.2. sctp_socket_sndbuf (int) |
| 24 |
3.3. sctp_autoclose (int) |
| 25 |
3.4. sctp_send_ttl (int) |
| 26 |
3.5. sctp_send_retries (int) |
| 27 |
3.6. sctp_assoc_tracking (int) |
| 28 |
3.7. sctp_assoc_reuse (int) |
| 29 |
3.8. sctp_max_assocs (int) |
| 30 |
3.9. sctp_srto_initial (int) |
| 31 |
3.10. sctp_srto_max (int) |
| 32 |
3.11. sctp_srto_min (int) |
| 33 |
3.12. sctp_asocmaxrxt (int) |
| 34 |
3.13. sctp_init_max_attempts (int) |
| 35 |
3.14. sctp_init_max_timeo (int) |
| 36 |
3.15. sctp_hbinterval (int) |
| 37 |
3.16. sctp_pathmaxrxt (int) |
| 38 |
3.17. sctp_sack_delay (int) |
| 39 |
3.18. sctp_sack_freq (int) |
| 40 |
3.19. sctp_max_burst (int) |
| 41 |
|
| 42 |
4. RPC Commands |
| 43 |
|
| 44 |
4.1. sctp.info |
| 45 |
4.2. sctp.options |
| 46 |
|
| 47 |
List of Examples |
| 48 |
|
| 49 |
1.1. Set sctp_socket_rcvbuf parameter |
| 50 |
1.2. Set sctp_socket_sndbuf parameter |
| 51 |
1.3. Set sctp_autoclose parameter |
| 52 |
1.4. Set sctp_send_ttl parameter |
| 53 |
1.5. Set sctp_send_retries parameter |
| 54 |
1.6. Set sctp_assoc_tracking parameter |
| 55 |
1.7. Set sctp_assoc_reuse parameter |
| 56 |
1.8. Set sctp_max_assocs parameter |
| 57 |
1.9. Set sctp_srto_initial parameter |
| 58 |
1.10. Set sctp_srto_max parameter |
| 59 |
1.11. Set sctp_srto_min parameter |
| 60 |
1.12. Set sctp_asocmaxrxt parameter |
| 61 |
1.13. Set sctp_init_max_attempts parameter |
| 62 |
1.14. Set sctp_init_max_timeo parameter |
| 63 |
1.15. Set sctp_hbinterval parameter |
| 64 |
1.16. Set sctp_pathmaxrxt parameter |
| 65 |
1.17. Set sctp_sack_delay parameter |
| 66 |
1.18. Set sctp_sack_freq parameter |
| 67 |
1.19. Set sctp_max_burst parameter |
| 68 |
1.20. Use sctp.info with kamctl |
| 69 |
1.21. Use sctp.options with kamctl |
| 70 |
|
| 71 |
Chapter 1. Admin Guide |
| 72 |
|
| 73 |
Table of Contents |
| 74 |
|
| 75 |
1. Overview |
| 76 |
2. Dependencies |
| 77 |
|
| 78 |
2.1. Kamailio Modules |
| 79 |
2.2. External Libraries or Applications |
| 80 |
|
| 81 |
3. Parameters |
| 82 |
|
| 83 |
3.1. sctp_socket_rcvbuf (int) |
| 84 |
3.2. sctp_socket_sndbuf (int) |
| 85 |
3.3. sctp_autoclose (int) |
| 86 |
3.4. sctp_send_ttl (int) |
| 87 |
3.5. sctp_send_retries (int) |
| 88 |
3.6. sctp_assoc_tracking (int) |
| 89 |
3.7. sctp_assoc_reuse (int) |
| 90 |
3.8. sctp_max_assocs (int) |
| 91 |
3.9. sctp_srto_initial (int) |
| 92 |
3.10. sctp_srto_max (int) |
| 93 |
3.11. sctp_srto_min (int) |
| 94 |
3.12. sctp_asocmaxrxt (int) |
| 95 |
3.13. sctp_init_max_attempts (int) |
| 96 |
3.14. sctp_init_max_timeo (int) |
| 97 |
3.15. sctp_hbinterval (int) |
| 98 |
3.16. sctp_pathmaxrxt (int) |
| 99 |
3.17. sctp_sack_delay (int) |
| 100 |
3.18. sctp_sack_freq (int) |
| 101 |
3.19. sctp_max_burst (int) |
| 102 |
|
| 103 |
4. RPC Commands |
| 104 |
|
| 105 |
4.1. sctp.info |
| 106 |
4.2. sctp.options |
| 107 |
|
| 108 |
1. Overview |
| 109 |
|
| 110 |
This module provides SCTP transport layer for Kamailio. SCTP is an |
| 111 |
acronym for Stream Control Transmission Protocol, read more about it |
| 112 |
at: http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol |
| 113 |
|
| 114 |
The module itself implements the callbacks required by the core to |
| 115 |
receive and send SIP messages over SCTP sockets. |
| 116 |
|
| 117 |
The core Makefile variable SCTP must be set to 1 (which is by default |
| 118 |
set to 1 in Makefile.defs) and sources compiled with -DUSE_SCTP |
| 119 |
(automatically set when SCTP=1). In other words, if core Makefiles are |
| 120 |
not changed and SCTP variable is not overwritten from command line, |
| 121 |
then the SCTP support in core is enabled. |
| 122 |
|
| 123 |
Note: it is recommended to use recent versions of libsctp (>1.0.10) and |
| 124 |
kernel (>4.0.0) when enabling SCTP transport. |
| 125 |
|
| 126 |
2. Dependencies |
| 127 |
|
| 128 |
2.1. Kamailio Modules |
| 129 |
2.2. External Libraries or Applications |
| 130 |
|
| 131 |
2.1. Kamailio Modules |
| 132 |
|
| 133 |
The following modules must be loaded before this module: |
| 134 |
* none. |
| 135 |
|
| 136 |
2.2. External Libraries or Applications |
| 137 |
|
| 138 |
The following libraries or applications must be installed before |
| 139 |
running Kamailio with this module loaded: |
| 140 |
* libsctp - SCTP user space library available on Linux. To compile |
| 141 |
the module, libsctp-dev is required as well. |
| 142 |
|
| 143 |
3. Parameters |
| 144 |
|
| 145 |
3.1. sctp_socket_rcvbuf (int) |
| 146 |
3.2. sctp_socket_sndbuf (int) |
| 147 |
3.3. sctp_autoclose (int) |
| 148 |
3.4. sctp_send_ttl (int) |
| 149 |
3.5. sctp_send_retries (int) |
| 150 |
3.6. sctp_assoc_tracking (int) |
| 151 |
3.7. sctp_assoc_reuse (int) |
| 152 |
3.8. sctp_max_assocs (int) |
| 153 |
3.9. sctp_srto_initial (int) |
| 154 |
3.10. sctp_srto_max (int) |
| 155 |
3.11. sctp_srto_min (int) |
| 156 |
3.12. sctp_asocmaxrxt (int) |
| 157 |
3.13. sctp_init_max_attempts (int) |
| 158 |
3.14. sctp_init_max_timeo (int) |
| 159 |
3.15. sctp_hbinterval (int) |
| 160 |
3.16. sctp_pathmaxrxt (int) |
| 161 |
3.17. sctp_sack_delay (int) |
| 162 |
3.18. sctp_sack_freq (int) |
| 163 |
3.19. sctp_max_burst (int) |
| 164 |
|
| 165 |
3.1. sctp_socket_rcvbuf (int) |
| 166 |
|
| 167 |
Size for the sctp socket receive buffer. |
| 168 |
|
| 169 |
Default value is automatically set based on OS limits. |
| 170 |
|
| 171 |
Example 1.1. Set sctp_socket_rcvbuf parameter |
| 172 |
... |
| 173 |
modparam("sctp", "sctp_socket_rcvbuf", 14096) |
| 174 |
... |
| 175 |
|
| 176 |
3.2. sctp_socket_sndbuf (int) |
| 177 |
|
| 178 |
Size for the sctp socket send buffer. |
| 179 |
|
| 180 |
Default value is automatically set based on OS limits. |
| 181 |
|
| 182 |
Example 1.2. Set sctp_socket_sndbuf parameter |
| 183 |
... |
| 184 |
modparam("sctp", "sctp_socket_sndbuf", 14096) |
| 185 |
... |
| 186 |
|
| 187 |
3.3. sctp_autoclose (int) |
| 188 |
|
| 189 |
Number of seconds before autoclosing an idle association. Can be |
| 190 |
changed at runtime, but it will affect only new associations. |
| 191 |
|
| 192 |
Default value is 180 (seconds). |
| 193 |
|
| 194 |
Example 1.3. Set sctp_autoclose parameter |
| 195 |
... |
| 196 |
# kamctl rpc cfg.set_now_int sctp autoclose 120 |
| 197 |
... |
| 198 |
modparam("sctp", "sctp_autoclose", 300) |
| 199 |
... |
| 200 |
|
| 201 |
3.4. sctp_send_ttl (int) |
| 202 |
|
| 203 |
Number of milliseconds before an unsent message/chunk is dropped. Can |
| 204 |
be changed at runtime. |
| 205 |
|
| 206 |
Default value is 32000 (milliseconds - 32 seconds). |
| 207 |
|
| 208 |
Example 1.4. Set sctp_send_ttl parameter |
| 209 |
... |
| 210 |
# kamctl rpc cfg.set_now_int sctp send_ttl 180000 |
| 211 |
... |
| 212 |
modparam("sctp", "sctp_send_ttl", 10000) |
| 213 |
... |
| 214 |
|
| 215 |
3.5. sctp_send_retries (int) |
| 216 |
|
| 217 |
How many times to attempt re-sending a message on a re-opened |
| 218 |
association, if the sctp stack did give up sending it (it's not related |
| 219 |
to sctp protocol level retransmission). Useful to improve reliability |
| 220 |
with peers that reboot/restart or fail over to another machine. |
| 221 |
|
| 222 |
WARNING: use with care and low values (e.g. 1-3) to avoid "multiplying" |
| 223 |
traffic to unresponding hosts. |
| 224 |
|
| 225 |
Can be changed at runtime. |
| 226 |
|
| 227 |
Default value is 0. |
| 228 |
|
| 229 |
Example 1.5. Set sctp_send_retries parameter |
| 230 |
... |
| 231 |
modparam("sctp", "sctp_send_retries", 1) |
| 232 |
... |
| 233 |
|
| 234 |
3.6. sctp_assoc_tracking (int) |
| 235 |
|
| 236 |
Controls whether or not sctp associations are tracked inside Kamailio. |
| 237 |
Turning it off would result in less memory being used and slightly |
| 238 |
better performance, but it will also disable some other features that |
| 239 |
depend on it (e.g. sctp_assoc_reuse). |
| 240 |
|
| 241 |
Can be changed at runtime (kamcmd sctp assoc_tracking 0), but changes |
| 242 |
will be allowed only if all the other features that depend on it are |
| 243 |
turned off (for example it can be turned off only if first |
| 244 |
sctp_assoc_reuse was turned off). |
| 245 |
|
| 246 |
Note: turning sctp_assoc_tracking on/off will delete all the tracking |
| 247 |
information for all the currently tracked associations and might |
| 248 |
introduce a small temporary delay in the sctp processing if lots of |
| 249 |
associations were tracked. |
| 250 |
|
| 251 |
Config options depending on sctp_assoc_tracking being on: |
| 252 |
sctp_assoc_reuse. |
| 253 |
|
| 254 |
Default value is 1 (enabled, 0 - disabled). |
| 255 |
|
| 256 |
Example 1.6. Set sctp_assoc_tracking parameter |
| 257 |
... |
| 258 |
modparam("sctp", "sctp_assoc_tracking", 0) |
| 259 |
... |
| 260 |
|
| 261 |
3.7. sctp_assoc_reuse (int) |
| 262 |
|
| 263 |
Controls sctp association reuse. For now only association reuse for |
| 264 |
replies is affected by it. Default is on. Depends on |
| 265 |
sctp_assoc_tracking being on. |
| 266 |
|
| 267 |
Note that even if turned off, if the port in via corresponds to the |
| 268 |
source port of the association the request was sent on or if rport is |
| 269 |
turned on (force_rport() or via containing a rport option), the |
| 270 |
association will be automatically reused by the sctp stack. Can be |
| 271 |
changed at runtime (sctp assoc_reuse), but it can be turned on only if |
| 272 |
sctp_assoc_tracking is on. |
| 273 |
|
| 274 |
Default value is 1 (enabled, 0 - disabled). |
| 275 |
|
| 276 |
Example 1.7. Set sctp_assoc_reuse parameter |
| 277 |
... |
| 278 |
modparam("sctp", "sctp_assoc_reuse", 0) |
| 279 |
... |
| 280 |
|
| 281 |
3.8. sctp_max_assocs (int) |
| 282 |
|
| 283 |
Maximum number of allowed open sctp associations. -1 means maximum |
| 284 |
allowed by the OS. Default: -1. Can be changed at runtime (e.g.: kamctl |
| 285 |
rpc cfg.set_now_int sctp max_assocs 10). When the maximum associations |
| 286 |
number is exceeded and a new associations is opened by a remote host, |
| 287 |
the association will be immediately closed. However it is possible that |
| 288 |
some sip packets get through (especially if they are sent early, as |
| 289 |
part of the 4-way handshake). |
| 290 |
|
| 291 |
When Kamailio tries to open a new association and the max_assocs is |
| 292 |
exceeded the exact behaviour depends on whether or not |
| 293 |
sctp_assoc_tracking is on. If on, the send triggering the active open |
| 294 |
will gracefully fail, before actually opening the new association and |
| 295 |
no packet will be sent. However if sctp_assoc_tracking is off, the |
| 296 |
association will first be opened and then immediately closed. In |
| 297 |
general this means that the initial sip packet will be sent (as part of |
| 298 |
the 4-way handshake). |
| 299 |
|
| 300 |
Default value is -1. |
| 301 |
|
| 302 |
Example 1.8. Set sctp_max_assocs parameter |
| 303 |
... |
| 304 |
modparam("sctp", "sctp_max_assocs", 10) |
| 305 |
... |
| 306 |
|
| 307 |
3.9. sctp_srto_initial (int) |
| 308 |
|
| 309 |
Initial value of the retransmission timeout (in milliseconds), used in |
| 310 |
RTO calculations. |
| 311 |
|
| 312 |
Can be changed at runtime (sctp srto_initial) but it will affect only |
| 313 |
new associations. |
| 314 |
|
| 315 |
Default value is OS specific. |
| 316 |
|
| 317 |
Example 1.9. Set sctp_srto_initial parameter |
| 318 |
... |
| 319 |
modparam("sctp", "sctp_srto_initial", 1000) |
| 320 |
... |
| 321 |
|
| 322 |
3.10. sctp_srto_max (int) |
| 323 |
|
| 324 |
Maximum value of the retransmission timeout (RTO) in milliseconds. |
| 325 |
|
| 326 |
WARNING: values lower than the sctp sack_delay will cause lots of |
| 327 |
retransmissions and connection instability (see sctp_srto_min for more |
| 328 |
details). |
| 329 |
|
| 330 |
Can be changed at runtime (sctp srto_max) but it will affect only new |
| 331 |
associations. |
| 332 |
|
| 333 |
Default value is OS specific. |
| 334 |
|
| 335 |
Example 1.10. Set sctp_srto_max parameter |
| 336 |
... |
| 337 |
modparam("sctp", "sctp_srto_max", 2000) |
| 338 |
... |
| 339 |
|
| 340 |
3.11. sctp_srto_min (int) |
| 341 |
|
| 342 |
Minimum value of the retransmission timeout (RTO) in milliseconds. |
| 343 |
|
| 344 |
WARNING: values lower than the sctp sack_delay of any peer might cause |
| 345 |
retransmissions and possible interoperability problems. According to |
| 346 |
the standard the sack_delay should be between 200 and 500 ms, so avoid |
| 347 |
trying values lower than 500 ms unless you control all the possible |
| 348 |
sctp peers and you do make sure their sack_delay is higher or their |
| 349 |
sack_freq is 1. |
| 350 |
|
| 351 |
Can be changed at runtime (sctp srto_min) but it will affect only new |
| 352 |
associations. |
| 353 |
|
| 354 |
Default value is OS specific. |
| 355 |
|
| 356 |
Example 1.11. Set sctp_srto_min parameter |
| 357 |
... |
| 358 |
modparam("sctp", "sctp_srto_min", 800) |
| 359 |
... |
| 360 |
|
| 361 |
3.12. sctp_asocmaxrxt (int) |
| 362 |
|
| 363 |
Maximum retransmissions attempts per association. It should be set to |
| 364 |
sctp_pathmaxrxt * no. of expected paths. |
| 365 |
|
| 366 |
Can be changed at runtime (sctp asocmaxrxt) but it will affect only new |
| 367 |
associations. |
| 368 |
|
| 369 |
Default value is OS specific. |
| 370 |
|
| 371 |
Example 1.12. Set sctp_asocmaxrxt parameter |
| 372 |
... |
| 373 |
modparam("sctp", "sctp_asocmaxrxt", 5) |
| 374 |
... |
| 375 |
|
| 376 |
3.13. sctp_init_max_attempts (int) |
| 377 |
|
| 378 |
Maximum INIT retransmission attempts. |
| 379 |
|
| 380 |
Can be changed at runtime (sctp init_max_attempts). |
| 381 |
|
| 382 |
Default value is OS specific. |
| 383 |
|
| 384 |
Example 1.13. Set sctp_init_max_attempts parameter |
| 385 |
... |
| 386 |
modparam("sctp", "sctp_init_max_attempts", 3) |
| 387 |
... |
| 388 |
|
| 389 |
3.14. sctp_init_max_timeo (int) |
| 390 |
|
| 391 |
Maximum INIT retransmission timeout (RTO max for INIT) in milliseconds. |
| 392 |
|
| 393 |
Can be changed at runtime (sctp init_max_timeo). |
| 394 |
|
| 395 |
Default value is OS specific. |
| 396 |
|
| 397 |
Example 1.14. Set sctp_init_max_timeo parameter |
| 398 |
... |
| 399 |
modparam("sctp", "sctp_init_max_timeo", 1000) |
| 400 |
... |
| 401 |
|
| 402 |
3.15. sctp_hbinterval (int) |
| 403 |
|
| 404 |
SCTP heartbeat interval. Setting it to -1 will disable the heartbeats. |
| 405 |
|
| 406 |
Can be changed at runtime (sctp hbinterval) but it will affect only new |
| 407 |
associations. |
| 408 |
|
| 409 |
Default value is OS specific. |
| 410 |
|
| 411 |
Example 1.15. Set sctp_hbinterval parameter |
| 412 |
... |
| 413 |
modparam("sctp", "sctp_hbinterval", 2000) |
| 414 |
... |
| 415 |
|
| 416 |
3.16. sctp_pathmaxrxt (int) |
| 417 |
|
| 418 |
Maximum retransmission attempts per path (see also sctp_asocmaxrxt). |
| 419 |
|
| 420 |
Can be changed at runtime (sctp pathmaxrxt) but it will affect only new |
| 421 |
associations. |
| 422 |
|
| 423 |
Default value is OS specific. |
| 424 |
|
| 425 |
Example 1.16. Set sctp_pathmaxrxt parameter |
| 426 |
... |
| 427 |
modparam("sctp", "sctp_pathmaxrxt", 2) |
| 428 |
... |
| 429 |
|
| 430 |
3.17. sctp_sack_delay (int) |
| 431 |
|
| 432 |
Delay until an ACK is generated after receiving a packet (in |
| 433 |
milliseconds). |
| 434 |
|
| 435 |
WARNING: a value higher than srto_min can cause a lot of |
| 436 |
retransmissions (and strange problems). A value higher than srto_max |
| 437 |
will result in very high connections instability. According to the |
| 438 |
standard the sack_delay value should be between 200 and 500 ms. |
| 439 |
|
| 440 |
Can be changed at runtime (sctp sack_delay) but it will affect only new |
| 441 |
associations. |
| 442 |
|
| 443 |
Default value is OS specific. |
| 444 |
|
| 445 |
Example 1.17. Set sctp_sack_delay parameter |
| 446 |
... |
| 447 |
modparam("sctp", "sctp_sack_delay", 400) |
| 448 |
... |
| 449 |
|
| 450 |
3.18. sctp_sack_freq (int) |
| 451 |
|
| 452 |
Number of packets received before an ACK is sent (without waiting for |
| 453 |
the sack_delay to expire). Default: OS specific. |
| 454 |
|
| 455 |
Note: on linux with lksctp up to and including 1.0.9 is not possible to |
| 456 |
set this value (having it in the config will produce a warning on |
| 457 |
startup). |
| 458 |
|
| 459 |
Can be changed at runtime (sctp sack_freq) but it will affect only new |
| 460 |
associations. |
| 461 |
|
| 462 |
Default value is OS specific. |
| 463 |
|
| 464 |
Example 1.18. Set sctp_sack_freq parameter |
| 465 |
... |
| 466 |
modparam("sctp", "sctp_sack_freq", 3) |
| 467 |
... |
| 468 |
|
| 469 |
3.19. sctp_max_burst (int) |
| 470 |
|
| 471 |
Maximum burst of packets that can be emitted by an association. |
| 472 |
|
| 473 |
Can be changed at runtime (sctp max_burst) but it will affect only new |
| 474 |
associations. |
| 475 |
|
| 476 |
Default value is OS specific. |
| 477 |
|
| 478 |
Example 1.19. Set sctp_max_burst parameter |
| 479 |
... |
| 480 |
modparam("sctp", "sctp_max_burst", 3) |
| 481 |
... |
| 482 |
|
| 483 |
4. RPC Commands |
| 484 |
|
| 485 |
4.1. sctp.info |
| 486 |
4.2. sctp.options |
| 487 |
|
| 488 |
4.1. sctp.info |
| 489 |
|
| 490 |
Print information about SCTP transport. |
| 491 |
|
| 492 |
Example 1.20. Use sctp.info with kamctl |
| 493 |
... |
| 494 |
kamctl rpc sctp.info |
| 495 |
... |
| 496 |
|
| 497 |
4.2. sctp.options |
| 498 |
|
| 499 |
Print the options of SCTP sockets. It can take an optional parameter |
| 500 |
that specifies the listen address of SCTP socket. |
| 501 |
|
| 502 |
Example 1.21. Use sctp.options with kamctl |
| 503 |
... |
| 504 |
kamctl rpc sctp.options |
| 505 |
... |