Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMP Adj-RIB-Out (RFC8671), ECMP Support and Loc-RIB missing features #14847

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
15 changes: 7 additions & 8 deletions bgpd/bgp_advertise.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ bool bgp_adj_out_lookup(struct peer *peer, struct bgp_dest *dest,
}


void bgp_adj_in_set(struct bgp_dest *dest, struct peer *peer, struct attr *attr,
uint32_t addpath_id, struct bgp_labels *labels)
void bgp_adj_in_set(struct bgp_dest *dest, afi_t afi, safi_t safi, struct peer *peer,
struct attr *attr, uint32_t addpath_id, struct bgp_labels *labels)
{
struct bgp_adj_in *adj;

Expand All @@ -182,28 +182,27 @@ void bgp_adj_in_set(struct bgp_dest *dest, struct peer *peer, struct attr *attr,
}
adj = XCALLOC(MTYPE_BGP_ADJ_IN, sizeof(struct bgp_adj_in));
adj->peer = peer_lock(peer); /* adj_in peer reference */
adj->peer->stat_adj_in_count[afi][safi]++;
adj->attr = bgp_attr_intern(attr);
adj->uptime = monotime(NULL);
adj->addpath_rx_id = addpath_id;
adj->labels = bgp_labels_intern(labels);
BGP_ADJ_IN_ADD(dest, adj);
peer->stat_pfx_adj_rib_in++;
bgp_dest_lock_node(dest);
}

void bgp_adj_in_remove(struct bgp_dest **dest, struct bgp_adj_in *bai)
void bgp_adj_in_remove(struct bgp_dest **dest, afi_t afi, safi_t safi, struct bgp_adj_in *bai)
{
bgp_attr_unintern(&bai->attr);
bgp_labels_unintern(&bai->labels);
if (bai->peer)
bai->peer->stat_pfx_adj_rib_in--;
BGP_ADJ_IN_DEL(*dest, bai);
bai->peer->stat_adj_in_count[afi][safi]--;
*dest = bgp_dest_unlock_node(*dest);
peer_unlock(bai->peer); /* adj_in peer reference */
XFREE(MTYPE_BGP_ADJ_IN, bai);
}

bool bgp_adj_in_unset(struct bgp_dest **dest, struct peer *peer,
bool bgp_adj_in_unset(struct bgp_dest **dest, afi_t afi, safi_t safi, struct peer *peer,
uint32_t addpath_id)
{
struct bgp_adj_in *adj;
Expand All @@ -218,7 +217,7 @@ bool bgp_adj_in_unset(struct bgp_dest **dest, struct peer *peer,
adj_next = adj->next;

if (adj->peer == peer && adj->addpath_rx_id == addpath_id)
bgp_adj_in_remove(dest, adj);
bgp_adj_in_remove(dest, afi, safi, adj);

adj = adj_next;

Expand Down
10 changes: 5 additions & 5 deletions bgpd/bgp_advertise.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ struct bgp_synchronize {
/* Prototypes. */
extern bool bgp_adj_out_lookup(struct peer *peer, struct bgp_dest *dest,
uint32_t addpath_tx_id);
extern void bgp_adj_in_set(struct bgp_dest *dest, struct peer *peer,
struct attr *attr, uint32_t addpath_id,
struct bgp_labels *labels);
extern bool bgp_adj_in_unset(struct bgp_dest **dest, struct peer *peer,
extern void bgp_adj_in_set(struct bgp_dest *dest, afi_t afi, safi_t safi, struct peer *peer,
struct attr *attr, uint32_t addpath_id, struct bgp_labels *labels);
extern bool bgp_adj_in_unset(struct bgp_dest **dest, afi_t afi, safi_t safi, struct peer *peer,
uint32_t addpath_id);
extern void bgp_adj_in_remove(struct bgp_dest **dest, struct bgp_adj_in *bai);
extern void bgp_adj_in_remove(struct bgp_dest **dest, afi_t afi, safi_t safi,
struct bgp_adj_in *bai);

extern unsigned int bgp_advertise_attr_hash_key(const void *p);
extern bool bgp_advertise_attr_hash_cmp(const void *p1, const void *p2);
Expand Down
Loading
Loading