summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-06-07 00:30:24 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-06-07 00:30:24 +0000
commit0cf4a8ba98d7d12612dcc13389e150591b479596 (patch)
tree1b28eb8d7a9ef43dd5e9c7fc23694d2aad73b396 /usr.sbin/bgpd/rde.c
parent1b7ee37fdf78f782a6a3118999d7ac300f35ac9f (diff)
First attempt at reload support for RIBs. There is some magic that I do
not fully understand but at least no flames are comming out of my test box anymore.
Diffstat (limited to 'usr.sbin/bgpd/rde.c')
-rw-r--r--usr.sbin/bgpd/rde.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 4662ced96c1..2140cfffd65 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.260 2009/06/06 21:21:37 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.261 2009/06/07 00:30:23 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -555,12 +555,14 @@ void
rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
{
struct imsg imsg;
+ struct mrt xmrt;
+ struct rde_rib rn;
struct rde_peer *peer;
struct filter_rule *r;
struct filter_set *s;
- struct mrt xmrt;
struct nexthop *nh;
int n, fd, reconf_in = 0, reconf_out = 0;
+ u_int16_t rid;
if ((n = imsg_read(ibuf)) == -1)
fatal("rde_dispatch_imsg_parent: imsg_read error");
@@ -584,6 +586,8 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
NULL)
fatal(NULL);
memcpy(nconf, imsg.data, sizeof(struct bgpd_config));
+ for (rid = 0; rid < rib_size; rid++)
+ ribs[rid].state = RIB_DELETE;
break;
case IMSG_NETWORK_ADD:
memcpy(&netconf_p, imsg.data, sizeof(netconf_p));
@@ -604,6 +608,17 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
TAILQ_INIT(&netconf_p.attrset);
network_delete(&netconf_p, 1);
break;
+ case IMSG_RECONF_RIB:
+ if (imsg.hdr.len - IMSG_HEADER_SIZE !=
+ sizeof(struct rde_rib))
+ fatalx("IMSG_RECONF_RIB bad len");
+ memcpy(&rn, imsg.data, sizeof(rn));
+ rid = rib_find(rn.name);
+ if (rid == RIB_FAILED)
+ rib_new(-1, rn.name, rn.flags);
+ else
+ ribs[rid].state = RIB_ACTIVE;
+ break;
case IMSG_RECONF_FILTER:
if (imsg.hdr.len - IMSG_HEADER_SIZE !=
sizeof(struct filter_rule))
@@ -673,6 +688,10 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
}
free(rules_l);
rules_l = newrules;
+ for (rid = 0; rid < rib_size; rid++) {
+ if (ribs[rid].state == RIB_DELETE)
+ rib_free(&ribs[rid]);
+ }
log_info("RDE reconfigured");
break;
case IMSG_NEXTHOP_UPDATE: