diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-03-01 16:02:02 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-03-01 16:02:02 +0000 |
commit | 81787a9c18092f8b6ff8b7ed88372701d75935d7 (patch) | |
tree | 6a30c639b6bb135dc0bf204cb73bc3b54d48b7a3 /usr.sbin | |
parent | 7e29d931c4fdd5a145dd21639ee2fe22809ea26a (diff) |
Make it possible to diable the decision process. This is a feature only useful
for route-collectors. OK henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/parse.y | 11 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 39 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.h | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_decide.c | 10 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_rib.c | 6 |
6 files changed, 59 insertions, 13 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 6da7baca2ff..ff87df617c8 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.101 2004/02/26 16:16:41 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.102 2004/03/01 16:02:01 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -45,6 +45,7 @@ #define BGPD_OPT_NOACTION 0x0004 #define BGPD_FLAG_NO_FIB_UPDATE 0x0001 +#define BGPD_FLAG_NO_EVALUATE 0x0002 #define BGPD_LOG_UPDATES 0x0001 diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index b7119fa6d2d..5aa0f73f2fb 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.63 2004/02/26 14:00:33 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.64 2004/03/01 16:02:01 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -102,7 +102,7 @@ typedef struct { %token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX ANNOUNCE %token ENFORCE NEIGHBORAS %token DUMP TABLE IN OUT -%token LOG +%token LOG ROUTECOLL %token TCP MD5SIG PASSWORD KEY %token ALLOW DENY MATCH %token QUICK @@ -208,6 +208,12 @@ conf_main : AS number { else conf->flags &= ~BGPD_FLAG_NO_FIB_UPDATE; } + | ROUTECOLL yesno { + if ($2 == 1) + conf->flags |= BGPD_FLAG_NO_EVALUATE; + else + conf->flags &= ~BGPD_FLAG_NO_EVALUATE; + } | LOG string { if (!strcmp($2, "updates")) conf->log |= BGPD_LOG_UPDATES; @@ -718,6 +724,7 @@ lookup(char *s) { "prepend-self", PREPEND}, { "quick", QUICK}, { "remote-as", REMOTEAS}, + { "route-collector", ROUTECOLL}, { "router-id", ROUTERID}, { "set", SET}, { "source-AS", SOURCEAS}, diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 71383f26387..70ac977c552 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.91 2004/02/27 20:53:56 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.92 2004/03/01 16:02:01 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -318,6 +318,15 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf) break; } } + if ((nconf->flags & BGPD_FLAG_NO_EVALUATE) + != (conf->flags & BGPD_FLAG_NO_EVALUATE)) { + log_warnx( "change to/from route-collector " + "mode ignored"); + if (conf->flags & BGPD_FLAG_NO_EVALUATE) + nconf->flags |= BGPD_FLAG_NO_EVALUATE; + else + nconf->flags &= ~BGPD_FLAG_NO_EVALUATE; + } memcpy(conf, nconf, sizeof(struct bgpd_config)); free(nconf); nconf = NULL; @@ -782,12 +791,6 @@ rde_generate_updates(struct prefix *new, struct prefix *old) } } -u_int16_t -rde_local_as(void) -{ - return conf->as; -} - void rde_update_queue_runner(void) { @@ -832,6 +835,20 @@ rde_update_queue_runner(void) } while (sent != 0); } +/* + * generic helper function + */ +u_int16_t +rde_local_as(void) +{ + return (conf->as); +} + +int +rde_noevaluate(void) +{ + return (conf->flags & BGPD_FLAG_NO_EVALUATE); +} /* * peer functions @@ -953,6 +970,14 @@ peer_up(u_int32_t id, struct session_up *sup) sizeof(peer->remote_addr)); peer->state = PEER_UP; up_init(peer); + + if (rde_noevaluate()) + /* + * no need to dump the table to the peer, there are no active + * prefixes anyway. This is a speed up hack. + */ + return; + pt_dump(up_dump_upcall, peer); } diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h index 249eb17515e..7ba91ef7f14 100644 --- a/usr.sbin/bgpd/rde.h +++ b/usr.sbin/bgpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.32 2004/02/27 20:53:56 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.33 2004/03/01 16:02:01 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and @@ -215,6 +215,7 @@ void rde_send_kroute(struct prefix *, struct prefix *); void rde_send_nexthop(struct bgpd_addr *, int); void rde_generate_updates(struct prefix *, struct prefix *); u_int16_t rde_local_as(void); +int rde_noevaluate(void); /* rde_attr.c */ void attr_init(struct attr_flags *); diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c index 4d89e63178d..9ba276be0ba 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.31 2004/02/27 20:53:56 claudio Exp $ */ +/* $OpenBSD: rde_decide.c,v 1.32 2004/03/01 16:02:01 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -191,6 +191,14 @@ prefix_evaluate(struct prefix *p, struct pt_entry *pte) { struct prefix *xp; + if (rde_noevaluate()) { + /* decision process is turned off */ + if (p != NULL) + LIST_INSERT_HEAD(&pte->prefix_h, p, prefix_l); + ENSURE(pte->active == NULL); + return; + } + if (p != NULL) { if (LIST_EMPTY(&pte->prefix_h)) LIST_INSERT_HEAD(&pte->prefix_h, p, prefix_l); diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index 5afd5c85f84..d90dcb63590 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.39 2004/02/27 20:53:56 claudio Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.40 2004/03/01 16:02:01 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -456,6 +456,10 @@ prefix_updateall(struct rde_aspath *asp, enum nexthop_state state) RIB_STAT(prefix_updateall); ENSURE(asp != NULL); + if (rde_noevaluate()) + /* if the decision process is turned off this is a no-op */ + return; + LIST_FOREACH(p, &asp->prefix_h, path_l) { /* redo the route decision */ LIST_REMOVE(p, prefix_l); |