Browse Source

sctp: sctp_max_assocs support from the script

Andrei Pelinescu-Onciul 16 years ago
parent
commit
f5863aa01d
3 changed files with 24 additions and 0 deletions
  1. 16 0
      NEWS
  2. 3 0
      cfg.lex
  3. 5 0
      cfg.y

+ 16 - 0
NEWS

@@ -312,6 +312,22 @@ new config variables:
      association will be automatically reused by the sctp stack.
      Can be changed at runtime (sctp assoc_reuse), but it can be turned on
      only if sctp_assoc_tracking is on.
+  sctp_max_assocs = number - maximum number of allowed open sctp associations.
+     -1 means maximum allowed by the OS. Default: -1.
+     Can be changed at runtime (e.g.:
+      sercmd cfg.set_now_int sctp max_assocs 10 ).
+     When the maximum associations number is exceeded and a new associations
+     is opened by a remote host, the association will be immediately closed.
+     However it is possible that some sip packets get through (especially if
+     they are sent early, as part of the 4-way handshake).
+     When ser/sip-router tries to open a new association and the max_assocs
+     is exceeded the exact behaviour depends on whether or not
+     sctp_assoc_tracking is on. If on, the send triggering the active open
+     will gracefully fail, before actually opening the new association and no
+     packet will be sent. However if sctp_assoc_tracking is off, the
+     association will first be opened and then immediately closed. In general
+     this means that the initial sip packet will be sent (as part of the 4-way
+     handshake).
   sctp_srto_initial = milliseconds - initial value of the retr. timeout, used
      in RTO calculations (default: OS specific).
      Can be changed at runtime (sctp srto_initial) but it will affect only new

+ 3 - 0
cfg.lex

@@ -340,6 +340,7 @@ SCTP_SEND_TTL	"sctp_send_ttl"
 SCTP_SEND_RETRIES	"sctp_send_retries"
 SCTP_ASSOC_TRACKING	"sctp_assoc_tracking"
 SCTP_ASSOC_REUSE	"sctp_assoc_reuse"
+SCTP_MAX_ASSOCS		"sctp_max_assocs"
 SCTP_SRTO_INITIAL	"sctp_srto_initial"
 SCTP_SRTO_MAX		"sctp_srto_max"
 SCTP_SRTO_MIN		"sctp_srto_min"
@@ -685,6 +686,8 @@ EAT_ABLE	[\ \t\b\r]
 										return SCTP_ASSOC_TRACKING; }
 <INITIAL>{SCTP_ASSOC_REUSE}		{ count(); yylval.strval=yytext;
 										return SCTP_ASSOC_REUSE; }
+<INITIAL>{SCTP_MAX_ASSOCS}		{ count(); yylval.strval=yytext;
+										return SCTP_MAX_ASSOCS; }
 <INITIAL>{SCTP_SRTO_INITIAL}	{ count(); yylval.strval=yytext;
 										return SCTP_SRTO_INITIAL; }
 <INITIAL>{SCTP_SRTO_MAX}	{ count(); yylval.strval=yytext;

+ 5 - 0
cfg.y

@@ -404,6 +404,7 @@ static void free_socket_id_lst(struct socket_id* i);
 %token SCTP_SEND_RETRIES
 %token SCTP_ASSOC_TRACKING
 %token SCTP_ASSOC_REUSE
+%token SCTP_MAX_ASSOCS
 %token SCTP_SRTO_INITIAL
 %token SCTP_SRTO_MAX
 %token SCTP_SRTO_MIN
@@ -1234,6 +1235,10 @@ assign_stm:
 		#endif /* USE_SCTP */
 	}
 	| SCTP_ASSOC_REUSE EQUAL error { yyerror("number expected"); }
+	| SCTP_MAX_ASSOCS EQUAL NUMBER {
+			IF_SCTP(sctp_default_cfg.max_assocs=$3);
+	}
+	| SCTP_MAX_ASSOCS EQUAL error { yyerror("number expected"); }
 	| SCTP_SRTO_INITIAL EQUAL NUMBER {
 			IF_SCTP(sctp_default_cfg.srto_initial=$3);
 	}