You can filter malformed pathes with something like: ! bgp_path ~ [= * 65001 * 65001 * =] But the whole expression grows bigger and bigger. Regex-like matches would be much easier of course.
On Fri, Jan 3, 2020 at 4:24 PM Marcelo Balbinot <[email protected]> wrote: > > > Hi! Thanks for the sugestion... > > It works with this malformed path restriction. > > But I get the feeling of not being perfect! :) > > Regex for AS-PATH filters would be ideal! > > Or maybe a bgp_path.uniq method like bgp_path.last and bgp_path.first > > bgp_path.uniq could remove all repeated ASes. Then the if would be > simple. > > []'s > > --- > Marcelo Balbinot > IP/MPLS Backbone Manager at AS53062 > G G NET Telecomunicações > www.gegnet.com.br > +55 49 3561 4300 > +55 49 9 9923 9347 > INOC 53062*100 > > Em 2020-01-02 17:10, Alexander Zubkov escreveu: > > Hi, > > > > Maybe something like this will work: > > bgp_path ~ [= 65001 * =] && bgp_path ~ [= * 65001 65002 * =] && > > bgp_path ~ [= * 65002 65003 * =] && bgp_path ~ [= * 65003 =] > > It will though pass some malformed pathes like 65001 65999 65001 65002 > > 65003. > > > > On Thu, Jan 2, 2020 at 2:36 PM Marcelo Balbinot <[email protected]> > > wrote: > >> > >> > >> Hello > >> I'm having difficulty using as-path math expressions > >> > >> Look at my case. > >> correct as-path: 65001 65002 65003 > >> > >> I would like to validate if the as-path of the received prefix > >> conforms > >> to the as-path above. But, I would like to allow prepend of all ASes, > >> so: > >> 65001 65001 65002 65003 is valid > >> 65001 65002 65002 65003 is valid > >> 65001 65002 65003 65003 is valid > >> 65001 65001 65002 65002 65002 65003 65003 is valid > >> 65001 65999 65002 65003 is NOT valid > >> > >> The best expression I found was > >> if (bgp_path ~ [= 65001* 65002* 65003* =]) then > >> > >> but it considers the path '65001 65999 65002 65003' to be valid > >> > >> With regex that would be easier, but with bird bgpmask I couldn't > >> solve > >> it. > >> > >> Any suggestion? > >> > >> > >> -- > >> Marcelo Balbinot > >> IP/MPLS Backbone Manager at AS53062 > >> G G NET Telecomunicações > >> www.gegnet.com.br > >> INOC 53062*100 > >>
