[sr-dev] git:5.1:85b5f076: core: [cfg] reset routename properly

Victor Seva linuxmaniac at torreviejawireless.org
Wed Oct 17 15:55:16 CEST 2018


Module: kamailio
Branch: 5.1
Commit: 85b5f07694b30bdddcb36591b7306fef4385ecc2
URL: https://github.com/kamailio/kamailio/commit/85b5f07694b30bdddcb36591b7306fef4385ecc2

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

core: [cfg] reset routename properly

solution for #1536 was not working

fix #1668

(cherry picked from commit 6d1bf58d468e8ee62da2b1a2e50a57feb7c576c6)

---

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

---

Diff:  https://github.com/kamailio/kamailio/commit/85b5f07694b30bdddcb36591b7306fef4385ecc2.diff
Patch: https://github.com/kamailio/kamailio/commit/85b5f07694b30bdddcb36591b7306fef4385ecc2.patch

---

diff --git a/src/core/cfg.lex b/src/core/cfg.lex
index 4d3931d419..cd6808d063 100644
--- a/src/core/cfg.lex
+++ b/src/core/cfg.lex
@@ -562,23 +562,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 85105120b7..8a5cd8162c 100644
--- a/src/core/cfg.y
+++ b/src/core/cfg.y
@@ -1828,8 +1828,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");
@@ -1906,8 +1909,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");
@@ -1936,7 +1942,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");
@@ -1965,7 +1975,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