Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ospf6d: ospf6_route_add - stack repeats #6083

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions ospf6d/ospf6_abr.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
struct listnode *anode;
char adv_router[16];

if (oa->running_ospf6_abr_examin_summary)
return;

oa->running_ospf6_abr_examin_summary = 1;

memset(&prefix, 0, sizeof(prefix));

if (lsa->header->type == htons(OSPF6_LSTYPE_INTER_PREFIX)) {
Expand Down Expand Up @@ -974,6 +979,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
zlog_debug("cost is LS_INFINITY, ignore");
if (old)
ospf6_abr_old_route_remove(lsa, old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}
if (OSPF6_LSA_IS_MAXAGE(lsa)) {
Expand All @@ -982,6 +989,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
lsa->name);
if (old)
ospf6_abr_old_route_remove(lsa, old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}

Expand All @@ -992,6 +1001,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
lsa->name);
if (old)
ospf6_route_remove(old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}

Expand All @@ -1008,6 +1019,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
"Prefix is equal to address range, ignore");
if (old)
ospf6_route_remove(old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}

Expand All @@ -1019,6 +1032,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
zlog_debug("Prefix has NU/LA bit set, ignore");
if (old)
ospf6_route_remove(old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}
}
Expand All @@ -1033,6 +1048,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
if (old)
ospf6_route_remove(old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}
/* Avoid infinite recursion if someone has maliciously announced
Expand All @@ -1047,6 +1063,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
if (old)
ospf6_route_remove(old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}
}
Expand Down Expand Up @@ -1076,6 +1093,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
ospf6_route_remove(old, table);
}
}

oa->running_ospf6_abr_examin_summary = 0;
return;
}

Expand All @@ -1093,6 +1112,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
"Prefix was denied by import-list");
if (old)
ospf6_route_remove(old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}
}
Expand All @@ -1105,6 +1126,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
zlog_debug("Prefix was denied by prefix-list");
if (old)
ospf6_route_remove(old, table);

oa->running_ospf6_abr_examin_summary = 0;
return;
}
}
Expand Down Expand Up @@ -1240,6 +1263,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
/* ospf6_ia_add_nw_route (table, &prefix, route); */
ospf6_route_add(route, table);
}

oa->running_ospf6_abr_examin_summary = 0;
}

void ospf6_abr_examin_brouter(uint32_t router_id)
Expand Down
10 changes: 10 additions & 0 deletions ospf6d/ospf6_area.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ struct ospf6_area {
/* Brouter traversal protection */
int intra_brouter_calc;

/*
* Temporary fix to avoid the race condition
* #8 in ospf6_abr_examin_summary
* #9 in ospf6_abr_examin_brouter
* #10 in ospf6_top_brouter_hook_add
* #11 in ospf6_route_add
* #12 in ospf6_abr_examin_summary
*/
int running_ospf6_abr_examin_summary;

/* OSPF interface list */
struct list *if_list;

Expand Down