bgpd: clear several parameters in subgroup_announce_check() - #20884
Merged
Conversation
Greptile SummaryThis PR clears local-only and protocol-specific BGP attributes in outbound announcements to optimize the attribute table and reduce duplicate updates to neighbors. Key changes:
Timing: All attribute clearing happens after the outbound route-map is applied (lines 2841-2846), allowing route-map match clauses like "match tag" or "match local-preference" to operate on original values as documented in the added comment. Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[subgroup_announce_check entry] --> B{EBGP peer?}
B -->|Yes| C[Clear MED if conditions met<br/>NEW: attr->med = 0]
B -->|No| D[Skip MED clearing]
C --> E[Apply outbound route-map<br/>lines 2841-2846]
D --> E
E --> F{AIGP exists?}
F -->|Yes| G{AIGP_TRANSMIT_ALLOWED?}
F -->|No| I[Continue processing]
G -->|Yes| H[Adjust AIGP metric if nh_reset]
G -->|No| J[NEW: Clear AIGP<br/>attr->aigp_metric = 0<br/>bgp_attr_unset]
H --> I
J --> I
I --> K[NEW: Clear local attributes<br/>tag, weight, distance = 0]
K --> L{EBGP peer?}
L -->|Yes| M[NEW: Clear local_pref<br/>attr->local_pref = 0]
L -->|No| N[Keep local_pref]
M --> O[Return true]
N --> O
Last reviewed commit: bc5801f |
enkechen-panw
force-pushed
the
bgp-outbound-attr
branch
from
February 20, 2026 08:05
bc5801f to
21231f7
Compare
ton31337
reviewed
Feb 21, 2026
Clear tag, weight and distance in the outbound attribute. Also clear MED, aigp, and local-preference when appropriate. This helps avoid unnecessary attributes in the outbound attribute table, and also helps reduce duplicate updates to neighbors. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
Adjust the topotests bgp_vpnv4_noretain. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
enkechen-panw
force-pushed
the
bgp-outbound-attr
branch
from
February 22, 2026 02:08
21231f7 to
bbe2377
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clear tag, weight and distance in the outbound attribute. Also clear MED, aigp, and local-preference when appropriate.
This helps avoid unnecessary attributes in the outbound attribute table, and also helps reduce duplicate updates to neighbors.