From 5b903de880998d905495bfefbb247e2c5cc195fd Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Thu, 12 May 2016 00:15:25 +0000 Subject: Improve support for config reloading. --- usr.sbin/eigrpd/eigrpd.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'usr.sbin/eigrpd/eigrpd.c') 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 @@ -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(); -- cgit v1.2.3