check for the existence of a variable

Pavlos Parissis pavlos.parissis at gmail.com
Wed Oct 1 15:09:42 CEST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20141001/d52c43f7/attachment.html>


More information about the Bird-users mailing list