Merge pull request #14568 from FRRouting/mergify/bp/dev/9.1/pr-14437

vtysh freezed on ospf 'no network' command when there are multiple networks and interfaces (backport #14437)
This commit is contained in:
Donatas Abraitis 2023-10-12 16:26:29 +03:00 committed by GitHub
commit 951cafa2ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1257,8 +1257,9 @@ int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p,
{ {
struct route_node *rn; struct route_node *rn;
struct ospf_network *network; struct ospf_network *network;
struct listnode *node, *nnode; struct listnode *node;
struct ospf_interface *oi; struct ospf_interface *oi;
struct list *ospf_oiflist = NULL;
rn = route_node_lookup(ospf->networks, (struct prefix *)p); rn = route_node_lookup(ospf->networks, (struct prefix *)p);
if (rn == NULL) if (rn == NULL)
@ -1273,8 +1274,9 @@ int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p,
rn->info = NULL; rn->info = NULL;
route_unlock_node(rn); /* initial reference */ route_unlock_node(rn); /* initial reference */
ospf_oiflist = list_dup(ospf->oiflist);
/* Find interfaces that are not configured already. */ /* Find interfaces that are not configured already. */
for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi)) { for (ALL_LIST_ELEMENTS_RO(ospf_oiflist, node, oi)) {
if (oi->type == OSPF_IFTYPE_VIRTUALLINK) if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
continue; continue;
@ -1282,6 +1284,8 @@ int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p,
ospf_network_run_subnet(ospf, oi->connected, NULL, NULL); ospf_network_run_subnet(ospf, oi->connected, NULL, NULL);
} }
list_delete(&ospf_oiflist);
/* Update connected redistribute. */ /* Update connected redistribute. */
update_redistributed(ospf, 0); /* interfaces possibly removed */ update_redistributed(ospf, 0); /* interfaces possibly removed */
ospf_area_check_free(ospf, area_id); ospf_area_check_free(ospf, area_id);
@ -1289,6 +1293,7 @@ int ospf_network_unset(struct ospf *ospf, struct prefix_ipv4 *p,
return 1; return 1;
} }
/* Ensure there's an OSPF instance, as "ip ospf area" enabled OSPF means /* Ensure there's an OSPF instance, as "ip ospf area" enabled OSPF means
* there might not be any 'router ospf' config. * there might not be any 'router ospf' config.
* *