Commit e062883c26 for frr
commit e062883c26469373b18f7e2e28b7f0b7c749ecd6
Author: Enke Chen <enchen@paloaltonetworks.com>
Date: Sat Nov 7 11:30:12 2026 -0800
bgpd: reformat else block in subgroup_default_originate()
Remove unnecessary inner block scope and fix indentation.
Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index b48484c095..7d96c11f11 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -1324,64 +1324,59 @@ rmap_done:;
subgroup_default_withdraw_packet(subgrp);
UNSET_FLAG(subgrp->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE);
}
- } else {
- /* TBD: compare attributes to avoid sending redundant UPDATEs. */
- {
- struct attr attr_copy;
+ } else { /* TBD: compare attributes to avoid sending redundant UPDATEs. */
+ struct attr attr_copy;
- /*
- * Prepend local-AS for EBGP. Make a copy first since
- * new_attr may be interned (shared) when route-map
- * matched, and modifying it in place would corrupt
- * the attribute hash.
- */
- bgp_attr_dup_into(&attr_copy, new_attr);
+ /*
+ * Prepend local-AS for EBGP. Make a copy first since
+ * new_attr may be interned (shared) when route-map
+ * matched, and modifying it in place would corrupt
+ * the attribute hash.
+ */
+ bgp_attr_dup_into(&attr_copy, new_attr);
- /* Apply set-only route-map to attr_copy (not new_attr)
- * to avoid memory leak - attr_copy will be flushed.
- * Only needed when table walk was skipped (new behavior).
- */
- if (rmap && match_rules == 0 &&
- CHECK_FLAG(bgp->flags,
- BGP_FLAG_DEFAULT_ORIGINATE_SETONLY_UNCONDITIONAL)) {
- memset(&p, 0, sizeof(p));
- p.family = afi2family(afi);
- p.prefixlen = 0;
- if (bgp_route_map_setting_only(bgp, rmap, PEER_RMAP_TYPE_DEFAULT,
- &p, &attr_copy) == RMAP_DENYMATCH) {
- /* Route-map denied - withdraw default if previously sent. */
- bgp_attr_flush(&attr_copy);
- aspath_unintern(&aspath);
- if (CHECK_FLAG(subgrp->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) {
- subgroup_default_withdraw_packet(subgrp);
- UNSET_FLAG(subgrp->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE);
- }
- return;
+ /* Apply set-only route-map to attr_copy (not new_attr)
+ * to avoid memory leak - attr_copy will be flushed.
+ * Only needed when table walk was skipped (new behavior).
+ */
+ if (rmap && match_rules == 0 &&
+ CHECK_FLAG(bgp->flags, BGP_FLAG_DEFAULT_ORIGINATE_SETONLY_UNCONDITIONAL)) {
+ memset(&p, 0, sizeof(p));
+ p.family = afi2family(afi);
+ p.prefixlen = 0;
+ if (bgp_route_map_setting_only(bgp, rmap, PEER_RMAP_TYPE_DEFAULT, &p,
+ &attr_copy) == RMAP_DENYMATCH) {
+ /* Route-map denied - withdraw default if previously sent. */
+ bgp_attr_flush(&attr_copy);
+ aspath_unintern(&aspath);
+ if (CHECK_FLAG(subgrp->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) {
+ subgroup_default_withdraw_packet(subgrp);
+ UNSET_FLAG(subgrp->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE);
}
- /* Clear reflection attributes - default-originate
- * is self-originated, not reflected.
- */
- bgp_attr_clear_reflection(&attr_copy);
+ return;
}
-
- /* Add gshut community after set-only so route-map
- * cannot overwrite the shutdown signal.
+ /* Clear reflection attributes - default-originate
+ * is self-originated, not reflected.
*/
- if (bgp_in_graceful_shutdown(bgp) ||
- (CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_SHUTDOWN)))
- bgp_attr_add_gshut_community(&attr_copy);
+ bgp_attr_clear_reflection(&attr_copy);
+ }
- /* Handle "bgp max-med" */
- if (bgp->maxmed_active)
- bgp_attr_set_med(&attr_copy, bgp->maxmed_value);
+ /* Add gshut community after set-only so route-map
+ * cannot overwrite the shutdown signal.
+ */
+ if (bgp_in_graceful_shutdown(bgp) ||
+ CHECK_FLAG(peer->flags, PEER_FLAG_GRACEFUL_SHUTDOWN))
+ bgp_attr_add_gshut_community(&attr_copy);
- bgp_peer_prepend_local_as(peer, afi, safi, &attr_copy);
+ /* Handle "bgp max-med" */
+ if (bgp->maxmed_active)
+ bgp_attr_set_med(&attr_copy, bgp->maxmed_value);
- SET_FLAG(subgrp->sflags,
- SUBGRP_STATUS_DEFAULT_ORIGINATE);
- subgroup_default_update_packet(subgrp, &attr_copy, from);
- bgp_attr_flush(&attr_copy);
- }
+ bgp_peer_prepend_local_as(peer, afi, safi, &attr_copy);
+
+ SET_FLAG(subgrp->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE);
+ subgroup_default_update_packet(subgrp, &attr_copy, from);
+ bgp_attr_flush(&attr_copy);
}
aspath_unintern(&aspath);