summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-01-11 09:36:41 +0100
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-01-11 09:53:56 +0100
commita8474e4a464ade1d7dd942d82cda9e219329ebb4 (patch)
treeb37fc063853d28cbe91f81059dff2c79ec343758
parentMerge pull request #15124 from fdumontet6WIND/large_fds (diff)
downloadfrr-a8474e4a464ade1d7dd942d82cda9e219329ebb4.tar.xz
frr-a8474e4a464ade1d7dd942d82cda9e219329ebb4.zip
bgpd: Prefer routes over eBGP versus eBGP-OAD
If at least one of the candidate routes was received via EBGP, remove from consideration all routes that were received via EBGP-OAD and IBGP. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
-rw-r--r--bgpd/bgp_route.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 2899b94d2..211eeeaf3 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -613,6 +613,8 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
struct attr *newattr, *existattr;
enum bgp_peer_sort new_sort;
enum bgp_peer_sort exist_sort;
+ enum bgp_peer_sub_sort new_sub_sort;
+ enum bgp_peer_sub_sort exist_sub_sort;
uint32_t new_pref;
uint32_t exist_pref;
uint32_t new_med;
@@ -1147,26 +1149,34 @@ int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new,
/* 7. Peer type check. */
new_sort = peer_new->sort;
exist_sort = peer_exist->sort;
+ new_sub_sort = peer_new->sub_sort;
+ exist_sub_sort = peer_exist->sub_sort;
- if (new_sort == BGP_PEER_EBGP
- && (exist_sort == BGP_PEER_IBGP || exist_sort == BGP_PEER_CONFED)) {
+ if (new_sort == BGP_PEER_EBGP &&
+ (exist_sort == BGP_PEER_IBGP || exist_sort == BGP_PEER_CONFED ||
+ exist_sub_sort == BGP_PEER_EBGP_OAD)) {
*reason = bgp_path_selection_peer;
if (debug)
- zlog_debug(
- "%s: %s wins over %s due to eBGP peer > iBGP peer",
- pfx_buf, new_buf, exist_buf);
+ zlog_debug("%s: %s wins over %s due to eBGP peer > %s peer",
+ pfx_buf, new_buf, exist_buf,
+ (exist_sub_sort == BGP_PEER_EBGP_OAD)
+ ? "eBGP-OAD"
+ : "iBGP");
if (!CHECK_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX))
return 1;
peer_sort_ret = 1;
}
- if (exist_sort == BGP_PEER_EBGP
- && (new_sort == BGP_PEER_IBGP || new_sort == BGP_PEER_CONFED)) {
+ if (exist_sort == BGP_PEER_EBGP &&
+ (new_sort == BGP_PEER_IBGP || new_sort == BGP_PEER_CONFED ||
+ new_sub_sort == BGP_PEER_EBGP_OAD)) {
*reason = bgp_path_selection_peer;
if (debug)
- zlog_debug(
- "%s: %s loses to %s due to iBGP peer < eBGP peer",
- pfx_buf, new_buf, exist_buf);
+ zlog_debug("%s: %s loses to %s due to %s peer < eBGP peer",
+ pfx_buf, new_buf, exist_buf,
+ (exist_sub_sort == BGP_PEER_EBGP_OAD)
+ ? "eBGP-OAD"
+ : "iBGP");
if (!CHECK_FLAG(bgp->flags, BGP_FLAG_PEERTYPE_MULTIPATH_RELAX))
return 0;
peer_sort_ret = 0;