Move some interface initialization bits from if_init() to eigrp_if_start()
authorrenato <renato@openbsd.org>
Sat, 10 Oct 2015 05:09:19 +0000 (05:09 +0000)
committerrenato <renato@openbsd.org>
Sat, 10 Oct 2015 05:09:19 +0000 (05:09 +0000)
and call if_init() only during the startup of the eigrpe process.

usr.sbin/eigrpd/eigrpe.c
usr.sbin/eigrpd/interface.c

index e5c3a24..e0fbc4a 100644 (file)
@@ -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 <renato@openbsd.org>
@@ -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
index 556042d..0b5fec7 100644 (file)
@@ -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 <renato@openbsd.org>
@@ -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;