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

ospfd: Assure OSPF AS External routes are installed after link flap #15593

Merged
Merged
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
2 changes: 1 addition & 1 deletion ospfd/ospf_ase.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ static int ospf_ase_route_match_same(struct route_table *rt,

assert(or);

if (or->path_type != newor->path_type)
if (or->changed || (or->path_type != newor->path_type))
return 0;

switch (or->path_type) {
Expand Down
51 changes: 33 additions & 18 deletions ospfd/ospf_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,41 @@ int ospf_if_up(struct ospf_interface *oi)
return 1;
}

int ospf_if_down(struct ospf_interface *oi)
/* This function will mark routes with next-hops matching the down
* OSPF interface as changed. It is used to assure routes that get
* removed from the zebra RIB when an interface goes down are
* reinstalled if the interface comes back up prior to an intervening
* SPF calculation.
*/
static void ospf_if_down_mark_routes_changed(struct route_table *table,
struct ospf_interface *oi)
{
struct ospf *ospf;
struct route_node *rn;
struct ospf_route *or;
struct listnode *nh;
struct ospf_path *op;

for (rn = route_top(table); rn; rn = route_next(rn)) {
or = rn->info;

if (or == NULL)
continue;

for (nh = listhead(or->paths); nh;
nh = listnextnode_unchecked(nh)) {
op = listgetdata(nh);
if (op->ifindex == oi->ifp->ifindex) {
or->changed = true;
break;
}
}
}
}

int ospf_if_down(struct ospf_interface *oi)
{
struct ospf *ospf;

if (oi == NULL)
return 0;

Expand Down Expand Up @@ -864,23 +891,11 @@ int ospf_if_down(struct ospf_interface *oi)
/* Shutdown packet reception and sending */
ospf_if_stream_unset(oi);

if (!ospf->new_table)
return 1;
for (rn = route_top(ospf->new_table); rn; rn = route_next(rn)) {
or = rn->info;

if (!or)
continue;
if (ospf->new_table)
ospf_if_down_mark_routes_changed(ospf->new_table, oi);

for (nh = listhead(or->paths); nh;
nh = listnextnode_unchecked(nh)) {
op = listgetdata(nh);
if (op->ifindex == oi->ifp->ifindex) {
or->changed = true;
break;
}
}
}
if (ospf->new_external_route)
ospf_if_down_mark_routes_changed(ospf->new_external_route, oi);

return 1;
}
Expand Down
Loading