summaryrefslogtreecommitdiff
path: root/ospfd/ospf_opaque.c
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2006-07-26 09:37:26 +0000
committerPaul Jakma <paul.jakma@sun.com>2006-07-26 09:37:26 +0000
commit1fe6ed38cd0136c514aabae01389653beab27fb9 (patch)
tree21f10bc3f9c5afffe9f28e5dbf4e6198cfafba5b /ospfd/ospf_opaque.c
parent3fed4160cd23f1767d8980e8cba10bc3933947d5 (diff)
[ospfd] Allow ospf_lsa_unlock to NULL out callers' LSA pointers upon free
2006-07-26 Paul Jakma <paul.jakma@sun.com> * ospf_lsa.{c,h}: (ospf_lsa_unlock) Change to take a double pointer to the LSA to be 'unlocked', so that, if the LSA is freed, the callers pointer to the LSA can be NULLed out, allowing any further use of that pointer to provoke a crash sooner rather than later. * ospf_*.c: (general) Adjust callers of ospf_lsa_unlock to match previous. Try annotate 'locking' somewhat to show which 'locks' are protecting what LSA reference, if not obvious. * ospf_opaque.c: (ospf_opaque_lsa_install) Trivial: remove useless goto, replace with return. * ospf_packet.c: (ospf_make_ls_ack) Trivial: merge two list loops, the dual-loop predated the delete-safe list-loop macro.
Diffstat (limited to 'ospfd/ospf_opaque.c')
-rw-r--r--ospfd/ospf_opaque.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index f2496cfd..0b6ac4cb 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -708,7 +708,7 @@ free_opaque_info_per_id (void *val)
OSPF_TIMER_OFF (oipi->t_opaque_lsa_self);
if (oipi->lsa != NULL)
- ospf_lsa_unlock (oipi->lsa);
+ ospf_lsa_unlock (&oipi->lsa);
XFREE (MTYPE_OPAQUE_INFO_PER_ID, oipi);
return;
}
@@ -1554,7 +1554,7 @@ ospf_opaque_lsa_install (struct ospf_lsa *lsa, int rt_recalc)
if ((oipt = lookup_opaque_info_by_type (lsa)) != NULL
&& (oipi = lookup_opaque_info_by_id (oipt, lsa)) != NULL)
{
- ospf_lsa_unlock (oipi->lsa);
+ ospf_lsa_unlock (&oipi->lsa);
oipi->lsa = ospf_lsa_lock (lsa);
}
/* Register the new lsa entry and get its control info. */
@@ -2234,7 +2234,7 @@ ospf_opaque_self_originated_lsa_received (struct ospf_neighbor *nbr,
u_char before;
if ((top = oi_to_top (nbr->oi)) == NULL)
- goto out;
+ return;
before = IS_OPAQUE_LSA_ORIGINATION_BLOCKED (top->opaque);
@@ -2259,7 +2259,7 @@ ospf_opaque_self_originated_lsa_received (struct ospf_neighbor *nbr,
break;
default:
zlog_warn ("ospf_opaque_self_originated_lsa_received: Unexpected LSA-type(%u)", lsa->data->type);
- goto out;
+ return;
}
ospf_lsa_discard (lsa); /* List "lsas" will be deleted by caller. */
@@ -2269,9 +2269,6 @@ ospf_opaque_self_originated_lsa_received (struct ospf_neighbor *nbr,
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("Block Opaque-LSA origination: OFF -> ON");
}
-
-out:
- return;
}
void