Question about filter with BGP Communities and BGP Extended Communities

Lucenildo Lins Aquino Júnior lucenildo at nic.br
Fri Oct 28 23:04:01 CEST 2016


Hi All,

I am run bird for lab and I am with a difficult to create a filter with
bgp communities and bgp extended communities.

In my filter at first I check if router need go only for peer ASN, note
that is a export filter. If not only for peer ASN and have
only-community (65001:* or ro:65001:*) drop this route.

I was executed troubleshooting and I could determinate that problem is
in this operation: "(([(65001,*)] ~ bgp_community) || ([(ro,65001,*)] ~
bgp_ext_community))".

I think in this regular expression have a problem, that case create a
fault in my if-clause. I operate my bird in mode router-server, to
simulate a IXP.

In this test my other client announce a router without community
65001:*. and in import filter with ASN 61580 I am accept all routes .

Thanks,

Lucenildo Lins


+++++++

lucenildo at other-client> show route advertising-protocol bgp
187.16.213.253 extensive 168.181.23.0/24

inet.0: 27 destinations, 32 routes (26 active, 0 holddown, 2 hidden)
* 168.181.23.0/24 (1 entry, 1 announced)
 BGP group IX-emulado-v4 type External
     Nexthop: Self
     AS path: [61580] I
     Communities: 61580:5571 65000:11752 65000:14026



+++++++++

define Client_ASN = 65551;

filter bgp_out_as65551
{
        if exp_only(Client_ASN) then
        {
                rm_interal_comm();
                accept;
        }
        if exp_has_only() then
        {
                rm_interal_comm();
                reject;
        }
        rm_interal_comm();
        accept;
}

function exp_has_only()
{
        if !(source = RTS_BGP) then return false;
        if (([(65001,*)] ~ bgp_community) || ([(ro,65001,*)] ~
bgp_ext_community)) then return true;
        return false;
}
function exp_only(int ASNumber)
{
        if ! (source = RTS_BGP) then return false;
        if ASNumber > 65535 then
        {
        if (ro,65001,ASNumber) ~ bgp_ext_community then return true;
        }
        else
        {
        if (((65001,ASNumber) ~ bgp_community) || ((ro,65001,ASNumber) ~
bgp_ext_community)) then return true;
        }
        return false;
}





More information about the Bird-users mailing list