Skip to content

Commit

Permalink
[core] proper re-init of cfg parser during reload_routes
Browse files Browse the repository at this point in the history
The lex parser needs an explicit reset/init after a parsing attempt completed with a parsing error. This is needed to be able to start a new parting session, via the route_reload MI cmd

(cherry picked from commit 5dd7976)
  • Loading branch information
bogdan-iancu committed Nov 2, 2021
1 parent 5ac273d commit 7ea9b66
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cfg_pp.c
Expand Up @@ -40,6 +40,7 @@ extern int column;

extern FILE *yyin;
extern int yyparse();
extern int yyrestart(FILE*);
#ifdef DEBUG_PARSER
extern int yydebug;
#endif
Expand Down Expand Up @@ -116,6 +117,7 @@ int parse_opensips_cfg(const char *cfg_file, const char *preproc_cmdline,
/* parse the config file, prior to this only default values
e.g. for debugging settings will be used */
yyin = cfg_stream;
yyrestart(yyin);
cfg_errors = 0;
if (yyparse() != 0 || cfg_errors) {
LM_ERR("bad config file (%d errors)\n", cfg_errors);
Expand Down

0 comments on commit 7ea9b66

Please sign in to comment.