summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-06-06 01:07:02 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-06-06 01:07:02 +0000
commitf1c395125acf7c5bdeb01ecdcf91dc81045d10da (patch)
tree6f99c3397b95aa20d6818c34e4097f4386f48f66 /usr.sbin/bgpd
parent7b467a55243b27419a4d75d2c570e2f7cf5fc2c5 (diff)
Only the main Loc-RIB should update the FIB for now. So introduce a
F_RIB_NOFIB flag and apply it on all RIBs that are not F_RIB_NOEVALUATE.
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/parse.y16
-rw-r--r--usr.sbin/bgpd/rde.h3
-rw-r--r--usr.sbin/bgpd/rde_decide.c5
3 files changed, 13 insertions, 11 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index d02bd0e709f..aa453587714 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.229 2009/06/05 20:46:43 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.230 2009/06/06 01:07:01 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -113,7 +113,7 @@ struct peer *new_peer(void);
struct peer *new_group(void);
int add_mrtconfig(enum mrt_type, char *, time_t, struct peer *,
char *);
-int add_rib(char *, int);
+int add_rib(char *, u_int16_t);
int find_rib(char *);
int get_id(struct peer *);
int expand_rule(struct filter_rule *, struct filter_peers_l *,
@@ -386,7 +386,7 @@ conf_main : AS as4number {
conf->flags &= ~BGPD_FLAG_NO_EVALUATE;
}
| RDE RIB STRING {
- if (add_rib($3, 0)) {
+ if (add_rib($3, F_RIB_NOFIB)) {
free($3);
YYERROR;
}
@@ -397,7 +397,7 @@ conf_main : AS as4number {
free($3);
YYERROR;
}
- if (!add_rib($3, 1)) {
+ if (!add_rib($3, F_RIB_NOEVALUATE)) {
free($3);
YYERROR;
}
@@ -823,6 +823,7 @@ peeropts : REMOTEAS as4number {
if (!find_rib($2)) {
yyerror("rib \"%s\" does not exist.", $2);
free($2);
+ YYERROR;
}
if (strlcpy(curpeer->conf.rib, $2,
sizeof(curpeer->conf.rib)) >=
@@ -2296,7 +2297,7 @@ parse_config(char *filename, struct bgpd_config *xconf,
/* init the empty filter list for later */
TAILQ_INIT(xfilter_l);
- add_rib("Adj-RIB-In", 1);
+ add_rib("Adj-RIB-In", F_RIB_NOEVALUATE);
add_rib("Loc-RIB", 0);
yyparse();
@@ -2649,7 +2650,7 @@ add_mrtconfig(enum mrt_type type, char *name, time_t timeout, struct peer *p,
}
int
-add_rib(char *name, int noeval)
+add_rib(char *name, u_int16_t flags)
{
struct rde_rib *rr;
@@ -2667,8 +2668,7 @@ add_rib(char *name, int noeval)
name, sizeof(rr->name) - 1);
return (-1);
}
- if (noeval)
- rr->flags |= F_RIB_NOEVALUATE;
+ rr->flags |= flags;
SIMPLEQ_INSERT_TAIL(&ribnames, rr, entry);
return (0);
}
diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h
index 236b035d07f..41874f39e85 100644
--- a/usr.sbin/bgpd/rde.h
+++ b/usr.sbin/bgpd/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.118 2009/06/06 01:02:51 claudio Exp $ */
+/* $OpenBSD: rde.h,v 1.119 2009/06/06 01:07:01 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and
@@ -278,6 +278,7 @@ struct rib {
#define F_RIB_ENTRYLOCK 0x0001
#define F_RIB_NOEVALUATE 0x0002
+#define F_RIB_NOFIB 0x0004
#define RIB_FAILED 0xffff
struct prefix {
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index d5f4bcfa492..2d8b3cd0bc3 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.56 2009/06/06 01:02:51 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.57 2009/06/06 01:07:01 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -262,7 +262,8 @@ prefix_evaluate(struct prefix *p, struct rib_entry *re)
* Additional decision may be made by the called functions.
*/
rde_generate_updates(re->ribid, xp, re->active);
- rde_send_kroute(xp, re->active);
+ if (re->flags & F_RIB_NOFIB)
+ rde_send_kroute(xp, re->active);
re->active = xp;
if (xp != NULL)