mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-12 15:17:51 +00:00
bgpd: Add bgp_check_selected() helper for abstraction
Just check if the path is selected to be advertised: best path or addpath capable. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
parent
a08e5c529c
commit
5cb526136a
@ -124,12 +124,8 @@ static void bgp_conditional_adv_routes(struct peer *peer, afi_t afi,
|
|||||||
if (ret != RMAP_PERMITMATCH)
|
if (ret != RMAP_PERMITMATCH)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)
|
if (bgp_check_selected(pi, peer, addpath_capable, afi,
|
||||||
|| (addpath_capable
|
safi)) {
|
||||||
&& bgp_addpath_tx_path(
|
|
||||||
peer->addpath_type[afi][safi],
|
|
||||||
pi))) {
|
|
||||||
|
|
||||||
/* Skip route-map checks in
|
/* Skip route-map checks in
|
||||||
* subgroup_announce_check while executing from
|
* subgroup_announce_check while executing from
|
||||||
* the conditional advertise scanner process.
|
* the conditional advertise scanner process.
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include "bgpd/bgp_debug.h"
|
#include "bgpd/bgp_debug.h"
|
||||||
#include "bgpd/bgp_errors.h"
|
#include "bgpd/bgp_errors.h"
|
||||||
#include "bgpd/bgp_fsm.h"
|
#include "bgpd/bgp_fsm.h"
|
||||||
|
#include "bgpd/bgp_addpath.h"
|
||||||
#include "bgpd/bgp_advertise.h"
|
#include "bgpd/bgp_advertise.h"
|
||||||
#include "bgpd/bgp_packet.h"
|
#include "bgpd/bgp_packet.h"
|
||||||
#include "bgpd/bgp_updgrp.h"
|
#include "bgpd/bgp_updgrp.h"
|
||||||
@ -1931,3 +1932,11 @@ bool bgp_addpath_encode_tx(struct peer *peer, afi_t afi, safi_t safi)
|
|||||||
&& CHECK_FLAG(peer->af_cap[afi][safi],
|
&& CHECK_FLAG(peer->af_cap[afi][safi],
|
||||||
PEER_CAP_ADDPATH_AF_RX_RCV));
|
PEER_CAP_ADDPATH_AF_RX_RCV));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bgp_check_selected(struct bgp_path_info *bpi, struct peer *peer,
|
||||||
|
bool addpath_capable, afi_t afi, safi_t safi)
|
||||||
|
{
|
||||||
|
return (CHECK_FLAG(bpi->flags, BGP_PATH_SELECTED) ||
|
||||||
|
(addpath_capable &&
|
||||||
|
bgp_addpath_tx_path(peer->addpath_type[afi][safi], bpi)));
|
||||||
|
}
|
||||||
|
@ -462,6 +462,8 @@ extern int update_group_clear_update_dbg(struct update_group *updgrp,
|
|||||||
|
|
||||||
extern void update_bgp_group_free(struct bgp *bgp);
|
extern void update_bgp_group_free(struct bgp *bgp);
|
||||||
extern bool bgp_addpath_encode_tx(struct peer *peer, afi_t afi, safi_t safi);
|
extern bool bgp_addpath_encode_tx(struct peer *peer, afi_t afi, safi_t safi);
|
||||||
|
extern bool bgp_check_selected(struct bgp_path_info *bpi, struct peer *peer,
|
||||||
|
bool addpath_capable, afi_t afi, safi_t safi);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inline functions
|
* Inline functions
|
||||||
|
@ -687,11 +687,8 @@ void subgroup_announce_table(struct update_subgroup *subgrp,
|
|||||||
|
|
||||||
for (ri = bgp_dest_get_bgp_path_info(dest); ri; ri = ri->next)
|
for (ri = bgp_dest_get_bgp_path_info(dest); ri; ri = ri->next)
|
||||||
|
|
||||||
if (CHECK_FLAG(ri->flags, BGP_PATH_SELECTED)
|
if (bgp_check_selected(ri, peer, addpath_capable, afi,
|
||||||
|| (addpath_capable
|
safi)) {
|
||||||
&& bgp_addpath_tx_path(
|
|
||||||
peer->addpath_type[afi][safi],
|
|
||||||
ri))) {
|
|
||||||
if (subgroup_announce_check(dest, ri, subgrp,
|
if (subgroup_announce_check(dest, ri, subgrp,
|
||||||
dest_p, &attr,
|
dest_p, &attr,
|
||||||
false)) {
|
false)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user