summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-05-21 15:47:04 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-05-21 15:47:04 +0000
commitac020521609fa1ef947cc159f2f03b0488a9136e (patch)
tree82e7a885fbd7040ebaedb112fcb9b95c4ddcf6e0
parentebcc5a7d5683b46ae04eb1dc5228ed1c22c839a3 (diff)
Make it possible to turn off the decision process per RIB. This is mainly
used for the Adj-Rib-In. Also initialize the Adj-Rib-In correctly and mark it a noevaluate.
-rw-r--r--usr.sbin/bgpd/rde.h3
-rw-r--r--usr.sbin/bgpd/rde_decide.c11
-rw-r--r--usr.sbin/bgpd/rde_rib.c20
3 files changed, 16 insertions, 18 deletions
diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h
index a89934971c3..7f2905db780 100644
--- a/usr.sbin/bgpd/rde.h
+++ b/usr.sbin/bgpd/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.108 2009/05/17 14:45:25 claudio Exp $ */
+/* $OpenBSD: rde.h,v 1.109 2009/05/21 15:47:03 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and
@@ -273,6 +273,7 @@ struct rib {
LIST_HEAD(, rib_context) ctxts;
enum rib_state state;
u_int16_t id;
+ u_char noevaluate;
};
struct prefix {
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index d7443dcb8ab..b580bb46b76 100644
--- a/usr.sbin/bgpd/rde_decide.c
+++ b/usr.sbin/bgpd/rde_decide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_decide.c,v 1.53 2009/05/17 12:25:15 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.54 2009/05/21 15:47:03 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -217,14 +217,7 @@ prefix_evaluate(struct prefix *p, struct rib_entry *re)
{
struct prefix *xp;
- /* XXX we need to skip the adj-rib-in somehow */
- /* XXX hack for now, no idea why we end up here. */
- if (!re) {
- log_debug("*BOOM*");
- return;
- }
-
- if (rde_noevaluate()) {
+ if (re->rib->noevaluate || rde_noevaluate()) {
/* decision process is turned off */
if (p != NULL)
LIST_INSERT_HEAD(&re->prefix_h, p, rib_l);
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index 28edd8dcfbc..5ee64aedbfb 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.101 2009/05/17 14:45:25 claudio Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.102 2009/05/21 15:47:03 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -53,6 +53,14 @@ rib_init(void)
if ((ribs = calloc(1, sizeof(struct rib))) == NULL)
fatal("rib_init");
rib_new("DEFAULT");
+
+ /* XXX we need to create Adj-RIB-In by hand */
+ bzero(&ribs[0], sizeof(struct rib));
+ RB_INIT(&ribs[0].rib);
+ ribs[0].state = RIB_ACTIVE;
+ ribs[0].id = 0;
+ strlcpy(ribs[0].name, "Adj-RIB-In", sizeof("Adj-RIB-In"));
+ ribs[0].noevaluate = 1;
}
u_int16_t
@@ -801,16 +809,12 @@ prefix_updateall(struct rde_aspath *asp, enum nexthop_state state,
{
struct prefix *p;
- if (rde_noevaluate())
- /* if the decision process is turned off this is a no-op */
- return;
-
LIST_FOREACH(p, &asp->prefix_h, path_l) {
/*
- * XXX THIS IS MISSING AT THE MOMENT
- * skip non local-RIB nodes, only local-RIB prefixes are
- * eligible.
+ * skip non local-RIBs or RIBs that are flagged as noeval.
*/
+ if (p->rib->rib->noevaluate)
+ continue;
if (oldstate == state && state == NEXTHOP_REACH) {
/*