Issue with unsigned integer LOCAL_PREF

Alexandre Corso alexandre at acorso.fr
Wed Nov 25 11:43:29 CET 2020


Hello Bird team, 
 
Thank you for the great tool BIRD. I would like to open an issue (bird v2.0.7) about the local_pref.
 
Today we hit an issue with one filter. 
if ! is_geo_region_local() then {
    bgp_local_pref = bgp_local_pref - 200;
    # If not defined, MED has a type of void instead of int
    if defined(bgp_med) then {
            bgp_med = bgp_med + 50;
    } else {
            bgp_med = 50;
    }
}
 
When some prefixes with the local_pref was below 200 (for example 100), the value overflow:
localpref (unsigned integer 4^32) 100 - 200 = -100 = 4 ^ 32 - 100 = 4294967296 - 100 = 4294967196
 
We had the prefixes with this value 4294967196
X.X.X.X/32       unicast [ipv4_rr01 07:51:49.603 from 100.100.254.137] * (100/84285) [AS65030?]
        via 100.99.0.100 on eth1.666
        Type: BGP univ
        BGP.origin: Incomplete
        BGP.as_path: 64619 65030
        BGP.next_hop: y.y.y.y
        BGP.med: 50
        BGP.local_pref: 4294967196
        BGP.community: (35280,1040) (35280,2070) (35280,3110)
        BGP.originator_id: y.y.y.y
        BGP.cluster_list: 0.0.0.30
 
We had an exception to check the value of local_pref (on the filter) but can we have the something on the code, not to overflow the local_pref, for example SET to 0 if the value overflow?
 
Our filter looks like this now
    if bgp_local_pref > 200 then
        bgp_local_pref = bgp_local_pref - 200;
    else {
        bgp_local_pref = 0;
    }
 
Best
 
Alexandre Corso
alexandre at ac <mailto:alexandre at acorus.net>orso.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20201125/3ea03869/attachment.htm>


More information about the Bird-users mailing list