<p>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.</p>
<p>version: kamailio 5.3.0-pre0 (x86_64/linux) ed10d7</p>
<blockquote>
<p>henning@linux:~/repositories/kamailio/src> ./kamailio -c -f ../etc/test-define.cfg<br>
0(9501) CRITICAL:  [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<br>
0(9501) CRITICAL:  [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<br>
0(9501) CRITICAL:  [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:<br>
ERROR: bad config file (3 errors)</p>
</blockquote>
<p>Test cfg to show the problem:</p>
<pre><code>henning@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 {
        ;
}

</code></pre>
<p>The "bar" condition is parsed, even if the #!define was not set. The WARN message is also not shown in this error case.</p>
<p>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.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2057?email_source=notifications&email_token=ABO7UZKMQGXVQRSSJ57HEKLQIIRM5A5CNFSM4IUHEH7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HJYMVGA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZPRWAPWH4F6JLSTVYDQIIRM5ANCNFSM4IUHEH7A">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZPRUAMZOZUDNSBY5ATQIIRM5A5CNFSM4IUHEH7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HJYMVGA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2057?email_source=notifications\u0026email_token=ABO7UZKMQGXVQRSSJ57HEKLQIIRM5A5CNFSM4IUHEH7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HJYMVGA",
"url": "https://github.com/kamailio/kamailio/issues/2057?email_source=notifications\u0026email_token=ABO7UZKMQGXVQRSSJ57HEKLQIIRM5A5CNFSM4IUHEH7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HJYMVGA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>