mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 12:39:21 +00:00
ospfd: Fix various route_unlock discrepencies
* ospf_ase.c: (ospf_ase_calculate_route) Fix compiler warning about eval needing brackets. (various) add defensive asserts. * ospf_lsdb.c: (ospf_lsdb_add) add missing node unlock if same lsa already was indexed. (ospf_lsdb_delete) check it's actually the same as specified lsa before deleting (ospf_lsdb_lookup_by_id_next) fix another corner case - no result => don't go on.
This commit is contained in:
parent
6634974d68
commit
e8f2226195
@ -451,8 +451,8 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
|
|||||||
|
|
||||||
/* if there is a Intra/Inter area route to the N
|
/* if there is a Intra/Inter area route to the N
|
||||||
do not install external route */
|
do not install external route */
|
||||||
if (rn = route_node_lookup (ospf->new_table,
|
if ((rn = route_node_lookup (ospf->new_table,
|
||||||
(struct prefix *) &p))
|
(struct prefix *) &p)))
|
||||||
{
|
{
|
||||||
route_unlock_node(rn);
|
route_unlock_node(rn);
|
||||||
if (rn->info == NULL)
|
if (rn->info == NULL)
|
||||||
@ -463,8 +463,8 @@ ospf_ase_calculate_route (struct ospf *ospf, struct ospf_lsa * lsa)
|
|||||||
}
|
}
|
||||||
/* Find a route to the same dest */
|
/* Find a route to the same dest */
|
||||||
/* If there is no route, create new one. */
|
/* If there is no route, create new one. */
|
||||||
if (rn = route_node_lookup (ospf->new_external_route,
|
if ((rn = route_node_lookup (ospf->new_external_route,
|
||||||
(struct prefix *) &p))
|
(struct prefix *) &p)))
|
||||||
route_unlock_node(rn);
|
route_unlock_node(rn);
|
||||||
|
|
||||||
if (!rn || (or = rn->info) == NULL)
|
if (!rn || (or = rn->info) == NULL)
|
||||||
@ -718,7 +718,6 @@ ospf_ase_register_external_lsa (struct ospf_lsa *lsa, struct ospf *top)
|
|||||||
|
|
||||||
/* We assume that if LSA is deleted from DB
|
/* We assume that if LSA is deleted from DB
|
||||||
is is also deleted from this RT */
|
is is also deleted from this RT */
|
||||||
|
|
||||||
listnode_add (lst, ospf_lsa_lock (lsa)); /* external_lsas lst */
|
listnode_add (lst, ospf_lsa_lock (lsa)); /* external_lsas lst */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,7 +798,8 @@ ospf_ase_incremental_update (struct ospf *ospf, struct ospf_lsa *lsa)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rn = route_node_lookup (ospf->external_lsas, (struct prefix *) &p);
|
rn = route_node_lookup (ospf->external_lsas, (struct prefix *) &p);
|
||||||
assert (rn && rn->info);
|
assert (rn);
|
||||||
|
assert (rn->info);
|
||||||
lsas = rn->info;
|
lsas = rn->info;
|
||||||
route_unlock_node (rn);
|
route_unlock_node (rn);
|
||||||
|
|
||||||
|
@ -120,7 +120,10 @@ ospf_lsdb_add (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
|
|||||||
|
|
||||||
/* nothing to do? */
|
/* nothing to do? */
|
||||||
if (rn->info && rn->info == lsa)
|
if (rn->info && rn->info == lsa)
|
||||||
return;
|
{
|
||||||
|
route_unlock_node (rn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* purge old entry? */
|
/* purge old entry? */
|
||||||
if (rn->info)
|
if (rn->info)
|
||||||
@ -162,12 +165,13 @@ ospf_lsdb_delete (struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert (lsa->data->type < OSPF_MAX_LSA);
|
||||||
table = lsdb->type[lsa->data->type].db;
|
table = lsdb->type[lsa->data->type].db;
|
||||||
lsdb_prefix_set (&lp, lsa);
|
lsdb_prefix_set (&lp, lsa);
|
||||||
rn = route_node_lookup (table, (struct prefix *) &lp);
|
if ((rn = route_node_lookup (table, (struct prefix *) &lp)))
|
||||||
if (rn && (rn->info == lsa))
|
|
||||||
{
|
{
|
||||||
ospf_lsdb_delete_entry (lsdb, rn);
|
if (rn->info == lsa)
|
||||||
|
ospf_lsdb_delete_entry (lsdb, rn);
|
||||||
route_unlock_node (rn); /* route_node_lookup */
|
route_unlock_node (rn); /* route_node_lookup */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,7 +278,8 @@ ospf_lsdb_lookup_by_id_next (struct ospf_lsdb *lsdb, u_char type,
|
|||||||
rn = route_top (table);
|
rn = route_top (table);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rn = route_node_get (table, (struct prefix *) &lp);
|
if ((rn = route_node_lookup (table, (struct prefix *) &lp)) == NULL)
|
||||||
|
return NULL;
|
||||||
rn = route_next (rn);
|
rn = route_next (rn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user