From d9e7e1b13d69fa50d1979576c418c579f05463c6 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Sat, 13 Nov 2010 14:19:23 +0100 Subject: Adds support for iface link detection to OSPF. --- proto/ospf/ospf.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'proto/ospf/ospf.c') diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index a2a38f4..d9d8b7c 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -269,7 +269,7 @@ ospf_init(struct proto_config *c) p->reload_routes = ospf_reload_routes; p->accept_ra_types = RA_OPTIMAL; p->rt_notify = ospf_rt_notify; - p->if_notify = ospf_iface_notify; + p->if_notify = ospf_if_notify; p->ifa_notify = ospf_ifa_notify; p->rte_better = ospf_rte_better; p->rte_same = ospf_rte_same; @@ -728,7 +728,7 @@ ospf_reconfigure(struct proto *p, struct proto_config *c) } /* POLL TIMER */ - if (oldip->pollint != newip->pollint) + if ((oldip->pollint != newip->pollint) && ifa->poll_timer) { ifa->pollint = newip->helloint; ifa->poll_timer->recurrent = ifa->pollint; @@ -758,6 +758,15 @@ ospf_reconfigure(struct proto *p, struct proto_config *c) ospf_iface_change_mtu(po, ifa); } + /* LINK */ + if (oldip->use_link != newip->use_link) + { + ifa->use_link = newip->use_link; + + if (!(ifa->iface->flags & IF_LINK_UP)) + ospf_iface_sm(ifa, ifa->use_link ? ISM_LOOP : ISM_UNLOOP); + } + /* strict nbma */ if ((oldip->strictnbma == 0) && (newip->strictnbma != 0)) { @@ -819,7 +828,7 @@ ospf_reconfigure(struct proto *p, struct proto_config *c) } /* WAIT */ - if (oldip->waitint != newip->waitint) + if ((oldip->waitint != newip->waitint) && ifa->wait_timer) { ifa->waitint = newip->waitint; if (ifa->wait_timer->expires != 0) @@ -890,7 +899,7 @@ ospf_reconfigure(struct proto *p, struct proto_config *c) } if (!found) { - nb1 = mb_alloc(p->pool, sizeof(struct nbma_node)); + nb1 = mb_alloc(ifa->pool, sizeof(struct nbma_node)); nb1->ip = nb2->ip; nb1->eligible = nb2->eligible; add_tail(&ifa->nbma_list, NODE nb1); -- cgit v1.2.3