diff options
| author | Alex Kudentsov <43482574+alexk37@users.noreply.github.com> | 2026-10-18 16:29:40 +0700 |
|---|---|---|
| committer | Alex Kudentsov <43482574+alexk37@users.noreply.github.com> | 2026-10-19 00:24:53 +0700 |
| commit | aa35ee2b6416e7e3cae29dfe5cedf5ffce077496 (patch) | |
| tree | f6c81d3701ba0e79aeadeb5a1a0c62ad905e7b5c /data/templates | |
| parent | ca3da19e47f0b3db2db0c3bdf239bb761618d557 (diff) | |
| download | vyos-1x-aa35ee2b6416e7e3cae29dfe5cedf5ffce077496.tar.gz vyos-1x-aa35ee2b6416e7e3cae29dfe5cedf5ffce077496.zip | |
bgp: T9450: do not re-send a peer-group member's inherited activate
FRR only prints a peer-group member's own "neighbor X activate" when
the member's AFI/SAFI activation state differs from its peer-group's
(bgp_config_write_peer_af(), bgpd/bgp_vty.c). A member bound to a
group that already carries the same address-family is activated for
it automatically at bind time (peer_group_bind(), bgpd/bgpd.c), so
the member's own line was never needed there and frr-reload was
re-applying it on every reload.
Render the member's own "activate" only when its peer-group does not
already carry the same address-family. Applies to both
"neighbor ... peer-group" and "neighbor ... interface peer-group"
members. A member whose group drops the address-family later still
gets its own "activate" back, matching FRR deactivating it
(peer_deactivate()).
When a peer-group gains an address family that some members already
carry, frr-reload deletes those members' own "activate" before it adds
the group's, so each such member is deactivated and reactivated once
(one session reset, or with dynamic capability one withdraw and
re-advertise of that address family) at that commit. Before this
change that commit did not reset them. The end state is correct and
per-AF overrides survive the reset; this is a one-time cost at the
commit that changes the group's address-family, not a lasting
functional loss.
Diffstat (limited to 'data/templates')
| -rw-r--r-- | data/templates/frr/bgpd.frr.j2 | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/data/templates/frr/bgpd.frr.j2 b/data/templates/frr/bgpd.frr.j2 index f84f10126..50a051729 100644 --- a/data/templates/frr/bgpd.frr.j2 +++ b/data/templates/frr/bgpd.frr.j2 @@ -7,7 +7,7 @@ {% endif %} {### MACRO definition for recurring peer patter, this can be either fed by a ###} {### peer-group or an individual BGP neighbor ###} -{% macro bgp_neighbor(neighbor, config, peer_group=false) %} +{% macro bgp_neighbor(neighbor, config, peer_group=false, groups=none) %} {# BGP order of peer-group and remote-as placement must be honored #} {% if peer_group == true %} neighbor {{ neighbor }} peer-group @@ -263,7 +263,32 @@ {% if afi_config.disable_send_community.standard is vyos_defined %} no neighbor {{ neighbor }} send-community standard {% endif %} +{% set member_pg = none %} +{% if peer_group == false %} +{% if config.peer_group is vyos_defined %} +{% set member_pg = config.peer_group %} +{% elif config.interface.peer_group is vyos_defined %} +{% set member_pg = config.interface.peer_group %} +{% elif config.interface.v6only.peer_group is vyos_defined %} +{% set member_pg = config.interface.v6only.peer_group %} +{% endif %} +{% endif %} +{# T9450: FRR (bgp_config_write_peer_af(), bgpd/bgp_vty.c) prints a peer-group #} +{# member's own "activate" only when the member's activation state for this #} +{# AFI/SAFI differs from its peer-group's: peer_group_active(peer) true and #} +{# g_peer->afc[afi][safi] == peer->afc[afi][safi] (both on, the case here - a #} +{# member with an address-family stanza is always "activate"d) prints nothing, #} +{# because the member inherits activation from the group. Skip the member's own #} +{# line exactly then - when its peer-group also has this AFI/SAFI configured, #} +{# which makes the group render its own "activate" in the peer-group's block. #} +{% if member_pg is vyos_defined and groups[member_pg].address_family[afi] is vyos_defined %} +{% set skip_activate = true %} +{% else %} +{% set skip_activate = false %} +{% endif %} +{% if not skip_activate %} neighbor {{ neighbor }} activate +{% endif %} exit-address-family ! {# j2lint: disable=jinja-statements-delimeter #} @@ -561,7 +586,7 @@ router bgp {{ system_as }} {{ 'vrf ' ~ vrf if vrf is vyos_defined }} {{ 'as-nota ! {% if neighbor is vyos_defined %} {% for peer, config in neighbor.items() %} -{{ bgp_neighbor(peer, config) }} +{{ bgp_neighbor(peer, config, false, peer_group) }} {# j2lint: disable=jinja-statements-delimeter #} {%- endfor %} {% endif %} |
