changing bgp_med attributes cause route been filited

Brandon Zhi Brandon at huize.asia
Thu Jul 20 14:25:24 CEST 2023


Hi all,

I was doing research about selecting the best route on multiple nodes based
on bgp_med attributes.


function ibgp_import(int bgp_med_ping; int extra_bgp_med){
            add_type("ibgp");
            if is_bogon_asn() then {
                print "is bogon asn", net, " for ASN ", bgp_path.last;
                return false;
            }
            if is_bogon_prefix() then {
                print "is bogon prefix", net, " for ASN ", bgp_path.last;
                return false;
            }

            if (LOCAL_ASN, 47, NODE_ID) ~ bgp_large_community then {
            reject;
            }

            if bgp_large_community ~ [(LOCAL_ASN, 2, 100)] then preference
= 115;
            additional_import_action();
            bgp_med = bgp_med + bgp_med_ping + bgp_med_ping;
                return true;
}

My idea is to add bgp_med value between each node based on ping, and then
bird will select the route which has the lowest bgp_med value (which is the
total ping delay)

But some routes will be filled, which i don't want it.

I found that the code " bgp_med = bgp_med + bgp_med_ping + bgp_med_ping;"
will cause some routes to be filtered.

Can someone tell me why? I only want to modify bgp_med and don't want my
routes to be filtered.

Best,
*Brandon Zhi*
HUIZE LTD
www.huize.asia  <https://huize.asia/>| www.ixp.su | Twitter

This e-mail and any attachments or any reproduction of this e-mail in
whatever manner are confidential and for the use of the addressee(s) only.
HUIZE LTD can’t take any liability and guarantee of the text of the email
message and virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20230720/4670095c/attachment.htm>


More information about the Bird-users mailing list