Commit db2c10acc9 for frr

commit db2c10acc9d0582335831b89adc897fffdf7a37a
Author: Harini Nattamai Subramanian <hnattamaisub@nvidia.com>
Date:   Mon Nov 16 02:31:45 2026 -0800

    bgpd: preserve equal-cluster-length in maxpaths config

    Root cause:
    The maxpaths config writers only emitted the iBGP command when maxpaths_ibgp
    differed from the default ECMP limit. When equal-cluster-length was enabled
    at the default limit, its flag was set in memory, but the command was omitted
    from running-config.

    Fix:
    Include same_clusterlen in the emit condition for the running-config, JSON,
    and VRF detail writers so the iBGP maxpaths entry is shown whenever the option
    is enabled.

    Logs: (With fix)
    r1# configure terminal
    r1(config)# router bgp 65001
    r1(config-router)# address-family ipv4 unicast
    r1(config-router-af)#  maximum-paths ibgp 64 equal-cluster-length
    r1(config-router-af)# exit-address-family
    r1(config-router)# end
    r1#  show running-config
    Building configuration...

    Current configuration:
    !
    frr version 10.9.0-dev-MyOwnFRRVersion
    frr defaults traditional
    hostname r1
    log commands
    service integrated-vtysh-config
    !
    interface r1-eth0
     ip address 192.16.2.1/24
    exit
    !
    interface r1-eth1
     ip address 192.16.3.1/24
    exit
    !
    interface r1-eth2
     ip address 192.16.4.1/24
    exit
    !
    router bgp 65001
     bgp router-id 1.1.1.1
     no bgp ebgp-requires-policy
     timers bgp 1 10
     neighbor 192.16.2.2 remote-as 65024
     neighbor 192.16.3.3 remote-as 65003
     neighbor 192.16.4.4 remote-as 65024
     !
     address-family ipv4 unicast
      maximum-paths ibgp 64 equal-cluster-length
     exit-address-family
    exit
    !

    Without fix:
    r1#  configure terminal
    r1(config)#   router bgp 65001
    r1(config-router)#    address-family ipv4 unicast
    r1(config-router-af)#     maximum-paths ibgp 64 equal-cluster-length
    r1(config-router-af)#    exit-address-family
    r1(config-router)#   end
    r1#   show running-config
    Building configuration...

    Current configuration:
    !
    frr version 10.9.0-dev-MyOwnFRRVersion
    frr defaults traditional
    hostname r1
    log commands
    service integrated-vtysh-config
    !
    interface r1-eth0
     ip address 192.16.2.1/24
    exit
    !
    interface r1-eth1
     ip address 192.16.3.1/24
    exit
    !
    interface r1-eth2
     ip address 192.16.4.1/24
    exit
    !
    router bgp 65001
     bgp router-id 1.1.1.1
     no bgp ebgp-requires-policy
     timers bgp 1 10
     neighbor 192.16.2.2 remote-as 65024
     neighbor 192.16.3.3 remote-as 65003
     neighbor 192.16.4.4 remote-as 65024
    exit

    Signed-off-by: Harini Nattamai Subramanian <hnattamaisub@nvidia.com>

diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 3869cb0ff3..2f4d360f19 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -3010,7 +3010,8 @@ static void bgp_config_write_maxpaths(struct vty *vty, struct bgp *bgp,
 			bgp->maxpaths[afi][safi].maxpaths_ebgp);
 	}

-	if (bgp->maxpaths[afi][safi].maxpaths_ibgp != multipath_num) {
+	if (bgp->maxpaths[afi][safi].maxpaths_ibgp != multipath_num ||
+	    bgp->maxpaths[afi][safi].same_clusterlen) {
 		vty_out(vty, "  maximum-paths ibgp %d",
 			bgp->maxpaths[afi][safi].maxpaths_ibgp);
 		if (bgp->maxpaths[afi][safi].same_clusterlen)
@@ -12950,7 +12951,8 @@ static void print_bgp_vrfs(struct bgp *bgp, struct vty *vty, json_object *json,
 			if (bgp->maxpaths[afi][safi].maxpaths_ebgp != multipath_num)
 				json_object_int_add(json_addr, "ebgpMaximumPaths",
 						    bgp->maxpaths[afi][safi].maxpaths_ebgp);
-			if (bgp->maxpaths[afi][safi].maxpaths_ibgp != multipath_num) {
+			if (bgp->maxpaths[afi][safi].maxpaths_ibgp != multipath_num ||
+			    bgp->maxpaths[afi][safi].same_clusterlen) {
 				json_object_int_add(json_addr, "ibgpMaximumPaths",
 						    bgp->maxpaths[afi][safi].maxpaths_ibgp);
 				json_object_boolean_add(json_addr, "equalClusterLength",
@@ -13198,7 +13200,8 @@ static int show_bgp_vrfs_detail_common(struct vty *vty, struct bgp *bgp,
 					vty_out(vty, "   EBGP Maximumpaths %d\n",
 						bgp->maxpaths[afi][safi].maxpaths_ebgp);
 				}
-				if (bgp->maxpaths[afi][safi].maxpaths_ibgp != multipath_num) {
+				if (bgp->maxpaths[afi][safi].maxpaths_ibgp != multipath_num ||
+				    bgp->maxpaths[afi][safi].same_clusterlen) {
 					vty_out(vty, "   IBGP Maximumpaths %d\n",
 						bgp->maxpaths[afi][safi].maxpaths_ibgp);
 					if (bgp->maxpaths[afi][safi].same_clusterlen)