summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-06-05 19:52:33 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-06-05 19:52:33 +0000
commitd8c456f2db972e8e3e2927f7e9c863a93f68609a (patch)
tree4c71d3304fcb65de7a5e486082ba85d7f360eb16 /usr.sbin
parentd8e523e6190a7a068ba492d4f689bc9068abb422 (diff)
Make it possible to bind peers to a specified RIB. Now only filters and
bgpctl are missing to have full support of multiple RIBs.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.h3
-rw-r--r--usr.sbin/bgpd/parse.y17
-rw-r--r--usr.sbin/bgpd/rde.c12
3 files changed, 24 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 0ab07b09512..a650688de42 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.233 2009/06/04 04:46:42 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.234 2009/06/05 19:52:32 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -239,6 +239,7 @@ struct peer_config {
struct capabilities capabilities;
char group[PEER_DESCR_LEN];
char descr[PEER_DESCR_LEN];
+ char rib[PEER_DESCR_LEN];
char if_depend[IFNAMSIZ];
char demote_group[IFNAMSIZ];
u_int32_t id;
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index b02cd4f13f7..95de187bc97 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.227 2009/06/04 22:08:19 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.228 2009/06/05 19:52:32 claudio Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -819,6 +819,21 @@ peeropts : REMOTEAS as4number {
| DOWN {
curpeer->conf.down = 1;
}
+ | RIB STRING {
+ if (!find_rib($2)) {
+ yyerror("rib \"%s\" does not exist.", $2);
+ free($2);
+ }
+ if (strlcpy(curpeer->conf.rib, $2,
+ sizeof(curpeer->conf.rib)) >=
+ sizeof(curpeer->conf.rib)) {
+ yyerror("rib name \"%s\" too long: max %u",
+ $2, sizeof(curpeer->conf.rib) - 1);
+ free($2);
+ YYERROR;
+ }
+ free($2);
+ }
| HOLDTIME NUMBER {
if ($2 < MIN_HOLDTIME || $2 > USHRT_MAX) {
yyerror("holdtime must be between %u and %u",
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 0a95b5677a4..89118b7660a 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.253 2009/06/05 17:36:49 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.254 2009/06/05 19:52:32 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2475,6 +2475,7 @@ peer_add(u_int32_t id, struct peer_config *p_conf)
LIST_INIT(&peer->path_h);
memcpy(&peer->conf, p_conf, sizeof(struct peer_config));
peer->remote_bgpid = 0;
+ peer->ribid = rib_find(peer->conf.rib);
peer->state = PEER_NONE;
up_init(peer);
@@ -2630,17 +2631,16 @@ peer_dump(u_int32_t id, u_int16_t afi, u_int8_t safi)
if (peer->conf.announce_type == ANNOUNCE_DEFAULT_ROUTE)
up_generate_default(rules_l, peer, AF_INET);
else
- /* XXX totaly wrong ... */
- rib_dump(&ribs[1], rde_up_dump_upcall, peer,
- AF_INET);
+ rib_dump(&ribs[peer->ribid], rde_up_dump_upcall,
+ peer, AF_INET);
}
if (afi == AFI_ALL || afi == AFI_IPv6)
if (safi == SAFI_ALL || safi == SAFI_UNICAST) {
if (peer->conf.announce_type == ANNOUNCE_DEFAULT_ROUTE)
up_generate_default(rules_l, peer, AF_INET6);
else
- /* XXX again wrong rib */
- rib_dump(&ribs[1], rde_up_dump_upcall, peer, AF_INET6);
+ rib_dump(&ribs[peer->ribid], rde_up_dump_upcall,
+ peer, AF_INET6);
}
if (peer->capa_received.restart && peer->capa_announced.restart)