Hi, I can guess that when you export to BGP, it prepends your AS before the filter, so your check for "bgp_path.len = 0" turns false.
On Sun, Jun 6, 2021 at 5:31 AM 智慧雨泽 <[email protected]> wrote: > > Hi,The function i wrote correctly returns net. > > bird> show route 2602:feda:ab2::/48 where bgp_export_all() > Table master6: > 2602:feda:ab2::/48 unicast [LL_IX 02:19:31.236] * (100) [i] > via 2602:feda:ab2::1 on ll-ix > > But it could be export. > bird> show route export TOHU_IX for 2602:feda:ab2::/48 > bird> > > I think that should be accept > export filter { > if bgp_export_all() then accept; > # if (roa_check(r6, net, bgp_path.last_nonaggregated) ~ [ROA_INVALID, > ROA_UNKNOWN]) then reject; > # if is_bogon_asn() then reject; > # if is_bogon_prefix() then reject; > # accept; > }; > }; > } > Why is it not exported? > The full configuration is. > > protocol bgp TOHU_IX { > local as LOCAL_ASN; > description "tohu ix IX-VPS BGP"; > direct; > source address 2602:feda:ab5::1; > neighbor 2602:feda:ab6::1%'tuhu-ix' as 141011; > ipv6 { > next hop self; > import filter { > if is_bogon_asn() then reject; > if is_bogon_prefix() then reject; > if (roa_check(r6, net, bgp_path.last_nonaggregated) = ROA_VALID) then reject; > accept; > }; > export filter { > if bgp_export_all() then accept; > # if (roa_check(r6, net, bgp_path.last_nonaggregated) ~ [ROA_INVALID, > ROA_UNKNOWN]) then reject; > # if is_bogon_asn() then reject; > # if is_bogon_prefix() then reject; > # accept; > }; > }; > } > > > function bgp_export() { > if net !~ OUR_PREFIXES then return false; > if is_bogon_asn() then return false; > if is_bogon_prefix() then return false; > if net_len_too_long() then { > # print "net ", net, " prefix too long"; > return false; > } > if proto = "BGP_Prefix" then return true; > if proto = "LL_IX" then{ > if bgp_path.len = 0 then{ > return true; > } > } > if proto = "TOHU_IX" then{ > if bgp_path.len = 0 then{ > return true; > } > } > return false; > } > > > function bgp_export_all() { > if bgp_export() then { > return true; > } > > if source != RTS_BGP then{ > return false; > } > if is_bogon_asn() then return false; > if is_bogon_prefix() then return false; > return true; > } > > > > > >
