Skip to content

Commit

Permalink
bgpd: bmp, send peer up events when config param changed
Browse files Browse the repository at this point in the history
When a BGP instance is created or becomes valid, and when a parameter
is updated (router-id, route distinguisher), the peer up messages other
than loc rib peer up messages, are sent.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
  • Loading branch information
pguibert6WIND committed Dec 20, 2024
1 parent 479af7c commit 66ea8cc
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3444,6 +3444,7 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
struct bmp_imported_bgp *bib;
int ret = 0;
struct stream *s = bmp_peerstate(bgp->peer_self, withdraw);
struct bmp *bmp;

if (!s)
return 0;
Expand All @@ -3452,6 +3453,10 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
frr_each (bmp_targets, &bmpbgp->targets, bt) {
ret = bmp_bgp_attribute_updated_instance(bt, &bmpbgp->vrf_state, bgp,
withdraw, s);
if (withdraw)
continue;
frr_each (bmp_session, &bt->sessions, bmp)
bmp_send_peerup_per_instance(bmp, bgp);
}
}

Expand All @@ -3467,6 +3472,10 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
continue;
ret += bmp_bgp_attribute_updated_instance(bt, &bib->vrf_state, bgp,
withdraw, s);
if (withdraw)
continue;
frr_each (bmp_session, &bt->sessions, bmp)
bmp_send_peerup_per_instance(bmp, bgp);
}
}
}
Expand Down Expand Up @@ -3495,10 +3504,18 @@ static void _bmp_vrf_state_changed_internal(struct bgp *bgp, enum bmp_vrf_state
struct bmp_targets *bt;
struct listnode *node;
struct bmp_imported_bgp *bib;
struct bmp *bmp;

if (bmpbgp && bmp_bgp_update_vrf_status(&bmpbgp->vrf_state, bgp, vrf_state))
if (bmpbgp && bmp_bgp_update_vrf_status(&bmpbgp->vrf_state, bgp, vrf_state)) {
bmp_send_all_safe(bmpbgp, bmp_peerstate(bgp->peer_self,
bmpbgp->vrf_state == vrf_state_down));
if (vrf_state == vrf_state_up && bmpbgp->vrf_state == vrf_state_up) {
frr_each (bmp_targets, &bmpbgp->targets, bt) {
frr_each (bmp_session, &bt->sessions, bmp)
bmp_send_peerup_per_instance(bmp, bgp);
}
}
}

for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, bgp_vrf)) {
bmpbgp = bmp_bgp_find(bgp_vrf);
Expand All @@ -3514,6 +3531,11 @@ static void _bmp_vrf_state_changed_internal(struct bgp *bgp, enum bmp_vrf_state
bmp_send_bt_safe(bt, bmp_peerstate(bgp->peer_self,
bib->vrf_state ==
vrf_state_down));
if (vrf_state == vrf_state_up &&
bib->vrf_state == vrf_state_up) {
frr_each (bmp_session, &bt->sessions, bmp)
bmp_send_peerup_per_instance(bmp, bgp);
}
break;
}
}
Expand Down

0 comments on commit 66ea8cc

Please sign in to comment.