<div dir="ltr"><div>Hi Bertrand,</div><div><br></div><div>What bird version are you using? Getting and setting "scope" value if function/filter works for me with a recent version of bird2. And it seems to have been dropped in bird3, it is also not mentioned in bird3's documentation.</div><div><br></div><div>Regards,</div><div>Alexander</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Nov 26, 2025 at 3:27 PM Bertrand Petit via Bird-users <<a href="mailto:bird-users@network.cz">bird-users@network.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> I'm in the process of upgrading a set of bird instances from v1 to v2.<br>
The running configurations of these nodes were written circa ten years ago,<br>
for a network that since has shrunk quite a lot, nethertheless I would like to<br>
change them as little as possible. During preparation work I've hit a snag:<br>
most of these configurations use routes scope as one of the filtering<br>
criterions but bird v2 experience some grammatical difficulties when parsing<br>
them.<br>
<br>
The user manual states that one can access and mutate a route scope<br>
through the "scope" symbol (section 5.5). Nonetheless, the configuration file<br>
parser rejects the following two functions---these are fictious functions<br>
written to concisely replicate the problem, they are accompanied by the error<br>
message produced by "bird -c <file> -p".<br>
<br>
<br>
function ScopeAccess () -> bool<br>
{<br>
return scope = SCOPE_HOST;<br>
}<br>
bird: 2025-11-26 10:30:02.631 [0001] <FATAL> scope-access.conf:3:10 syntax error, unexpected SCOPE<br>
<br>
<br>
function ScopeSet () -> bool<br>
{<br>
scope = SCOPE_HOST;<br>
return true;<br>
}<br>
bird: 2025-11-26 10:31:25.081 [0001] <FATAL> scope-set.conf:3:3 syntax error, unexpected SCOPE<br>
<br>
<br>
I had a quick look into "config.Y". I can't predend I fully understand<br>
how the grammar is constructed due to a cursory glance, however I suppose the<br>
constructions shown above are covered by the "term: ... static_attr ..." and<br>
"cmd: ... symbol_known '=' term ';'" productions.<br>
<br>
When using the manual and these productions as supporting material I<br>
think the two functions shown above are legit. Am I correct?<br>
<br>
Then I looked at "test.conf" where I found a construction involving<br>
"scope" used not as an attribute but as a type, a declaration that is not part<br>
of the documentation: "enum scope ev2 = SCOPE_UNIVERSE;". This construction,<br>
accepted by the parser, is contradicting the user manual. Quoting it, section<br>
5.2: "Enumeration types are fixed sets of possibilities. You can't define your<br>
own variables of such type, but some route attributes are of enumeration<br>
type."<br>
<br>
With regard to this undocumented declarative form, at this stage, I'm<br>
wondering if a grammatical ambiguity could exist between "scope" the type and<br>
"scope" the attribute?<br>
<br>
-- <br>
%!PS -- Bertrand Petit<br>
/D{def}def/E{exch}D/G{get}D/I{2 div}D/U{dup}D/L{roll}D/Y{setgray}D/N{newpath}D<br>
/O{N 0 0 moveto}D/P{pop}D/T{translate}D currentpagedevice/PageSize G U 0 G/w E<br>
D 1 G /h E D w I h I T 0 Y 1 setlinewidth 0 1 2 { P 120 rotate 2 4 w U mul h U<br>
mul add sqrt I 50 add {N 50 0 3 2 L 0 360 arc stroke}for}for/s{O true charpath<br>
pathbbox exch 4 -1 L E sub I 3 1 L sub I} D /l(bp)D 0.94 Y /Helvetica findfont<br>
22 scalefont setfont l s P(x)s exch P T O l show showpage<br>
</blockquote></div>