Access and mutation of routes' scope attribute

Alexander Zubkov green at qrator.net
Thu Nov 27 12:58:00 CET 2025


Hi Bertrand,

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.

Regards,
Alexander

On Wed, Nov 26, 2025 at 3:27 PM Bertrand Petit via Bird-users <
bird-users at network.cz> wrote:

>         I'm in the process of upgrading a set of bird instances from v1 to
> v2.
> The running configurations of these nodes were written circa ten years ago,
> for a network that since has shrunk quite a lot, nethertheless I would
> like to
> change them as little as possible. During preparation work I've hit a snag:
> most of these configurations use routes scope as one of the filtering
> criterions but bird v2 experience some grammatical difficulties when
> parsing
> them.
>
>         The user manual states that one can access and mutate a route scope
> through the "scope" symbol (section 5.5). Nonetheless, the configuration
> file
> parser rejects the following two functions---these are fictious functions
> written to concisely replicate the problem, they are accompanied by the
> error
> message produced by "bird -c <file> -p".
>
>
> function ScopeAccess () -> bool
> {
>   return scope = SCOPE_HOST;
> }
> bird: 2025-11-26 10:30:02.631 [0001] <FATAL> scope-access.conf:3:10 syntax
> error, unexpected SCOPE
>
>
> function ScopeSet () -> bool
> {
>   scope = SCOPE_HOST;
>   return true;
> }
> bird: 2025-11-26 10:31:25.081 [0001] <FATAL> scope-set.conf:3:3 syntax
> error, unexpected SCOPE
>
>
>         I had a quick look into "config.Y". I can't predend I fully
> understand
> how the grammar is constructed due to a cursory glance, however I suppose
> the
> constructions shown above are covered by the "term: ... static_attr ..."
> and
> "cmd: ... symbol_known '=' term ';'" productions.
>
>         When using the manual and these productions as supporting material
> I
> think the two functions shown above are legit. Am I correct?
>
>         Then I looked at "test.conf" where I found a construction involving
> "scope" used not as an attribute but as a type, a declaration that is not
> part
> of the documentation: "enum scope ev2 = SCOPE_UNIVERSE;". This
> construction,
> accepted by the parser, is contradicting the user manual. Quoting it,
> section
> 5.2: "Enumeration types are fixed sets of possibilities. You can't define
> your
> own variables of such type, but some route attributes are of enumeration
> type."
>
>         With regard to this undocumented declarative form, at this stage,
> I'm
> wondering if a grammatical ambiguity could exist between "scope" the type
> and
> "scope" the attribute?
>
> --
> %!PS -- Bertrand Petit
> /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
> /O{N 0 0 moveto}D/P{pop}D/T{translate}D currentpagedevice/PageSize G U 0
> G/w E
> 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
> mul add sqrt I 50 add {N 50 0 3 2 L 0 360 arc stroke}for}for/s{O true
> charpath
> pathbbox exch 4 -1 L E sub I 3 1 L sub I} D /l(bp)D 0.94 Y /Helvetica
> findfont
> 22 scalefont setfont l s P(x)s exch P T O l show showpage
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20251127/4c5f1cae/attachment.htm>


More information about the Bird-users mailing list