Use presence of route to enable/disable BGP session

bird21 at sensation.net.au bird21 at sensation.net.au
Tue Nov 23 20:20:03 CET 2021


Hi all,

I want to enable a backup BGP session (or perhaps, keep the session up and 
change the import/export filters) only when the main peer goes down 
(default disappears)

Conceptually, I want to do something like this:

if net = 0.0.0.0/0 then {
    if from = x.x.x.x then {  # x.x.x.x = main peer
      disable backup_bgp_session;
    } else {
      enable backup_bgp_session;
    }
}

Obviously this doesn't work, since disable/enable cannot be used in the 
config. The logic is also a little flawed.

I thought about setting a global variable in one filter, and using that 
variable in another to decide what to export to the backup peer, but it 
seems that BIRD only supports local variables?

I can fudge it by using an external script to query "birdc show route 
0.0.0.0/0" to check for the presense of default, and then "birdc enable 
backup_bgp_session" or "birdc disable backup_bgp_session" as appropriate, 
but I'd prefer to be able to do it within BIRD.

Hope someone can give me some hints. Thanks.



More information about the Bird-users mailing list