summaryrefslogtreecommitdiffstats
path: root/ospfd/ospfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospfd.c')
-rw-r--r--ospfd/ospfd.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 12def44d..93611da9 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -231,7 +231,7 @@ ospf_new (void)
}
new->t_read = thread_add_read (master, ospf_read, new, new->fd);
new->oi_write_q = list_new ();
-
+ new->hostlist = list_new(); /* host route list */
return new;
}
@@ -401,6 +401,7 @@ ospf_finish_final (struct ospf *ospf)
struct ospf_lsa *lsa;
struct ospf_interface *oi;
struct ospf_area *area;
+ struct ospf_host_route *host;
struct ospf_vl_data *vl_data;
struct listnode *node, *nnode;
int i;
@@ -471,6 +472,12 @@ ospf_finish_final (struct ospf *ospf)
ospf_area_free (area);
}
+ for (ALL_LIST_ELEMENTS (ospf->hostlist, node, nnode, host))
+ {
+ listnode_delete (ospf->hostlist, host);
+ XFREE (MTYPE_OSPF_TOP, host);
+ }
+
/* Cancel all timers. */
OSPF_TIMER_OFF (ospf->t_external_lsa);
OSPF_TIMER_OFF (ospf->t_router_lsa_update);
@@ -651,6 +658,7 @@ ospf_area_check_free (struct ospf *ospf, struct in_addr area_id)
struct ospf_if_params *params;
struct route_node *rn;
struct ospf_network *network;
+ struct ospf_host_route *host;
struct ospf_area *area;
/* Check if any interface is a member of this area */
@@ -683,6 +691,9 @@ ospf_area_check_free (struct ospf *ospf, struct in_addr area_id)
IMPORT_NAME (area) == NULL &&
area->auth_type == OSPF_AUTH_NULL)
{
+ for (ALL_LIST_ELEMENTS_RO (area->ospf->hostlist, node, host))
+ if (!host->area || host->area == area)
+ return;
listnode_delete (ospf->areas, area);
ospf_area_free (area);
}
@@ -1539,8 +1550,6 @@ ospf_nbr_nbma_add (struct ospf_nbr_nbma *nbr_nbma,
struct ospf_interface *oi)
{
struct ospf_neighbor *nbr;
- struct route_node *rn;
- struct prefix p;
if (oi->type != OSPF_IFTYPE_NBMA)
return;
@@ -1548,37 +1557,27 @@ ospf_nbr_nbma_add (struct ospf_nbr_nbma *nbr_nbma,
if (nbr_nbma->nbr != NULL)
return;
- if (IPV4_ADDR_SAME (&oi->nbr_self->address.u.prefix4, &nbr_nbma->addr))
+ if (IPV4_ADDR_SAME (&oi->nbr_self->src, &nbr_nbma->addr))
return;
nbr_nbma->oi = oi;
listnode_add (oi->nbr_nbma, nbr_nbma);
/* Get neighbor information from table. */
- p.family = AF_INET;
- p.prefixlen = IPV4_MAX_BITLEN;
- p.u.prefix4 = nbr_nbma->addr;
-
- rn = route_node_get (oi->nbrs, (struct prefix *)&p);
- if (rn->info)
+ nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &nbr_nbma->addr);
+ if (nbr)
{
- nbr = rn->info;
nbr->nbr_nbma = nbr_nbma;
nbr_nbma->nbr = nbr;
-
- route_unlock_node (rn);
}
else
{
- nbr = rn->info = ospf_nbr_new (oi);
+ nbr = ospf_nbr_new (oi);
nbr->state = NSM_Down;
nbr->src = nbr_nbma->addr;
nbr->nbr_nbma = nbr_nbma;
nbr->priority = nbr_nbma->priority;
- nbr->address = p;
-
nbr_nbma->nbr = nbr;
-
OSPF_NSM_EVENT_EXECUTE (nbr, NSM_Start);
}
}