summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bgpd/rde.c')
-rw-r--r--usr.sbin/bgpd/rde.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 4700050b225..b0f72396a81 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.291 2010/04/13 09:09:48 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.292 2010/05/03 13:09:38 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -596,8 +596,15 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
memcpy(&rn, imsg.data, sizeof(rn));
rid = rib_find(rn.name);
if (rid == RIB_FAILED)
- rib_new(rn.name, rn.flags);
- else
+ rib_new(rn.name, rn.rtableid, rn.flags);
+ else if (ribs[rid].rtableid != rn.rtableid ||
+ (ribs[rid].flags & F_RIB_HASNOFIB) !=
+ (rn.flags & F_RIB_HASNOFIB)) {
+ /* Big hammer in the F_RIB_NOFIB case but
+ * not often enough used to optimise it more. */
+ rib_free(&ribs[rid]);
+ rib_new(rn.name, rn.rtableid, rn.flags);
+ } else
ribs[rid].state = RECONF_KEEP;
break;
case IMSG_RECONF_FILTER:
@@ -666,7 +673,7 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
rde_softreconfig_load, &ribs[rid],
AID_UNSPEC);
}
- /* sync local-RIB first */
+ /* sync local-RIBs first */
if (reconf_in)
rib_dump(&ribs[0], rde_softreconfig_in, NULL,
AID_UNSPEC);
@@ -1981,15 +1988,15 @@ rde_dump_rib_as(struct prefix *p, struct rde_aspath *asp, pid_t pid, int flags)
rib.origin = asp->origin;
rib.flags = 0;
if (p->rib->active == p)
- rib.flags |= F_RIB_ACTIVE;
+ rib.flags |= F_PREF_ACTIVE;
if (asp->peer->conf.ebgp == 0)
- rib.flags |= F_RIB_INTERNAL;
+ rib.flags |= F_PREF_INTERNAL;
if (asp->flags & F_PREFIX_ANNOUNCED)
- rib.flags |= F_RIB_ANNOUNCE;
+ rib.flags |= F_PREF_ANNOUNCE;
if (asp->nexthop == NULL || asp->nexthop->state == NEXTHOP_REACH)
- rib.flags |= F_RIB_ELIGIBLE;
+ rib.flags |= F_PREF_ELIGIBLE;
if (asp->flags & F_ATTR_LOOP)
- rib.flags &= ~F_RIB_ELIGIBLE;
+ rib.flags &= ~F_PREF_ELIGIBLE;
rib.aspath_len = aspath_length(asp->aspath);
if ((wbuf = imsg_create(ibuf_se_ctl, IMSG_CTL_SHOW_RIB, 0, pid,
@@ -2212,7 +2219,7 @@ rde_dump_mrt_new(struct mrt *mrt, pid_t pid, int fd)
* kroute specific functions
*/
void
-rde_send_kroute(struct prefix *new, struct prefix *old)
+rde_send_kroute(struct prefix *new, struct prefix *old, u_int16_t ribid)
{
struct kroute_full kr;
struct bgpd_addr addr;
@@ -2249,7 +2256,7 @@ rde_send_kroute(struct prefix *new, struct prefix *old)
strlcpy(kr.label, rtlabel_id2name(p->aspath->rtlabelid),
sizeof(kr.label));
- if (imsg_compose(ibuf_main, type, 0, 0, -1, &kr,
+ if (imsg_compose(ibuf_main, type, ribs[ribid].rtableid, 0, -1, &kr,
sizeof(kr)) == -1)
fatal("imsg_compose error");
}