bgp_path.first
Ondrej Zajicek
santiago at crfreenet.org
Tue Aug 22 13:35:45 CEST 2017
On Mon, Aug 21, 2017 at 08:29:25PM +0300, nixx wrote:
> Hello.
>
> function rt_export()
> {
> if proto = "static_bgp" then return true;
> if source != RTS_BGP then return false;
> return bgp_path.first ~ [ downlink1AS, downlink2AS ];
> }
>
> But this incorrectly works - bird trying to export my full-view to uplink.
>
> Then, when i changed to
>
> if ( bgp_path.len = 2 ) && ( bgp_path.first = myAS ) then return bgp_path ~
> [ downlink1AS, downlink2AS ];
>
> ...it works.
>
> What i'm (or my bird) doing wrong? Or maybe this example is not correct?
Hello
You are right, the example is not correct. Counterintuitively, the local
AS number is prepended first and after that the filter is applied.
Therefore, as Alarig Le Lay mentioned, bgp_path.first is always the local
AS number in EBGP export filter. We will change this in BIRD 2.0.
But i am not sure why it is trying to export full-view to uplink, it should
export none (unless one of downlinkAS is the same as myAS).
You could try to use BGP path matching using BGP mask, like:
return (bgp_path ~ [= myAS downlink1AS * =]) || (bgp_path ~ [= myAS downlink2AS * =]);
--
Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago at 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."
More information about the Bird-users
mailing list