show route filter & static routes

Dan Rimal danrimal at gmail.com
Sun May 12 18:39:55 CEST 2013


Hello,

I've found confused behaviour "show route filter". I have basic test 
setup with some filters, see attachment.

With this setup, i've got this result:

bird> show route export test
1.0.0.0/20         blackhole [static_bgp 18:22] * (1200)
bird> show route filter upstream_out
bird>

and error log shows:
12-05-2013 18:23:24 <ERR> filters, line 28: Prefix or path expected


When i commented out line "if bgp_path.len > 64 then return false;" in 
"function rt_export_ebgp()", i've got expected result:

bird> show route export test
1.0.0.0/20         blackhole [static_bgp 18:22] * (1200)
bird>
bird> show route filter upstream_out
1.0.0.0/20         blackhole [static_bgp 18:22] * (1200)


Unexpected behaviour (for me) arrive when filter contain whatever with 
BGP PATH and exported routes are static, without bgp path. For example, 
if i add "bgp_path.prepend(65001);" to "filter usptream_out", i've got 
same bad result again:

bird> show route export test
1.0.0.0/20         blackhole [static_bgp 18:22] * (1200)
bird> show route filter upstream_out
bird>


Is this correct behaviour?

Thank you,

Regards,

Daniel





-------------- next part --------------
log "/var/log/bgp.log" all;

router id 1.0.0.1;

function net_martian()
{
    return net ~ [ 0.0.0.0/8, 10.0.0.0/8+, 100.64.0.0/10+, 127.0.0.0/8+, 169.254.0.0/16+, 172.16.0.0/12+,
    192.0.0.0/24+, 192.0.2.0/24+, 192.168.0.0/16+, 198.18.0.0/15+, 198.51.100.0/24+, 203.0.113.0/24+, 224.0.0.0/3+ ];
}

function net_local_bgp()
{
    return net ~ [ 1.0.0.0/20 ];
}

function rt_import_ebgp()
{
    if net_martian() || net_local_bgp() then return false;
    if bgp_path.len > 64 then return false;
    return true;
}

function rt_export_ebgp()
{
    if net_martian() then return false;
    if bgp_path.len > 64 then return false;
    return true;
}


filter upstream_in
{
    if ( rt_import_ebgp() ) then {
        bgp_local_pref=600;
        accept;
    }
    else {
        reject;
    }
}

filter upstream_out
{
    if ( rt_export_ebgp() ) && ( net_local_bgp() ) then {
        accept;
    }
    else {
        reject;
    }
}


protocol kernel {
        scan time 60;           # Scan kernel routing table every 60 seconds
        import all;             # Default is import all
        export all;             # Default is export none
}


protocol device {
        scan time 20;
}


protocol static static_bgp {
        preference 1200;
        route 1.0.0.0/20 drop;
}

template bgp PEERS {
        debug {events, states};
        local as 65001;
        hold time 180;
        startup hold time 90;
        connect retry time 30;
        keepalive time 30;
        start delay time 5;
        error wait time 60, 300;
        error forget time 300;
        gateway direct;
        path metric 1;
        default bgp_med 0;
        default bgp_local_pref 100;
}

protocol bgp test from PEERS {
        neighbor 172.17.1.241 as 65000;
        import filter upstream_in;
        export filter upstream_out;
}


More information about the Bird-users mailing list