Discussion:
check for the existence of a variable
Pavlos Parissis
2014-10-01 13:09:42 UTC
Permalink
Hi,

I want to be able to include a file which will normally have a constant but
in some cases it may not have any content, but I still want to be able to
restart/reload without problems.

Here is a snippet:
include "/etc/bird.d/anycast_prefixes.conf";

function anycast_advertise()
{
if defined(ACAST_PS_ADVERTISE) then
return net ~ ACAST_PS_ADVERTISE;
else {
return false;
}
}


The content of /etc/bird.d/anycast_prefixes.conf is
define ACAST_PS_ADVERTISE =
[
192.168.200.1/32, # Frontend 1
192.168.200.2/32 # Frontend 2
];

The defined function complains about missing variables.

Is it possible to express what I want?

Thanks,
Pavlos

Continue reading on narkive:
Loading...