Check bgp_path.len without some AS
Hi, For some route selection configurations I need to check the bgp_path.len without some AS numbers. I tried something like: bgp_path.delete(AS_1); bgp_path.delete(AS_2); if bgp_path.len < N then ... But doing this I modify permanently the AS path. I've tried using a temp variable, but looks like bird doesn't allow to create bgppath "variables". Any ideas about how this could be achieved? Thanks! Xavier
Hi, Something like this worked for me: delete(bgp_path, XXXX).len < N On Fri, Jan 4, 2019 at 12:19 AM Xavier Trilla <xavier.trilla@clouding.io> wrote:
Hi,
For some route selection configurations I need to check the bgp_path.len without some AS numbers.
I tried something like:
bgp_path.delete(AS_1);
bgp_path.delete(AS_2);
if bgp_path.len < N then …
But doing this I modify permanently the AS path.
I’ve tried using a temp variable, but looks like bird doesn’t allow to create bgppath “variables”.
Any ideas about how this could be achieved?
Thanks!
Xavier
Hi Alexander, That’s interesting I will play with this syntax, although I’m not 100% sure if I will be able to use it (I need to remove two As numbers per bgp_path) but maybe I can work something out. Thanks! Xavier El 4 gen 2019, a les 1:47, Alexander Zubkov <green@qrator.net> va escriure:
Hi,
Something like this worked for me:
delete(bgp_path, XXXX).len < N
On Fri, Jan 4, 2019 at 12:19 AM Xavier Trilla <xavier.trilla@clouding.io> wrote:
Hi,
For some route selection configurations I need to check the bgp_path.len without some AS numbers.
I tried something like:
bgp_path.delete(AS_1);
bgp_path.delete(AS_2);
if bgp_path.len < N then …
But doing this I modify permanently the AS path.
I’ve tried using a temp variable, but looks like bird doesn’t allow to create bgppath “variables”.
Any ideas about how this could be achieved?
Thanks!
Xavier
Hi,
I need to remove two As numbers per bgp_path
You can use a set as a second parameter. From the documentation: "delete(P,A) ... A may also be an integer set". On Fri, Jan 4, 2019 at 3:37 AM Xavier Trilla <xavier.trilla@clouding.io> wrote:
Hi Alexander,
That’s interesting I will play with this syntax, although I’m not 100% sure if I will be able to use it (I need to remove two As numbers per bgp_path) but maybe I can work something out.
Thanks! Xavier
El 4 gen 2019, a les 1:47, Alexander Zubkov <green@qrator.net> va escriure:
Hi,
Something like this worked for me:
delete(bgp_path, XXXX).len < N
On Fri, Jan 4, 2019 at 12:19 AM Xavier Trilla <xavier.trilla@clouding.io> wrote:
Hi,
For some route selection configurations I need to check the bgp_path.len without some AS numbers.
I tried something like:
bgp_path.delete(AS_1);
bgp_path.delete(AS_2);
if bgp_path.len < N then …
But doing this I modify permanently the AS path.
I’ve tried using a temp variable, but looks like bird doesn’t allow to create bgppath “variables”.
Any ideas about how this could be achieved?
Thanks!
Xavier
On Thu, Jan 03, 2019 at 11:10:00PM +0000, Xavier Trilla wrote:
Hi,
For some route selection configurations I need to check the bgp_path.len without some AS numbers.
I tried something like:
bgp_path.delete(AS_1); bgp_path.delete(AS_2);
if bgp_path.len < N then ...
But doing this I modify permanently the AS path.
I've tried using a temp variable, but looks like bird doesn't allow to create bgppath "variables".
Hi Although approach suggested by Alexander Zubkov is applicable, i would note that BIRD allows bgppath variables, see: filter testfilter bgppath pp; { pp = bgp_path; pp = prepend(pp, 65500); pp = prepend(pp, 65500); print pp, " ", pp.len; accept; } The only think that is strange is that operators like delete or prepend cannot be used with 'dot-syntax' (i.e. pp.prepend(X)), but must be used with 'function-syntax' (i.e. pp = prepend(pp, X)). -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
This is exactly what I've been trying to do, most probably I had something wrong with the syntax and that's why it was not working, I'll test it this week. Thanks! Saludos Cordiales, Xavier Trilla P. Clouding.io<https://clouding.io/> ?Un Servidor Cloud con SSDs, redundado y disponible en menos de 30 segundos? ?Pru?balo ahora en Clouding.io<https://clouding.io/>! El 6 gen 2019, a les 1:30, Ondrej Zajicek <santiago@crfreenet.org<mailto:santiago@crfreenet.org>> va escriure: On Thu, Jan 03, 2019 at 11:10:00PM +0000, Xavier Trilla wrote: Hi, For some route selection configurations I need to check the bgp_path.len without some AS numbers. I tried something like: bgp_path.delete(AS_1); bgp_path.delete(AS_2); if bgp_path.len < N then ... But doing this I modify permanently the AS path. I've tried using a temp variable, but looks like bird doesn't allow to create bgppath "variables". Hi Although approach suggested by Alexander Zubkov is applicable, i would note that BIRD allows bgppath variables, see: filter testfilter bgppath pp; { pp = bgp_path; pp = prepend(pp, 65500); pp = prepend(pp, 65500); print pp, " ", pp.len; accept; } The only think that is strange is that operators like delete or prepend cannot be used with 'dot-syntax' (i.e. pp.prepend(X)), but must be used with 'function-syntax' (i.e. pp = prepend(pp, X)). -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org<mailto:santiago@crfreenet.org>) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net<http://wwwkeys.pgp.net>) "To err is human -- to blame it on a computer is even more so."
participants (3)
-
Alexander Zubkov -
Ondrej Zajicek -
Xavier Trilla