]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_mpath.c
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / bgpd / bgp_mpath.c
index 6cd6ddd9dd7883c6542d6cd35a9f7c0ff7e12b10..e920d5753ead60b9fc3b7943f5098f481c78901c 100644 (file)
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * BGP Multipath
  * Copyright (C) 2010 Google Inc.
  *
  * This file is part of Quagga
- *
- * Quagga is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * Quagga is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -46,7 +33,7 @@
  * 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;
@@ -54,7 +41,7 @@ int bgp_maximum_paths_set(struct bgp *bgp, afi_t afi, safi_t safi, int peertype,
        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;
@@ -80,7 +67,7 @@ int bgp_maximum_paths_unset(struct bgp *bgp, afi_t afi, safi_t safi,
        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;
@@ -278,8 +265,10 @@ void bgp_mp_list_add(struct list *mp_list, struct bgp_path_info *mpinfo)
 static struct bgp_path_info_mpath *bgp_path_info_mpath_new(void)
 {
        struct bgp_path_info_mpath *new_mpath;
+
        new_mpath = XCALLOC(MTYPE_BGP_MPATH_INFO,
                            sizeof(struct bgp_path_info_mpath));
+
        return new_mpath;
 }
 
@@ -313,8 +302,6 @@ bgp_path_info_mpath_get(struct bgp_path_info *path)
 
        if (!path->mpath) {
                mpath = bgp_path_info_mpath_new();
-               if (!mpath)
-                       return NULL;
                path->mpath = mpath;
                mpath->mp_info = path;
        }
@@ -567,7 +554,7 @@ void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
 
        if (debug)
                zlog_debug(
-                       "%pRN(%s): starting mpath update, newbest %s num candidates %d old-mpath-count %d old-cum-bw u%" PRIu64,
+                       "%pRN(%s): starting mpath update, newbest %s num candidates %d old-mpath-count %d old-cum-bw %" PRIu64,
                        bgp_dest_to_rnode(dest), bgp->name_pretty,
                        new_best ? new_best->peer->host : "NONE",
                        mp_list ? listcount(mp_list) : 0, old_mpath_count,
@@ -750,7 +737,7 @@ void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
 
                if (debug)
                        zlog_debug(
-                               "%pRN(%s): New mpath count (incl newbest) %d mpath-change %s all_paths_lb %d cum_bw u%" PRIu64,
+                               "%pRN(%s): New mpath count (incl newbest) %d mpath-change %s all_paths_lb %d cum_bw %" PRIu64,
                                bgp_dest_to_rnode(dest), bgp->name_pretty,
                                mpath_count, mpath_changed ? "YES" : "NO",
                                all_paths_lb, cum_bw);