router_id or source neighbor in import/export filter for dynamic BGP peers

Mikhail Mayorov mm at tagan.ru
Fri Sep 27 13:48:07 CEST 2024


Hi!

I use dynamic BGP peers in my RR. It's very simple and comfortable. 
import/export filters are same for all dynamic neighbors. How to 
determine a neighbor? Using what variables?

I will plan use filters likes that, but I can't find what I need send to 
function "getneighbortype".....

function getneighbortype(ip neighbor) -> int
   {
   case neighbor {
     1.1.1.1 : return 1; # router with big RIR
     1.1.1.2 : return 3; # router with small RIR
     else: return 0; # unknown router
     }
   }

filter fromclientrr {
   int nt = getneighbortype(*router id / src neighbor*);
   if nt = 0 then reject;
   bgp_large_community.add((0,1,nt));
   accept;
   }

filter toclientrr {
   int nt = getneighbortype(*router id / src neighbor*);
   if net.len = 0 && nt ~ [0, 3] then accept;
   if nt ~ [1] then accept;
   reject;
}

-- 

Regards,
Mikhail Mayorov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20240927/5fc1e6ea/attachment.htm>


More information about the Bird-users mailing list