operator to prepend bgp path multiple times
Alexander Zubkov
green at qrator.net
Mon Mar 14 17:30:48 CET 2022
Hello,
Wow, I see in the next branch we now have recursive functions
supported. So this function became easier to implement in a config. At
least I do not want to have it out of the box now.
On Sat, Jan 1, 2022 at 8:24 PM Alexander Zubkov <green at qrator.net> wrote:
>
> Hi,
>
> I suggest to add a new operator: prepend_times(P, A, N) - that will
> allow to prepend AS A to path P several times (N). Now we need to use
> some function like this:
>
> function add_prepends(int asn, int num) {
> if num = 1 then {
> bgp_path.prepend(asn);
> } else if num = 2 then {
> bgp_path.prepend(asn);
> bgp_path.prepend(asn);
> } else if num = 3 then {
> ...
> }
>
> Usually the number of prepends is observable, so this function can fit
> most of cases, but with available operator it will be a bit more
> convenient, a little syntactic sugar. But it is not something that is
> hard to live without, of course.
>
> In my patch, I chose to "join" implementations of prepend() and
> prepend_times(). It is questionable, because it requires some
> additional supporting stuff if I understood right. So may be it is
> better to implement it as separate operators.
More information about the Bird-users
mailing list