operator to prepend bgp path multiple times

Alexander Zubkov green at qrator.net
Sat Jan 1 20:24:00 CET 2022


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bird-prepend-times.patch
Type: text/x-patch
Size: 4173 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20220101/6001cbf8/attachment.bin>


More information about the Bird-users mailing list