Import filter on 2nd ASN in AS path?

Robert Scheck bird at robert-scheck.de
Thu Mar 28 00:25:29 CET 2019


Hello Maria,
hello Alexander,

first of all, thank you very much for your suggestions.

On Tue, 26 Mar 2019, Maria Matějka wrote:
> Did you try using BGP path mask? Like
> if (bgp.path ~ [= ? bogon bogon * =]) …

I didn't try this before, but I'm now also not sure how I could get my int
set (BOGON_ASNS) properly into your example, because just

if (bgp_path ~ [= ? BOGON_ASNS * =]) then { …

simply leads to "Error resolving path mask template: value not an integer",
where as the error message itself is indeed true.

> On March 26, 2019 10:34:39 AM GMT+01:00, Alexander Zubkov <green at qrator.net> wrote:
> >You can try to delete AS-TRANSIT from the path and get first.
> >Something like (this is just a sketch):
> >
> >delete(bgp_path, AS-TRANSIT).first ~ BOGON_ASNS

While

if (delete(bgp_path, [ AS-TRANSIT1, AS-TRANSIT2 ]).first ~ BOGON_ASNS) then { …

seems to work at the first glance, it also filters all prefixes originating
from AS-TRANSIT1/2, so delete() seems to simply return 0 if bgp_path.len is
1 (rather "undefined" or failing). It starts to work properly when using

if (bgp_path.len >= 2 && delete(bgp_path, [ AS-TRANSIT1, AS-TRANSIT2 ]).first ~ BOGON_ASNS) then { …

but it still leaves me with a list of transit ASNs to be fed (thus Maria's
suggestion seems to be a more maintenance-friendly approach - if int sets
could be used somehow).


Regards,
  Robert


More information about the Bird-users mailing list