Issue: An excessive number of BGP AS-path entries were seen when configured a route-map including set as-path prepend operation with default-originate parameter. This gradually makes the BGP daemon consumes all available memory until the system terminates the process, after which its automatically restarted by watchfrr. This is noticed with large number of BGP updates.
Steps to reproduce the issue:
Configuration(vyos01):
set policy route-map default-origin rule 10 action 'permit' set policy route-map default-origin rule 10 set as-path prepend '65006 65006' set protocols bgp address-family ipv4-unicast network 192.168.4.0/24 set protocols bgp neighbor 192.168.0.1 address-family ipv4-unicast set protocols bgp neighbor 192.168.0.1 remote-as '65002' set protocols bgp neighbor 192.168.1.3 address-family ipv4-unicast default-originate route-map 'default-origin' set protocols bgp neighbor 192.168.1.3 address-family ipv4-unicast soft-reconfiguration inbound set protocols bgp neighbor 192.168.1.3 remote-as '65005' set protocols bgp system-as '65006'
Use this article link to configure a second router to stimulate large routing table:
The output of as-path count when the default-originate route-map option is configured, this growth will persist even after all BGP updates have been fully processed and the entries doubles the number:
Every 2.0s: sudo vtysh -c 'show memory' | grep aspath vyos01: Mon Oct 20 15:41:54 2025 BGP aspath : 2110099 40 84413400 2110100 84413440 BGP aspath seg : 2110098 24 50645584 2110099 50645608 BGP aspath segment data : 2110098 variable 50642480 2110100 50642528 BGP aspath str : 2110099 variable 84407800 2110100 84407840 vyos@vyos01:~$ show ip bgp summary IPv4 Unicast Summary (VRF default): BGP router identifier 192.168.1.3, local AS number 65006 vrf-id 0 BGP table version 658793 RIB entries 192044, using 18 MiB of memory Peers 2, using 40 KiB of memory Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc 192.168.0.1 4 65002 363 377 658793 0 0 00:09:33 191824 191827 N/A 192.168.1.3 4 65005 501 524 658793 0 0 07:09:52 0 191828 N/A
When the default-originate option is not configured, these numbers stabilize immediately after the router receives all BGP prefixes and remain relatively constant with same update.