BFD is duplicating peers

On first setup BFD is working fine, after restart router it`s get bugged and after restart frr bfdd (restart frr bfdd) it’s get fixed

Version:          VyOS 1.3-beta-202107062242
Release Train:    equuleus

Built by:         autobuild@vyos.net
Built on:         Thu 08 Jul 2021 03:42 UTC
Build UUID:       a03bb23d-a59c-4a22-bcda-2126670bb565
Build Commit ID:  62985f00fb4c3b

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (i440FX + PIIX, 1996)
Hardware S/N:
Hardware UUID:    5bc08e20-165d-4481-94ac-607e30117f81

Copyright:        VyOS maintainers and contributors
set protocols bfd peer 10.0.1.100 interval multiplier '3'
set protocols bfd peer 10.0.1.100 interval receive '50'
set protocols bfd peer 10.0.1.100 interval transmit '100'
set protocols bfd peer 10.0.1.100 multihop
set protocols bfd peer 10.0.1.100 source address '10.0.1.3'
set protocols bfd peer 10.0.3.10 interval multiplier '3'
set protocols bfd peer 10.0.3.10 interval receive '50'
set protocols bfd peer 10.0.3.10 interval transmit '100'
set protocols bfd peer 10.0.3.10 multihop
set protocols bfd peer 10.0.3.10 source address '10.0.3.3'
set protocols bgp 65000 neighbor 10.0.1.100 bfd
set protocols bgp 65000 neighbor 10.0.3.10 bfd

First apply config or restart frr bfdd (expected result)

vyos@r2.servercore.lan:~$ show protocols bfd peers
Session count: 2
SessionId  LocalAddress                             PeerAddress                             Status
=========  ============                             ===========                             ======
1624361981 10.0.3.3                                 10.0.3.10                               down
2347419227 10.0.1.3                                 10.0.1.100                              up

After router reboot

vyos@r2.lan:~$ show protocols bfd peers
Session count: 3
SessionId  LocalAddress                             PeerAddress                             Status
=========  ============                             ===========                             ======
2216489611 10.0.1.3                                 10.0.1.100                              up
417126398  10.0.3.3                                 10.0.3.10                               up
2986967380 10.0.3.3                                 10.0.3.10                               init

SessionId 417126398 and 2986967380 both are still flapping in down, up, init state

On server 10.0.3.10 bird:

Jul 11 13:44:01 storage1 bird[42831]: bfd1: Bad packet from 10.0.3.3 - unknown session id (2824758721)
Jul 11 13:44:01 storage1 bird[42831]: bfd1: Bad packet from 10.0.3.3 - unknown session id (2824758721)
Jul 11 13:44:02 storage1 bird[42831]: 65000-10.0.3.3: State changed to stop
Jul 11 13:44:02 storage1 bird[42831]: 65000-10.0.3.3: State changed to down
Jul 11 13:44:02 storage1 bird[42831]: 65000-10.0.3.3: Starting
Jul 11 13:44:02 storage1 bird[42831]: 65000-10.0.3.3: State changed to start
Jul 11 13:44:02 storage1 bird[42831]: bfd1: Bad packet from 10.0.3.3 - unknown session id (2020787167)
Jul 11 13:44:02 storage1 bird[42831]: bfd1: Bad packet from 10.0.3.3 - unknown session id (2020787167)
Jul 11 13:44:02 storage1 bird[42831]: bfd1: Bad packet from 10.0.3.3 - unknown session id (2020787167)
Jul 11 13:44:02 storage1 bird[42831]: bfd1: Bad packet from 10.0.3.3 - unknown session id (2020787167)

Weirdly this is just happening on 10.0.3.10 but bird configuration is almost same (diffrent AS, neighbor IP etc…). 10.0.3.10 is directly connected to router (router is VM, 3.10 also), 1.100 is connected via wireguard VPN

Bird config:

router id 10.0.3.10;

filter export_bgp {
  if ( (ifname ~ "ens*") ) then {
    if  net != 0.0.0.0/0 then accept;
  }
  reject;
}

# Configure synchronization between BIRD's routing tables and the
# kernel.
protocol kernel {
  learn;          # Learn all alien routes from the kernel
  persist;        # Don't remove routes on bird shutdown
  merge paths on;
  scan time 2;    # Scan kernel routing table every 2 seconds
  import none;
  graceful restart;
  export all;     # Default is export none
}

# Watch interface up/down events.
protocol device {
  debug { states, routes, filters };
  scan time 2;    # Scan interfaces every 2 seconds
}

protocol direct {
   debug all;
   interface "ens*";
}

template bgp vyos {
  local as 65401;
  debug { states, routes, filters, interfaces };
  multihop;
  gateway recursive;
  import all;
  export filter export_bgp;
  add paths on;
  graceful restart;
}

# Peer with route reflector.
protocol bgp '65000-10.0.3.3' from vyos {
  neighbor 10.0.3.3 as 65000;
  source address 10.0.3.10;  # The local address we use for the TCP connection
  bfd on;
}

protocol bfd {
  interface "ens*" {
    multiplier 3;
    interval 50 ms;
    idle tx interval 100 ms;
  };
}

I can confirm it is an FRR behavior when you use multihop for directly connected peers
One peers as dynamic multihop with ttl 254, another configured peer.

r4-1.3# show bfd peers
BFD Peers:
	peer 10.0.3.10 vrf default interface eth2
		ID: 3435890187
		Remote ID: 2594454894
		Active mode
		Status: up
		Uptime: 1 minute(s), 15 second(s)
		Diagnostics: ok
		Remote diagnostics: ok
		Peer Type: dynamic
		Local timers:
			Detect-multiplier: 3
			Receive interval: 300ms
			Transmission interval: 300ms
			Echo transmission interval: 50ms
		Remote timers:
			Detect-multiplier: 3
			Receive interval: 300ms
			Transmission interval: 300ms
			Echo transmission interval: 50ms

	peer 10.0.3.10 multihop local-address 10.0.3.3 vrf default
		ID: 2405952951
		Remote ID: 1757267024
		Active mode
		Minimum TTL: 254
		Status: up
		Uptime: 1 minute(s), 15 second(s)
		Diagnostics: ok
		Remote diagnostics: ok
		Peer Type: configured
		Local timers:
			Detect-multiplier: 3
			Receive interval: 50ms
			Transmission interval: 100ms
			Echo transmission interval: 50ms
		Remote timers:
			Detect-multiplier: 3
			Receive interval: 50ms
			Transmission interval: 100ms
			Echo transmission interval: 50ms

r4-1.3#

Though configured only one

!
router bgp 65000
 no bgp ebgp-requires-policy
 no bgp network import-check
 neighbor 10.0.3.10 remote-as 65001
 neighbor 10.0.3.10 bfd
!
bfd
 peer 10.0.3.10 multihop local-address 10.0.3.3
  transmit-interval 100
  receive-interval 50
 !
!