summaryrefslogtreecommitdiff
path: root/usr.sbin/eigrpd
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2016-05-12 00:15:25 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2016-05-12 00:15:25 +0000
commit5b903de880998d905495bfefbb247e2c5cc195fd (patch)
treee55d3da3cc441743f90902d85877f825cd37e25b /usr.sbin/eigrpd
parent6a739f2f5d28e925927f1f9745838bc0da2160ac (diff)
Improve support for config reloading.
Diffstat (limited to 'usr.sbin/eigrpd')
-rw-r--r--usr.sbin/eigrpd/eigrpd.c25
-rw-r--r--usr.sbin/eigrpd/eigrpe.c4
-rw-r--r--usr.sbin/eigrpd/rde.c4
3 files changed, 27 insertions, 6 deletions
diff --git a/usr.sbin/eigrpd/eigrpd.c b/usr.sbin/eigrpd/eigrpd.c
index 8ca2d1a06b9..98e99c640d3 100644
--- a/usr.sbin/eigrpd/eigrpd.c
+++ b/usr.sbin/eigrpd/eigrpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpd.c,v 1.13 2016/04/18 13:14:27 renato Exp $ */
+/* $OpenBSD: eigrpd.c,v 1.14 2016/05/12 00:15:24 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -582,15 +582,35 @@ eigrp_sendboth(enum imsg_type type, void *buf, uint16_t len)
void
merge_config(struct eigrpd_conf *conf, struct eigrpd_conf *xconf)
{
+ struct iface *iface, *itmp, *xi;
struct eigrp *eigrp, *etmp, *xe;
- /* change of rtr_id needs a restart */
+ conf->rtr_id = xconf->rtr_id;
conf->flags = xconf->flags;
conf->rdomain= xconf->rdomain;
conf->fib_priority_internal = xconf->fib_priority_internal;
conf->fib_priority_external = xconf->fib_priority_external;
conf->fib_priority_summary = xconf->fib_priority_summary;
+ /* merge interfaces */
+ TAILQ_FOREACH_SAFE(iface, &conf->iface_list, entry, itmp) {
+ /* find deleted ifaces */
+ if ((xi = if_lookup(xconf, iface->ifindex)) == NULL) {
+ TAILQ_REMOVE(&conf->iface_list, iface, entry);
+ free(iface);
+ }
+ }
+ TAILQ_FOREACH_SAFE(xi, &xconf->iface_list, entry, itmp) {
+ /* find new ifaces */
+ if ((iface = if_lookup(conf, xi->ifindex)) == NULL) {
+ TAILQ_REMOVE(&xconf->iface_list, xi, entry);
+ TAILQ_INSERT_TAIL(&conf->iface_list, xi, entry);
+ continue;
+ }
+
+ /* TODO update existing ifaces */
+ }
+
/* merge instances */
TAILQ_FOREACH_SAFE(eigrp, &conf->instances, entry, etmp) {
/* find deleted instances */
@@ -632,6 +652,7 @@ merge_config(struct eigrpd_conf *conf, struct eigrpd_conf *xconf)
/* update existing instances */
merge_instances(conf, eigrp, xe);
}
+
/* resend addresses to activate new interfaces */
if (eigrpd_process == PROC_MAIN)
kif_redistribute();
diff --git a/usr.sbin/eigrpd/eigrpe.c b/usr.sbin/eigrpd/eigrpe.c
index 82d7bbf322b..71374122a06 100644
--- a/usr.sbin/eigrpd/eigrpe.c
+++ b/usr.sbin/eigrpd/eigrpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eigrpe.c,v 1.20 2016/04/18 13:14:27 renato Exp $ */
+/* $OpenBSD: eigrpe.c,v 1.21 2016/05/12 00:15:24 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -244,7 +244,7 @@ eigrpe_imsg_compose_rde(int type, uint32_t peerid, pid_t pid,
void
eigrpe_dispatch_main(int fd, short event, void *bula)
{
- struct iface *niface = NULL;
+ static struct iface *niface = NULL;
static struct eigrp *neigrp;
struct eigrp_iface *nei;
struct imsg imsg;
diff --git a/usr.sbin/eigrpd/rde.c b/usr.sbin/eigrpd/rde.c
index 37cd8e1704b..06e6a0ac1d0 100644
--- a/usr.sbin/eigrpd/rde.c
+++ b/usr.sbin/eigrpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.15 2016/04/18 13:14:27 renato Exp $ */
+/* $OpenBSD: rde.c,v 1.16 2016/05/12 00:15:24 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -326,7 +326,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
void
rde_dispatch_parent(int fd, short event, void *bula)
{
- struct iface *niface = NULL;
+ static struct iface *niface = NULL;
static struct eigrp *neigrp;
struct eigrp_iface *nei;
struct imsg imsg;