Hi! I try use CASE and string variable and a have error.... I checked User's guide 2.0 <https://bird.network.cz/?get_doc&f=bird.html&v=20>.... CASE use operator ~. This operator applies to string variables. What am I doing wrong? [root@wine etc]# cat 123.conf && bird -c ./123.conf -p function teststring(string myvar) -> bool { case myvar { "text A" : print "A"; return true; "text B" : print "B"; return true; "text C" : print "C"; return true; else : print "unknown"; return false; } } bird: ./123.conf:4:12 syntax error, unexpected TEXT -- Regards, Mikhail Mayorov
On Tue, Oct 08, 2024 at 12:16:42PM +0300, Mikhail Mayorov wrote:
Hi!
I try use CASE and string variable and a have error.... I checked User's guide 2.0 <https://bird.network.cz/?get_doc&f=bird.html&v=20>.... CASE use operator ~. This operator applies to string variables. What am I doing wrong?
Hi Seems like a discrepancy between functionality and documentation. The description of 'case' [1] says: The expression after case can be of any type which can be on the left side of the ~ operator and anything that could be a member of a set is allowed But in fact, only the second part is true, only values that could be members of sets are allowed (with the exception of prefixes, as prefix sets are implemented in a different way). According to [2], that are: int | pair | quad | ip | prefix | ec | lc | enum We probably should fix 'case' for prefixes. Looking at it now, there is also vpnrd, which is allowed in set, but undocumented, and not in switch. In principle, we could extend sets / case to contain strings / bytesrings, but i do not really see use case. [1] https://bird.network.cz/?get_doc&v=20&f=bird-5.html#control-structures [2] https://bird.network.cz/?get_doc&v=20&f=bird-5.html#type-set
[root@wine etc]# cat 123.conf && bird -c ./123.conf -p function teststring(string myvar) -> bool { case myvar { "text A" : print "A"; return true; "text B" : print "B"; return true; "text C" : print "C"; return true; else : print "unknown"; return false; } } bird: ./123.conf:4:12 syntax error, unexpected TEXT
--
Regards, Mikhail Mayorov
-- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) "To err is human -- to blame it on a computer is even more so."
Hi Thank you for explain. Of course you are right, I replace string with int and got similar functionality. For me it doesn't matter. I already wrote about dynamic BGP protocols and a import/export filter in which I need to understand with whom I have a session for correct filtering. It would be very useful to add to route attributes "routerid", "source ip" or "BGP.hostname". This functionality is similar to the "proto" route attribute, but if use bgp dynamic protocols creating attribute "proto" is meaningless. I find сustom attributes have to be first declared by "attribute" global option. This suits me, but I can't find ways to assign the required value. Also, name of dynamic proto will be more filled with meaning if use hostname or routerid. 08.10.2024 18:07, Ondrej Zajicek пишет:
On Tue, Oct 08, 2024 at 12:16:42PM +0300, Mikhail Mayorov wrote:
Hi!
I try use CASE and string variable and a have error.... I checked User's guide 2.0<https://bird.network.cz/?get_doc&f=bird.html&v=20>.... CASE use operator ~. This operator applies to string variables. What am I doing wrong? Hi
Seems like a discrepancy between functionality and documentation. The description of 'case' [1] says:
The expression after case can be of any type which can be on the left side of the ~ operator and anything that could be a member of a set is allowed
But in fact, only the second part is true, only values that could be members of sets are allowed (with the exception of prefixes, as prefix sets are implemented in a different way). According to [2], that are:
int | pair | quad | ip | prefix | ec | lc | enum
We probably should fix 'case' for prefixes. Looking at it now, there is also vpnrd, which is allowed in set, but undocumented, and not in switch.
In principle, we could extend sets / case to contain strings / bytesrings, but i do not really see use case.
[1]https://bird.network.cz/?get_doc&v=20&f=bird-5.html#control-structures [2]https://bird.network.cz/?get_doc&v=20&f=bird-5.html#type-set
[root@wine etc]# cat 123.conf && bird -c ./123.conf -p function teststring(string myvar) -> bool { case myvar { "text A" : print "A"; return true; "text B" : print "B"; return true; "text C" : print "C"; return true; else : print "unknown"; return false; } } bird: ./123.conf:4:12 syntax error, unexpected TEXT
--
Regards, Mikhail Mayorov --
Regards, Mikhail Mayorov PG19, founder and inspirer B.Bulvarnaya 11, Taganrog, Russia, 347913 tel work: +7 8634 431431 (ext 101) tel mobile: +7 905 4309006 pg19.ru
Hi, There is "from" attribute that should contain the IP address of a remote router received via bgp protocol. But if you want to know the router ID - I do not know about such attribute. On Wed, Oct 9, 2024 at 12:38 PM Mikhail Mayorov <mm@tagan.ru> wrote:
Hi
Thank you for explain. Of course you are right, I replace string with int and got similar functionality. For me it doesn't matter.
I already wrote about dynamic BGP protocols and a import/export filter in which I need to understand with whom I have a session for correct filtering. It would be very useful to add to route attributes "routerid", "source ip" or "BGP.hostname". This functionality is similar to the "proto" route attribute, but if use bgp dynamic protocols creating attribute "proto" is meaningless.
I find сustom attributes have to be first declared by "attribute" global option. This suits me, but I can't find ways to assign the required value.
Also, name of dynamic proto will be more filled with meaning if use hostname or routerid. 08.10.2024 18:07, Ondrej Zajicek пишет:
On Tue, Oct 08, 2024 at 12:16:42PM +0300, Mikhail Mayorov wrote:
Hi!
I try use CASE and string variable and a have error.... I checked User's guide 2.0 <https://bird.network.cz/?get_doc&f=bird.html&v=20> <https://bird.network.cz/?get_doc&f=bird.html&v=20>.... CASE use operator ~. This operator applies to string variables. What am I doing wrong?
Hi
Seems like a discrepancy between functionality and documentation. The description of 'case' [1] says:
The expression after case can be of any type which can be on the left side of the ~ operator and anything that could be a member of a set is allowed
But in fact, only the second part is true, only values that could be members of sets are allowed (with the exception of prefixes, as prefix sets are implemented in a different way). According to [2], that are:
int | pair | quad | ip | prefix | ec | lc | enum
We probably should fix 'case' for prefixes. Looking at it now, there is also vpnrd, which is allowed in set, but undocumented, and not in switch.
In principle, we could extend sets / case to contain strings / bytesrings, but i do not really see use case.
[1] https://bird.network.cz/?get_doc&v=20&f=bird-5.html#control-structures [2] https://bird.network.cz/?get_doc&v=20&f=bird-5.html#type-set
[root@wine etc]# cat 123.conf && bird -c ./123.conf -p function teststring(string myvar) -> bool { case myvar { "text A" : print "A"; return true; "text B" : print "B"; return true; "text C" : print "C"; return true; else : print "unknown"; return false; } } bird: ./123.conf:4:12 syntax error, unexpected TEXT
--
Regards, Mikhail Mayorov
--
Regards, Mikhail Mayorov PG19, founder and inspirer B.Bulvarnaya 11, Taganrog, Russia, 347913 tel work: +7 8634 431431 (ext 101) tel mobile: +7 905 4309006
[image: pg19.ru]
Hi! I try make route reflector using bird for 20 BGP routers in my network. 4 of them have many RIB and have fullview with over millions routes. But over needs only local ASN's routes and default. I was try configure dynamic peers . But I can't known context of which the filter is executed. I need to identify the neighbor with whom I have a session. To do this, I was forced to abandon dynamic neighbors and create a separate config for each neighbor. This is certainly not difficult, but very inconvenient. Moreover, the filtering process is also very important for marking routes by different communities. I didn't find any mechanisms to do this with dynamic neighbors. Probably this option is not very popular with the community and it is rarely used. Or maybe I'm just being stupid. :) 10.10.2024 00:13, Alexander Zubkov пишет:
Hi,
There is "from" attribute that should contain the IP address of a remote router received via bgp protocol. But if you want to know the router ID - I do not know about such attribute.
On Wed, Oct 9, 2024 at 12:38 PM Mikhail Mayorov <mm@tagan.ru> wrote:
Hi
Thank you for explain. Of course you are right, I replace string with int and got similar functionality. For me it doesn't matter.
I already wrote about dynamic BGP protocols and a import/export filter in which I need to understand with whom I have a session for correct filtering. It would be very useful to add to route attributes "routerid", "source ip" or "BGP.hostname". This functionality is similar to the "proto" route attribute, but if use bgp dynamic protocols creating attribute "proto" is meaningless.
I find сustom attributes have to be first declared by "attribute" global option. This suits me, but I can't find ways to assign the required value.
Also, name of dynamic proto will be more filled with meaning if use hostname or routerid.
08.10.2024 18:07, Ondrej Zajicek пишет:
On Tue, Oct 08, 2024 at 12:16:42PM +0300, Mikhail Mayorov wrote:
Hi!
I try use CASE and string variable and a have error.... I checked User's guide 2.0<https://bird.network.cz/?get_doc&f=bird.html&v=20> <https://bird.network.cz/?get_doc&f=bird.html&v=20>.... CASE use operator ~. This operator applies to string variables. What am I doing wrong?
Hi
Seems like a discrepancy between functionality and documentation. The description of 'case' [1] says:
The expression after case can be of any type which can be on the left side of the ~ operator and anything that could be a member of a set is allowed
But in fact, only the second part is true, only values that could be members of sets are allowed (with the exception of prefixes, as prefix sets are implemented in a different way). According to [2], that are:
int | pair | quad | ip | prefix | ec | lc | enum
We probably should fix 'case' for prefixes. Looking at it now, there is also vpnrd, which is allowed in set, but undocumented, and not in switch.
In principle, we could extend sets / case to contain strings / bytesrings, but i do not really see use case.
[1]https://bird.network.cz/?get_doc&v=20&f=bird-5.html#control-structures <https://bird.network.cz/?get_doc&v=20&f=bird-5.html#control-structures> [2]https://bird.network.cz/?get_doc&v=20&f=bird-5.html#type-set <https://bird.network.cz/?get_doc&v=20&f=bird-5.html#type-set>
[root@wine etc]# cat 123.conf && bird -c ./123.conf -p function teststring(string myvar) -> bool { case myvar { "text A" : print "A"; return true; "text B" : print "B"; return true; "text C" : print "C"; return true; else : print "unknown"; return false; } } bird: ./123.conf:4:12 syntax error, unexpected TEXT
--
Regards, Mikhail Mayorov
--
Regards, Mikhail Mayorov PG19, founder and inspirer B.Bulvarnaya 11, Taganrog, Russia, 347913 tel work: +7 8634 431431 (ext 101) tel mobile: +7 905 4309006
pg19.ru
-- Regards, Mikhail Mayorov PG19, founder and inspirer B.Bulvarnaya 11, Taganrog, Russia, 347913 tel work: +7 8634 431431 (ext 101) tel mobile: +7 905 4309006 pg19.ru
Hello, On Thu, Oct 10, 2024 at 07:30:10PM +0300, Mikhail Mayorov wrote:
I was try configure dynamic peers . But I can't known context of which the filter is executed. I need to identify the neighbor with whom I have a session.
To do this, I was forced to abandon dynamic neighbors and create a separate config for each neighbor. This is certainly not difficult, but very inconvenient. Moreover, the filtering process is also very important for marking routes by different communities. I didn't find any mechanisms to do this with dynamic neighbors. Probably this option is not very popular with the community and it is rarely used. Or maybe I'm just being stupid. :)
Neither of the proposed reasons. It's quite hard to include this feature in the filters properly to not make BIRD slower for the largest IXPs like DE-CIX, or ix.br just by implementing that. Also, it's easy to include _something_ to resolve among different protocols, and there is known demand for such a feature. Yet, implementing it the easy way now induces painful years of maintaining the dirty hack afterwards because people start using it. And I love my future self enough to not do this intentionally. It's enough with all the compromise solutions we have to come up with in the regular development. Considering all of that, there are basically two major options how to get this feature into BIRD: - put a substantial amount of your time into developing it yourself the proper way, while consulting it on the way with the core team - getting enough companies to pay for BIRD Support to let the team grow and as a consequence do this faster Last but not least, we may implement this anyway quite soon, as the MRT+BMP in BIRD 3 (not yet merged into thread-next) now passes basic tests and there is some code review in progress. This, and several bugs reported earlier (thank you all for testing!) is what blocks us from releasing BIRD 3, and nothing in the queue looks like imposing another year of work on us. As soon as BIRD 3 gets released as stable, a substantial part of the team is probably going to switch attention to new features, also made easier by the refactored and reconstructed BIRD's Nest. And you may be completely sure that we are very very tired now from doing all of the invisible stuff on optimizations and performance improvements, so we'll happily pick any opportunity to do something nice, new and shiny. Happy routing! Maria -- Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.
Dear Maria, Thank you for the detailed answer. Your team does a lot for happy routing! I wish you more rich sponsors and talented people involved in development and support! I will wait for the release of BIRD 3. 10.10.2024 23:21, Maria Matejka пишет:
Hello,
On Thu, Oct 10, 2024 at 07:30:10PM +0300, Mikhail Mayorov wrote:
I was try configure dynamic peers . But I can’t known context of which the filter is executed. I need to identify the neighbor with whom I have a session.
To do this, I was forced to abandon dynamic neighbors and create a separate config for each neighbor. This is certainly not difficult, but very inconvenient. Moreover, the filtering process is also very important for marking routes by different communities. I didn’t find any mechanisms to do this with dynamic neighbors. Probably this option is not very popular with the community and it is rarely used. Or maybe I’m just being stupid. :)
Neither of the proposed reasons. It’s quite hard to include this feature in the filters properly to not make BIRD slower for the largest IXPs like DE-CIX, or ix.br just by implementing that.
Also, it’s easy to include /something/ to resolve among different protocols, and there is known demand for such a feature. Yet, implementing it the easy way now induces painful years of maintaining the dirty hack afterwards because people start using it. And I love my future self enough to not do this intentionally. It’s enough with all the compromise solutions we have to come up with in the regular development.
Considering all of that, there are basically two major options how to get this feature into BIRD:
* put a substantial amount of your time into developing it yourself the proper way, while consulting it on the way with the core team * getting enough companies to pay for BIRD Support to let the team grow and as a consequence do this faster
Last but not least, we may implement this anyway quite soon, as the MRT+BMP in BIRD 3 (not yet merged into thread-next) now passes basic tests and there is some code review in progress. This, and several bugs reported earlier (thank you all for testing!) is what blocks us from releasing BIRD 3, and nothing in the queue looks like imposing another year of work on us.
As soon as BIRD 3 gets released as stable, a substantial part of the team is probably going to switch attention to new features, also made easier by the refactored and reconstructed BIRD’s Nest. And you may be completely sure that we are very very tired now from doing all of the invisible stuff on optimizations and performance improvements, so we’ll happily pick any opportunity to do something nice, new and shiny.
Happy routing! Maria
– Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.
-- Regards, Mikhail Mayorov PG19, founder and inspirer B.Bulvarnaya 11, Taganrog, Russia, 347913 tel work: +7 8634 431431 (ext 101) tel mobile: +7 905 4309006 pg19.ru
participants (4)
-
Alexander Zubkov -
Maria Matejka -
Mikhail Mayorov -
Ondrej Zajicek