mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 10:49:24 +00:00
ospfd: fix check for network configuration
We should check for existing networks configuration before creating if_params structure, or it leads to the memory leak. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
5e28025a5b
commit
eb364867d4
@ -8168,6 +8168,16 @@ DEFUN (ip_ospf_area,
|
|||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ospf) {
|
||||||
|
for (rn = route_top(ospf->networks); rn; rn = route_next(rn)) {
|
||||||
|
if (rn->info != NULL) {
|
||||||
|
vty_out(vty,
|
||||||
|
"Please remove all network commands first.\n");
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
params = IF_DEF_PARAMS(ifp);
|
params = IF_DEF_PARAMS(ifp);
|
||||||
if (OSPF_IF_PARAM_CONFIGURED(params, if_area)
|
if (OSPF_IF_PARAM_CONFIGURED(params, if_area)
|
||||||
&& !IPV4_ADDR_SAME(¶ms->if_area, &area_id)) {
|
&& !IPV4_ADDR_SAME(¶ms->if_area, &area_id)) {
|
||||||
@ -8193,16 +8203,6 @@ DEFUN (ip_ospf_area,
|
|||||||
ospf_if_update_params((ifp), (addr));
|
ospf_if_update_params((ifp), (addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ospf) {
|
|
||||||
for (rn = route_top(ospf->networks); rn; rn = route_next(rn)) {
|
|
||||||
if (rn->info != NULL) {
|
|
||||||
vty_out(vty,
|
|
||||||
"Please remove all network commands first.\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* enable ospf on this interface with area_id */
|
/* enable ospf on this interface with area_id */
|
||||||
if (params) {
|
if (params) {
|
||||||
SET_IF_PARAM(params, if_area);
|
SET_IF_PARAM(params, if_area);
|
||||||
|
Loading…
Reference in New Issue
Block a user