Skip to content

Commit 18355eb

Browse files
committed
mgd: cleanup routes from deleted bgp peer
Fixes: #349 Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
1 parent f5dbb6a commit 18355eb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mgd/src/bgp_admin.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,17 @@ pub(crate) mod helpers {
787787
) -> Result<HttpResponseDeleted, Error> {
788788
info!(ctx.log, "remove neighbor: {}", addr);
789789

790+
let id = lock!(
791+
get_router!(ctx, asn)?
792+
.get_session(addr)
793+
.ok_or(Error::NotFound("session for bgp peer not found".into()))
794+
.unwrap()
795+
.session
796+
)
797+
.remote_id
798+
.ok_or(Error::NotFound("bgp peer not found".into()))
799+
.unwrap();
800+
ctx.db.remove_peer_prefixes(id);
790801
ctx.db.remove_bgp_neighbor(addr)?;
791802
get_router!(&ctx, asn)?.delete_session(addr);
792803

0 commit comments

Comments
 (0)