BIRD 2.0 Syntax issue with defined()
Hello fellows, I have my bird config failing on something as trivial as if defined (some_variable_never_defined) then ... ; with "syntax error, unexpected CF_SYM_UNDEFINED" on the "some_...". Am I wrongly assuming that defined() would check for the variable to exist within BIRD's global scope (e.g., appear in the namespace)? How, if not this way, can I check for a variable to have been defined prior (and, if it does, do certain things, of course)? Elmar. PS: The first example on the filters page makes me believe that defined() works in exactly this way, but I might be mistaken.
On Thu, Jul 08, 2021 at 01:53:21PM +0200, Elmar K. Bins wrote:
Hello fellows,
I have my bird config failing on something as trivial as
if defined (some_variable_never_defined) then ... ;
with "syntax error, unexpected CF_SYM_UNDEFINED" on the "some_...".
Am I wrongly assuming that defined() would check for the variable to exist within BIRD's global scope (e.g., appear in the namespace)?
Hello No, defined() checks for whether given route attribute is defined for the current route. So it requires known attribute names, like bgp_path or ospf_metric1. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Hi Ondrej, santiago@crfreenet.org (Ondrej Zajicek) wrote:
Am I wrongly assuming that defined() would check for the variable to exist within BIRD's global scope (e.g., appear in the namespace)?
No, defined() checks for whether given route attribute is defined for the current route. So it requires known attribute names, like bgp_path or ospf_metric1.
Thank you for the explanation...well... do you happen to know how I can test for a variable existing? Yours, Elmar.
Hello! There is no such config syntax yet. Anyway, patches for this are welcome. Maria On 7/9/21 10:28 PM, Elmar K. Bins wrote:
Anyone have any idea, or is this feature really missing from the config syntax?
Wringing hands... ;-)
Elmar.
elmi@noir.de (Elmar K. Bins) wrote:
Thank you for the explanation...well... do you happen to know how I can test for a variable existing?
participants (3)
-
Elmar K. Bins -
Maria Matejka -
Ondrej Zajicek