[sr-dev] git:master:6d1bf58d: core: [cfg] reset routename properly

Victor Seva linuxmaniac at torreviejawireless.org
Wed Oct 17 15:53:54 CEST 2018


Module: kamailio
Branch: master
Commit: 6d1bf58d468e8ee62da2b1a2e50a57feb7c576c6
URL: https://github.com/kamailio/kamailio/commit/6d1bf58d468e8ee62da2b1a2e50a57feb7c576c6

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2018-10-17T15:51:52+02:00

core: [cfg] reset routename properly

solution for #1536 was not working

fix #1668

---

Modified: src/core/cfg.lex
Modified: src/core/cfg.y

---

Diff:  https://github.com/kamailio/kamailio/commit/6d1bf58d468e8ee62da2b1a2e50a57feb7c576c6.diff
Patch: https://github.com/kamailio/kamailio/commit/6d1bf58d468e8ee62da2b1a2e50a57feb7c576c6.patch

---

diff --git a/src/core/cfg.lex b/src/core/cfg.lex
index 324cc57e9f..bcdad27322 100644
--- a/src/core/cfg.lex
+++ b/src/core/cfg.lex
@@ -571,23 +571,23 @@ IMPORTFILE      "import_file"
 <INITIAL>{ISAVPFLAGSET}	{ count(); yylval.strval=yytext; return ISAVPFLAGSET; }
 <INITIAL>{AVPFLAGS_DECL}	{ count(); yylval.strval=yytext; return AVPFLAGS_DECL; }
 <INITIAL>{MSGLEN}	{ count(); yylval.strval=yytext; return MSGLEN; }
-<INITIAL>{ROUTE}	{ count(); routename=0; default_routename="DEFAULT_ROUTE";
+<INITIAL>{ROUTE}	{ count(); default_routename="DEFAULT_ROUTE";
 						yylval.strval=yytext; return ROUTE; }
-<INITIAL>{ROUTE_REQUEST}	{ count(); routename=0; default_routename="DEFAULT_ROUTE";
+<INITIAL>{ROUTE_REQUEST}	{ count(); default_routename="DEFAULT_ROUTE";
 								yylval.strval=yytext; return ROUTE_REQUEST; }
-<INITIAL>{ROUTE_ONREPLY}	{ count(); routename=0; default_routename="DEFAULT_ONREPLY";
+<INITIAL>{ROUTE_ONREPLY}	{ count(); default_routename="DEFAULT_ONREPLY";
 								yylval.strval=yytext;
 								return ROUTE_ONREPLY; }
-<INITIAL>{ROUTE_REPLY}	{ count(); routename=0; default_routename="DEFAULT_ONREPLY";
+<INITIAL>{ROUTE_REPLY}	{ count(); default_routename="DEFAULT_ONREPLY";
 							yylval.strval=yytext; return ROUTE_REPLY; }
-<INITIAL>{ROUTE_FAILURE}	{ count(); routename=0; default_routename="DEFAULT_FAILURE";
+<INITIAL>{ROUTE_FAILURE}	{ count(); default_routename="DEFAULT_FAILURE";
 								yylval.strval=yytext;
 								return ROUTE_FAILURE; }
-<INITIAL>{ROUTE_BRANCH} { count(); routename=0; default_routename="DEFAULT_BRANCH";
+<INITIAL>{ROUTE_BRANCH} { count(); default_routename="DEFAULT_BRANCH";
 							yylval.strval=yytext; return ROUTE_BRANCH; }
-<INITIAL>{ROUTE_SEND} { count(); routename=0; default_routename="DEFAULT_SEND";
+<INITIAL>{ROUTE_SEND} { count(); default_routename="DEFAULT_SEND";
 							yylval.strval=yytext; return ROUTE_SEND; }
-<INITIAL>{ROUTE_EVENT} { count(); routename=0; default_routename="DEFAULT_EVENT";
+<INITIAL>{ROUTE_EVENT} { count(); default_routename="DEFAULT_EVENT";
 							yylval.strval=yytext;
 							state=EVRT_NAME_S; BEGIN(EVRTNAME);
 							return ROUTE_EVENT; }
diff --git a/src/core/cfg.y b/src/core/cfg.y
index b4ed024b8e..9279171f20 100644
--- a/src/core/cfg.y
+++ b/src/core/cfg.y
@@ -1877,8 +1877,11 @@ route_stm:
 	| ROUTE error { yyerror("invalid  route  statement"); }
 	| ROUTE_REQUEST error { yyerror("invalid  request_route  statement"); }
 	;
+
+failure_route_main: ROUTE_FAILURE { routename=NULL; }
+;
 failure_route_stm:
-	ROUTE_FAILURE LBRACE actions RBRACE {
+	failure_route_main LBRACE actions RBRACE {
 	#ifdef SHM_MEM
 		if (!shm_initialized() && init_shm()<0) {
 			yyerror("Can't initialize shared memory");
@@ -1955,8 +1958,11 @@ onreply_route_stm:
 		yyerror("invalid onreply_route statement");
 	}
 	;
+
+branch_route_main: ROUTE_BRANCH { routename=NULL; }
+;
 branch_route_stm:
-	ROUTE_BRANCH LBRACE actions RBRACE {
+	branch_route_main LBRACE actions RBRACE {
 	#ifdef SHM_MEM
 		if (!shm_initialized() && init_shm()<0) {
 			yyerror("Can't initialize shared memory");
@@ -1985,7 +1991,11 @@ branch_route_stm:
 	}
 	| ROUTE_BRANCH error { yyerror("invalid branch_route statement"); }
 	;
-send_route_stm: ROUTE_SEND LBRACE actions RBRACE {
+
+send_route_main: ROUTE_SEND { routename=NULL; }
+;
+send_route_stm:
+	send_route_main LBRACE actions RBRACE {
 	#ifdef SHM_MEM
 		if (!shm_initialized() && init_shm()<0) {
 			yyerror("Can't initialize shared memory");
@@ -2014,7 +2024,11 @@ send_route_stm: ROUTE_SEND LBRACE actions RBRACE {
 	}
 	| ROUTE_SEND error { yyerror("invalid onsend_route statement"); }
 	;
-event_route_stm: ROUTE_EVENT LBRACK EVENT_RT_NAME RBRACK LBRACE actions RBRACE {
+
+event_route_main: ROUTE_EVENT { routename=NULL; }
+;
+event_route_stm:
+	event_route_main LBRACK EVENT_RT_NAME RBRACK LBRACE actions RBRACE {
 	#ifdef SHM_MEM
 		if (!shm_initialized() && init_shm()<0) {
 			yyerror("Can't initialize shared memory");




More information about the sr-dev mailing list