sctp_admin.xml 17 KB

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