[sr-dev] [kamailio/kamailio] cfg parse error behaviour on a mismatch of #!ifdef/#!endif statements (#2057)

Henning Westerholt notifications at github.com
Fri Sep 6 11:47:58 CEST 2019


The #!ifdef/#endif statement parsing of the kamailio.cfg does not work correctly on a mismatch of #!ifdef/#!define statements. In some cases will just ignore the #!defines and parses the cfg file without the statements.

version: kamailio 5.3.0-pre0 (x86_64/linux) ed10d7

> henning at linux:~/repositories/kamailio/src> ./kamailio -c -f ../etc/test-define.cfg 
>  0(9501) CRITICAL: <core> [core/cfg.y:3539]: yyerror_at(): parse error in config file /home/henning/repositories/kamailio/src/../etc/test-define.cfg, line 12, column 8: syntax error
>  0(9501) CRITICAL: <core> [core/cfg.y:3539]: yyerror_at(): parse error in config file /home/henning/repositories/kamailio/src/../etc/test-define.cfg, line 12, column 8: unknown config variable
>  0(9501) CRITICAL: <core> [core/cfg.y:3536]: yyerror_at(): parse error in config file /home/henning/repositories/kamailio/src/../etc/test-define.cfg, line 12, column 9-11: 
> ERROR: bad config file (3 errors)

Test cfg to show the problem:

```
henning at linux:~/repositories/kamailio/etc> cat test-define.cfg
#!KAMAILIO

#!define foo

#!ifdef foobar1
#!ifdef foobar2
#!endif
#!endif
#!endif

#!ifdef bar
invalid=123
#else 
children=8
#!endif

request_route {
        ;
}

```

The "bar" condition is parsed, even if the #!define was not set. The WARN message is also not shown in this error case.

Probably the easist fix would be to stop kamailio startup on a mismatch of #!ifdef/#endif statements and output ERROR instead of the current WARN. 


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2057
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190906/7f8c6f1d/attachment-0001.html>


More information about the sr-dev mailing list