Page MenuHomeVyOS Platform

bgpd crashes when BGP is added again after deleting a config with VRF route leaking
Open, HighPublicBUG

Description

Commit 1:

set vrf name red table 1201
set interfaces dummy dum11 vrf red
set interfaces dummy dum11 address 10.11.0.1/24
set protocols bgp system-as 65001
set protocols bgp parameters router-id 10.255.0.1
set protocols bgp address-family ipv4-unicast import vrf red
set vrf name red protocols bgp system-as 65001
set vrf name red protocols bgp address-family ipv4-unicast redistribute connected

Commit 2: load a base config without any of it (no BGP, no VRF, no dummy) and commit. Commit 3: only set protocols bgp system-as 65001. Commit 3 reports success, but bgpd dies during it and comes back with a new PID:

BGP[3018]: Received signal 11 at 1795381286 (si_addr 0x20, PC 0x562eb7134ecd); aborting...
BGP[3018]: /usr/lib/frr/bgpd(bgp_config_write_evpn_info+0x3d) [0x562eb7134ecd]
BGP[3018]: /usr/lib/frr/bgpd(bgp_config_write+0x164c) [0x562eb72088cc]

1.5.1: no crash in 3/3 runs. Rolling: crash in 3/3.

The crash also hits:

  • a running VRF session: delete all BGP, add the VRF BGP back (its peer comes up), then add the default BGP: the crash drops the established VRF session (about 8 s outage; 1.5.1 3/3 kept, rolling 0/3);
  • a commit-confirm that is not confirmed and reverts a BGP delete;
  • an L3VPN PE (export vpn/import vpn, no import vrf);
  • load of the saved config after a reset.

No crash when BGP of a VRF is removed while the default instance stays configured.

Cause
FRR "bgpd: Cleanup memory leaks on shutdown" (e2c2e99299, https://github.com/FRRouting/frr/pull/21844, first in 10.7.0). bgp_delete() now frees the EVPN state of the default instance even when the instance is kept hidden because of the leaked VPN routes; re-adding it leaves that state empty and the config writer dereferences it. With the old bm->terminating && condition restored on the same FRR source, 6/6 runs did not crash; unmodified, 6/6 crashed. Upstream fix pending, not merged and not in any 10.7.x release: https://github.com/FRRouting/frr/pull/23851 (the same crash is reported by frr-k8s in https://github.com/FRRouting/frr/issues/23835).

Suggested fix
Carry FRR #23851 (or restore the bm->terminating condition in bgp_delete()) in the VyOS FRR build.

Details

Version
rolling, 1.5
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)