Browse code

sctp: sctp_max_assocs support from the script

Andrei Pelinescu-Onciul authored on 26/06/2009 17:59:09
Showing 3 changed files
... ...
@@ -312,6 +312,22 @@ new config variables:
312 312
      association will be automatically reused by the sctp stack.
313 313
      Can be changed at runtime (sctp assoc_reuse), but it can be turned on
314 314
      only if sctp_assoc_tracking is on.
315
+  sctp_max_assocs = number - maximum number of allowed open sctp associations.
316
+     -1 means maximum allowed by the OS. Default: -1.
317
+     Can be changed at runtime (e.g.:
318
+      sercmd cfg.set_now_int sctp max_assocs 10 ).
319
+     When the maximum associations number is exceeded and a new associations
320
+     is opened by a remote host, the association will be immediately closed.
321
+     However it is possible that some sip packets get through (especially if
322
+     they are sent early, as part of the 4-way handshake).
323
+     When ser/sip-router tries to open a new association and the max_assocs
324
+     is exceeded the exact behaviour depends on whether or not
325
+     sctp_assoc_tracking is on. If on, the send triggering the active open
326
+     will gracefully fail, before actually opening the new association and no
327
+     packet will be sent. However if sctp_assoc_tracking is off, the
328
+     association will first be opened and then immediately closed. In general
329
+     this means that the initial sip packet will be sent (as part of the 4-way
330
+     handshake).
315 331
   sctp_srto_initial = milliseconds - initial value of the retr. timeout, used
316 332
      in RTO calculations (default: OS specific).
317 333
      Can be changed at runtime (sctp srto_initial) but it will affect only new
... ...
@@ -340,6 +340,7 @@ SCTP_SEND_TTL	"sctp_send_ttl"
340 340
 SCTP_SEND_RETRIES	"sctp_send_retries"
341 341
 SCTP_ASSOC_TRACKING	"sctp_assoc_tracking"
342 342
 SCTP_ASSOC_REUSE	"sctp_assoc_reuse"
343
+SCTP_MAX_ASSOCS		"sctp_max_assocs"
343 344
 SCTP_SRTO_INITIAL	"sctp_srto_initial"
344 345
 SCTP_SRTO_MAX		"sctp_srto_max"
345 346
 SCTP_SRTO_MIN		"sctp_srto_min"
... ...
@@ -685,6 +686,8 @@ EAT_ABLE	[\ \t\b\r]
685 685
 										return SCTP_ASSOC_TRACKING; }
686 686
 <INITIAL>{SCTP_ASSOC_REUSE}		{ count(); yylval.strval=yytext;
687 687
 										return SCTP_ASSOC_REUSE; }
688
+<INITIAL>{SCTP_MAX_ASSOCS}		{ count(); yylval.strval=yytext;
689
+										return SCTP_MAX_ASSOCS; }
688 690
 <INITIAL>{SCTP_SRTO_INITIAL}	{ count(); yylval.strval=yytext;
689 691
 										return SCTP_SRTO_INITIAL; }
690 692
 <INITIAL>{SCTP_SRTO_MAX}	{ count(); yylval.strval=yytext;
... ...
@@ -404,6 +404,7 @@ static void free_socket_id_lst(struct socket_id* i);
404 404
 %token SCTP_SEND_RETRIES
405 405
 %token SCTP_ASSOC_TRACKING
406 406
 %token SCTP_ASSOC_REUSE
407
+%token SCTP_MAX_ASSOCS
407 408
 %token SCTP_SRTO_INITIAL
408 409
 %token SCTP_SRTO_MAX
409 410
 %token SCTP_SRTO_MIN
... ...
@@ -1234,6 +1235,10 @@ assign_stm:
1234 1234
 		#endif /* USE_SCTP */
1235 1235
 	}
1236 1236
 	| SCTP_ASSOC_REUSE EQUAL error { yyerror("number expected"); }
1237
+	| SCTP_MAX_ASSOCS EQUAL NUMBER {
1238
+			IF_SCTP(sctp_default_cfg.max_assocs=$3);
1239
+	}
1240
+	| SCTP_MAX_ASSOCS EQUAL error { yyerror("number expected"); }
1237 1241
 	| SCTP_SRTO_INITIAL EQUAL NUMBER {
1238 1242
 			IF_SCTP(sctp_default_cfg.srto_initial=$3);
1239 1243
 	}