From 1a643f88b238147dc2cfbe137d9feae7e3f3546e Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 11 Jan 2006 01:08:19 +0000 Subject: [ospfd] Bug #234. Fix nbr_self reinitialisation after down/up. 2006-01-10 Len Sorensen * (general) Bug #234, see also [quagga-dev 3902]. Fix problem with nbr_self not being properly reinitialised when an interface comes up, after having been down. Some re-arrangement done by Paul Jakma, any bugs introduced on top of Len's suggested changes are his. * ospf_neighbor.c: (ospf_nbr_add_self) centralise initialisation of nbr_self parameters here. * ospf_interface.c: (ospf_if_new) deleting initialisation of parameters of nbr_self, just rely on call to ospf_nbr_add_self. (ospf_if_cleanup) ditto. * ospfd.c: (ospf_network_run) ditto. --- ospfd/ospf_neighbor.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'ospfd/ospf_neighbor.c') diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c index 5c1a7627..58752366 100644 --- a/ospfd/ospf_neighbor.c +++ b/ospfd/ospf_neighbor.c @@ -202,6 +202,27 @@ ospf_nbr_add_self (struct ospf_interface *oi) } else rn->info = oi->nbr_self; + + /* Initial state */ + oi->nbr_self->address = *oi->address; + oi->nbr_self->priority = OSPF_IF_PARAM (oi, priority); + oi->nbr_self->router_id = oi->ospf->router_id; + oi->nbr_self->src = oi->address->u.prefix4; + oi->nbr_self->state = NSM_TwoWay; + + switch (oi->area->external_routing) + { + case OSPF_AREA_DEFAULT: + SET_FLAG (oi->nbr_self->options, OSPF_OPTION_E); + break; + case OSPF_AREA_STUB: + UNSET_FLAG (oi->nbr_self->options, OSPF_OPTION_E); + break; + case OSPF_AREA_NSSA: + UNSET_FLAG (oi->nbr_self->options, OSPF_OPTION_E); + SET_FLAG (oi->nbr_self->options, OSPF_OPTION_NP); + break; + } } /* Get neighbor count by status. -- cgit v1.2.1