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
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@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
On Thu, Nov 27, 2025 at 12:58:00PM +0100, Alexander Zubkov wrote:
What bird version are you using?
That is a good catch! I had two different versions: 2.17.1 on my workstation and 3.1.2 was installed on the test router. Obviously, as you mentioned, scope wasn't usable on that test router until I downgraded. Reading the sources of 2.17.1 and testing against 3.1.2 wasn't the best situation to resolve my confusion. Thank you, now I can go on. -- %!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
Hello Bertrand, yes, the scope attribute was kinda quirk and we removed it for BIRD 3. There is a full-blown feature of custom attributes which you can use instead (also in BIRD 2), offering you plenty of attribute types and better display of your custom data for each route. These attributes are ignored by all protocols. Nothing leaks out. Maria On November 27, 2025 3:16:14 PM GMT+01:00, Bertrand Petit via Bird-users <bird-users@network.cz> wrote:
On Thu, Nov 27, 2025 at 12:58:00PM +0100, Alexander Zubkov wrote:
What bird version are you using?
That is a good catch!
I had two different versions: 2.17.1 on my workstation and 3.1.2 was installed on the test router. Obviously, as you mentioned, scope wasn't usable on that test router until I downgraded. Reading the sources of 2.17.1 and testing against 3.1.2 wasn't the best situation to resolve my confusion. Thank you, now I can go on.
-- %!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
-- Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.
participants (3)
-
Alexander Zubkov -
Bertrand Petit -
Maria Matejka