Dear FRR community members,

I am a user of FRR and I am now using it to build a small-scale experiment network. I ran into a problem regarding the interaction between BFD and BGP in the recent days. My BGP configuration specifies BFD dependencies for BGP neighbors using "neighbor X.X.X.X bfd". And the FRR will create some BFD peer sessions (marked as dynamic in FRR) immediately when it reads the BGP configuration. Then after FRR reads the BFD configuration, it seems that FRR will deregister the previous "dynamic" peer sessions and register those peer sessions (marked as configured) specified in the BFD configuration.

I learn this from the debugging log and such mechanisms work in most cases. But in some situations, it does not work. Specifically, the FRR will have two duplicate BFD peer sessions for the same peer at last. I found that restarting FRR can solve the problem. Yet, I wonder whether there is a more elegant solution.

The example configuration of the problematic peer is as follows:
router #1, with IP address 10.3.0.1
router bgp 1
 no bgp ebgp-requires-policy
 neighbor 10.0.0.2 remote-as 2
 neighbor 10.0.0.2 bfd
 neighbor 10.1.0.2 remote-as 3
 neighbor 10.1.0.2 bfd
 neighbor 10.4.0.1 remote-as 1
 neighbor 10.4.0.1 bfd
 neighbor 10.4.0.1 update-source 10.3.0.1
 neighbor 10.5.0.1 remote-as 1
 neighbor 10.5.0.1 bfd
 neighbor 10.5.0.1 update-source 10.3.0.1
 !
 address-family ipv4 unicast
  network 10.0.0.0/24
  network 10.1.0.0/24
  network 10.3.0.0/24
  network 10.4.0.0/24
  network 10.5.0.0/24
  network 10.12.0.0/24
  network 10.13.0.0/24
  network 10.18.0.0/24
 exit-address-family
exit

bfd
 peer 10.0.0.2
  transmit-interval 100
  receive-interval 100
 exit
 !
 peer 10.1.0.2
  transmit-interval 100
  receive-interval 100
 exit
 !
 peer 10.4.0.1 multihop local-address 10.3.0.1
  transmit-interval 100
  receive-interval 100
 exit
 !
 peer 10.5.0.1 multihop local-address 10.3.0.1
  transmit-interval 100
  receive-interval 100
 exit
 !
exit

router #2, with IP address 10.5.0.1
router bgp 1
 no bgp ebgp-requires-policy
 neighbor 10.3.0.1 remote-as 1
 neighbor 10.3.0.1 bfd
 neighbor 10.3.0.1 update-source 10.5.0.1
exit

bfd
 peer 10.3.0.1 multihop local-address 10.5.0.1
  transmit-interval 100
  receive-interval 100
 exit
 !
exit

The router #1 get two duplicate BFD peer sessions as follows: (the interface s0-eth2 has the IP address 10.3.0.1)
        peer 10.5.0.1 local-address 10.3.0.1 vrf default interface s0-eth2
                ID: 2040029068
                Remote ID: 0
                Active mode
                Status: down
                Downtime: 11 minute(s), 51 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: dynamic
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 300ms
                        Echo receive interval: 50ms
                        Echo transmission interval: disabled
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 1000ms
                        Transmission interval: 1000ms
                        Echo receive interval: disabled


        peer 10.5.0.1 multihop local-address 10.3.0.1 vrf default
                ID: 1516906735
                Remote ID: 2466577291
                Active mode
                Minimum TTL: 254
                Status: up
                Uptime: 11 minute(s), 51 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: configured
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 100ms
                        Transmission interval: 100ms
                        Echo receive interval: 50ms
                        Echo transmission interval: disabled
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 100ms
                        Transmission interval: 100ms
                        Echo receive interval: 50ms


Can anyone give me a hint of a clean solution?

Thanks!

Changrong Wu