Use Variables / Defines in include statements

Jan Matejka jan.matejka at
Tue Jan 17 13:00:57 CET 2017

On 01/17/2017 11:03 AM, Tim Weippert wrote:
> Hi, 
> i currently try to do different includes, based on an variable/define
> within the config.
> for example:
> function test(int asn) {
>   [ do something general ]
>   include "/etc/bird/" . asn . "-special.conf";
> }
> As this approach doesn't work, is there currently an possibility to do
> such includes somehow?
> regards, 
> tim


I assume you call this function from a filter. It would mean to resolve
the filename for every route import/export. This is virtually impossible
in the current architecture of filters; in the far future when another
filter language is involved, it may be possible but still slow (all the
config reading and parsing must be involved together with several syscalls).

It should be possible to use the case switch to explicitely include
these files, one by one. It is also needed to reload the config on every

case asn {
	65500: include "/etc/bird/65500-special.conf";
	65511: include "/etc/bird/65511-special.conf";


More information about the Bird-users mailing list