summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_neighbor.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-05-14 21:33:54 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2020-05-14 21:35:19 +0200
commite2e60c48bfeee0b9f5486952e37c3602e214f7f1 (patch)
tree7a7d9f45f7a9f44883b1d10aff551a68abd55af5 /ospf6d/ospf6_neighbor.c
parentMerge pull request #6377 from ton31337/fix/bgpd_statistics (diff)
downloadfrr-e2e60c48bfeee0b9f5486952e37c3602e214f7f1.tar.xz
frr-e2e60c48bfeee0b9f5486952e37c3602e214f7f1.zip
ospf6d: Revert "ospf6d: Prevent use after free"
This reverts commit 0f9f74baeb97f437d7acf7feda0f400d50943c4c. This commit was causing crashes and the goal of this commit was to make coverity sanity happy. I'd rather have coverity sad and not have ospfv3 crash Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ospf6d/ospf6_neighbor.c')
-rw-r--r--ospf6d/ospf6_neighbor.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c
index 1e90d4b9b..92a3c9e1a 100644
--- a/ospf6d/ospf6_neighbor.c
+++ b/ospf6d/ospf6_neighbor.c
@@ -118,15 +118,11 @@ struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id,
void ospf6_neighbor_delete(struct ospf6_neighbor *on)
{
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
-
- for (iterend = ospf6_lsdb_head(on->retrans_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->retrans_list, lsa)) {
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}
@@ -297,8 +293,7 @@ int twoway_received(struct thread *thread)
int negotiation_done(struct thread *thread)
{
struct ospf6_neighbor *on;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
assert(on);
@@ -312,10 +307,7 @@ int negotiation_done(struct thread *thread)
/* clear ls-list */
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
-
- for (iterend = ospf6_lsdb_head(on->retrans_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->retrans_list, lsa)) {
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}
@@ -509,8 +501,7 @@ int seqnumber_mismatch(struct thread *thread)
int bad_lsreq(struct thread *thread)
{
struct ospf6_neighbor *on;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
assert(on);
@@ -529,10 +520,7 @@ int bad_lsreq(struct thread *thread)
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
-
- for (iterend = ospf6_lsdb_head(on->retrans_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->retrans_list, lsa)) {
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}
@@ -550,8 +538,7 @@ int bad_lsreq(struct thread *thread)
int oneway_received(struct thread *thread)
{
struct ospf6_neighbor *on;
- struct ospf6_lsa *lsa, *lsa_next;
- const struct route_node *iterend;
+ struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *)THREAD_ARG(thread);
assert(on);
@@ -568,9 +555,7 @@ int oneway_received(struct thread *thread)
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
- for (iterend = ospf6_lsdb_head(on->retrans_list, 0, 0, 0, &lsa); lsa;
- lsa = lsa_next) {
- lsa_next = ospf6_lsdb_next(iterend, lsa);
+ for (ALL_LSDB(on->retrans_list, lsa)) {
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}