From 18d502b79bf875dba2a43d4319a02da18d8db901 Mon Sep 17 00:00:00 2001 From: renato Date: Sat, 10 Oct 2015 05:09:19 +0000 Subject: [PATCH] Move some interface initialization bits from if_init() to eigrp_if_start() and call if_init() only during the startup of the eigrpe process. --- usr.sbin/eigrpd/eigrpe.c | 6 +----- usr.sbin/eigrpd/interface.c | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/usr.sbin/eigrpd/eigrpe.c b/usr.sbin/eigrpd/eigrpe.c index e5c3a249914..e0fbc4a2916 100644 --- a/usr.sbin/eigrpd/eigrpe.c +++ b/usr.sbin/eigrpd/eigrpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eigrpe.c,v 1.3 2015/10/05 01:59:33 renato Exp $ */ +/* $OpenBSD: eigrpe.c,v 1.4 2015/10/10 05:09:19 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal @@ -567,10 +567,6 @@ eigrpe_dispatch_rde(int fd, short event, void *bula) void eigrpe_instance_init(struct eigrp *eigrp) { - struct eigrp_iface *ei; - - TAILQ_FOREACH(ei, &eigrp->ei_list, e_entry) - if_init(econf, ei->iface); } void diff --git a/usr.sbin/eigrpd/interface.c b/usr.sbin/eigrpd/interface.c index 556042d35a2..0b5fec75b57 100644 --- a/usr.sbin/eigrpd/interface.c +++ b/usr.sbin/eigrpd/interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.c,v 1.5 2015/10/10 05:07:10 renato Exp $ */ +/* $OpenBSD: interface.c,v 1.6 2015/10/10 05:09:19 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal @@ -115,18 +115,6 @@ if_init(struct eigrpd_conf *xconf, struct iface *iface) { struct ifreq ifr; unsigned int rdomain; - struct eigrp_iface *ei; - union eigrpd_addr addr; - - memset(&addr, 0, sizeof(addr)); - TAILQ_FOREACH(ei, &iface->ei_list, i_entry) { - /* init the dummy self neighbor */ - ei->self = nbr_new(ei, &addr, 0, 1); - nbr_init(ei->self); - - /* set event handlers for interface */ - evtimer_set(&ei->hello_timer, eigrp_if_hello_timer, ei); - } /* set rdomain */ strlcpy(ifr.ifr_name, iface->name, sizeof(ifr.ifr_name)); @@ -343,12 +331,21 @@ eigrp_if_start(struct eigrp_iface *ei) { struct eigrp *eigrp = ei->eigrp; struct if_addr *if_addr; + union eigrpd_addr addr; struct in_addr addr4; struct in6_addr addr6; log_debug("%s: %s as %u family %s", __func__, ei->iface->name, eigrp->as, af_name(eigrp->af)); + /* init the dummy self neighbor */ + memset(&addr, 0, sizeof(addr)); + ei->self = nbr_new(ei, &addr, 0, 1); + nbr_init(ei->self); + + /* set event handlers for interface */ + evtimer_set(&ei->hello_timer, eigrp_if_hello_timer, ei); + TAILQ_FOREACH(if_addr, &ei->iface->addr_list, entry) { if (if_addr->af != eigrp->af) continue; -- 2.20.1