* Record maximum-paths configuration for BGP instance
*/
int bgp_maximum_paths_set(struct bgp *bgp, afi_t afi, safi_t safi, int peertype,
- uint16_t maxpaths, uint16_t options)
+ uint16_t maxpaths, bool same_clusterlen)
{
if (!bgp || (afi >= AFI_MAX) || (safi >= SAFI_MAX))
return -1;
switch (peertype) {
case BGP_PEER_IBGP:
bgp->maxpaths[afi][safi].maxpaths_ibgp = maxpaths;
- bgp->maxpaths[afi][safi].ibgp_flags |= options;
+ bgp->maxpaths[afi][safi].same_clusterlen = same_clusterlen;
break;
case BGP_PEER_EBGP:
bgp->maxpaths[afi][safi].maxpaths_ebgp = maxpaths;
switch (peertype) {
case BGP_PEER_IBGP:
bgp->maxpaths[afi][safi].maxpaths_ibgp = multipath_num;
- bgp->maxpaths[afi][safi].ibgp_flags = 0;
+ bgp->maxpaths[afi][safi].same_clusterlen = false;
break;
case BGP_PEER_EBGP:
bgp->maxpaths[afi][safi].maxpaths_ebgp = multipath_num;
};
/* Functions to support maximum-paths configuration */
-extern int bgp_maximum_paths_set(struct bgp *, afi_t, safi_t, int, uint16_t,
- uint16_t);
+extern int bgp_maximum_paths_set(struct bgp *bgp, afi_t afi, safi_t safi,
+ int peertype, uint16_t maxpaths,
+ bool clusterlen);
extern int bgp_maximum_paths_unset(struct bgp *, afi_t, safi_t, int);
/* Functions used by bgp_best_selection to record current
pair (newm, existm) with the cluster list length. Prefer the
path with smaller cluster list length. */
if (newm == existm) {
- if (peer_sort_lookup(new->peer) == BGP_PEER_IBGP
- && peer_sort_lookup(exist->peer) == BGP_PEER_IBGP
- && (mpath_cfg == NULL
- || CHECK_FLAG(
- mpath_cfg->ibgp_flags,
- BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))) {
+ if (peer_sort_lookup(new->peer) == BGP_PEER_IBGP &&
+ peer_sort_lookup(exist->peer) == BGP_PEER_IBGP &&
+ (mpath_cfg == NULL || mpath_cfg->same_clusterlen)) {
newm = BGP_CLUSTER_LIST_LENGTH(new->attr);
existm = BGP_CLUSTER_LIST_LENGTH(exist->attr);
"Match the cluster length\n")
{
int idx_number = 2;
- return bgp_maxpaths_config_vty(
- vty, BGP_PEER_IBGP, argv[idx_number]->arg,
- BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1);
+ return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP,
+ argv[idx_number]->arg, true, 1);
}
ALIAS_HIDDEN(bgp_maxpaths_ibgp_cluster, bgp_maxpaths_ibgp_cluster_hidden_cmd,
if (bgp->maxpaths[afi][safi].maxpaths_ibgp != multipath_num) {
vty_out(vty, " maximum-paths ibgp %d",
bgp->maxpaths[afi][safi].maxpaths_ibgp);
- if (CHECK_FLAG(bgp->maxpaths[afi][safi].ibgp_flags,
- BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
+ if (bgp->maxpaths[afi][safi].same_clusterlen)
vty_out(vty, " equal-cluster-length");
vty_out(vty, "\n");
}
struct bgp_maxpaths_cfg {
uint16_t maxpaths_ebgp;
uint16_t maxpaths_ibgp;
- uint16_t ibgp_flags;
-#define BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN (1 << 0)
+ bool same_clusterlen;
} maxpaths[AFI_MAX][SAFI_MAX];
_Atomic uint32_t wpkt_quanta; // max # packets to write per i/o cycle