summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-01-24 13:00:36 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-01-24 13:00:36 +0000
commitc2f898f650a9fa354c92c15d69cbb7daea264a04 (patch)
tree4b9d012ec0ca6a8f4da9e976b10fe37e614b504a /usr.sbin/bgpd
parent32bffc8ddfc4270c25d87bd9fa893af3b75ebfa0 (diff)
It is possible that a prefix is part of two RIBs in that case prefix_remove()
needs to be extra careful and only remove the prefix from the specified RIB. Looks good henning@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/rde_rib.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index 05cc2702431..e7446e71703 100644
--- a/usr.sbin/bgpd/rde_rib.c
+++ b/usr.sbin/bgpd/rde_rib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_rib.c,v 1.81 2006/01/24 10:05:24 henning Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.82 2006/01/24 13:00:35 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -522,6 +522,22 @@ prefix_remove(struct rde_peer *peer, struct bgpd_addr *prefix, int prefixlen,
rde_send_pftable_commit();
}
+ /* if prefix belongs to more than one RIB just remove one instance */
+ if (p->flags != flags) {
+ p->flags &= ~flags;
+
+ PREFIX_COUNT(p->aspath, flags, -1);
+ PREFIX_COUNT(peer, flags, -1);
+
+ /* redo the route decision for p */
+ LIST_REMOVE(p, prefix_l);
+ /* If the prefix is the active one remove it first. */
+ if (p == p->prefix->active)
+ prefix_evaluate(NULL, p->prefix);
+ prefix_evaluate(p, p->prefix);
+ return;
+ }
+
prefix_unlink(p);
prefix_free(p);