mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 09:52:27 +00:00
isisd: fix some crashes with --tcli
The "ifp" variable returned by nb_running_get_entry() might be NULL when using the transactional CLI mode. Make the required modifications to avoid null pointer dereferences. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
e33b95b4bb
commit
db0a0f2e7b
@ -170,15 +170,19 @@ DEFPY_YANG(ip_router_isis, ip_router_isis_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
|
ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
|
||||||
|
if (!vrf_name) {
|
||||||
if (!vrf_name && ifp->vrf_id == VRF_DEFAULT)
|
if (ifp) {
|
||||||
vrf_name = VRF_DEFAULT_NAME;
|
if (ifp->vrf_id == VRF_DEFAULT)
|
||||||
|
vrf_name = VRF_DEFAULT_NAME;
|
||||||
if (ifp->vrf_id != VRF_DEFAULT) {
|
else {
|
||||||
vrf = vrf_lookup_by_id(ifp->vrf_id);
|
vrf = vrf_lookup_by_id(ifp->vrf_id);
|
||||||
if (vrf && !vrf_name)
|
if (vrf && !vrf_name)
|
||||||
vrf_name = vrf->name;
|
vrf_name = vrf->name;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
vrf_name = VRF_DEFAULT_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
area = isis_area_lookup_by_vrf(tag, vrf_name);
|
area = isis_area_lookup_by_vrf(tag, vrf_name);
|
||||||
if (!area) {
|
if (!area) {
|
||||||
isis_global_instance_create(vrf_name);
|
isis_global_instance_create(vrf_name);
|
||||||
@ -235,7 +239,7 @@ DEFPY_YANG(ip_router_isis, ip_router_isis_cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if the interface is a loopback and if so set it as passive */
|
/* check if the interface is a loopback and if so set it as passive */
|
||||||
if (if_is_loopback(ifp))
|
if (ifp && if_is_loopback(ifp))
|
||||||
nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
|
nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
|
||||||
NB_OP_MODIFY, "true");
|
NB_OP_MODIFY, "true");
|
||||||
|
|
||||||
@ -263,14 +267,19 @@ DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
|
ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
|
||||||
if (!vrf_name && ifp->vrf_id == VRF_DEFAULT)
|
if (!vrf_name) {
|
||||||
vrf_name = VRF_DEFAULT_NAME;
|
if (ifp) {
|
||||||
|
if (ifp->vrf_id == VRF_DEFAULT)
|
||||||
if (ifp->vrf_id != VRF_DEFAULT) {
|
vrf_name = VRF_DEFAULT_NAME;
|
||||||
vrf = vrf_lookup_by_id(ifp->vrf_id);
|
else {
|
||||||
if (vrf && !vrf_name)
|
vrf = vrf_lookup_by_id(ifp->vrf_id);
|
||||||
vrf_name = vrf->name;
|
if (vrf && !vrf_name)
|
||||||
|
vrf_name = vrf->name;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
vrf_name = VRF_DEFAULT_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
area = isis_area_lookup_by_vrf(tag, vrf_name);
|
area = isis_area_lookup_by_vrf(tag, vrf_name);
|
||||||
if (!area) {
|
if (!area) {
|
||||||
isis_global_instance_create(vrf_name);
|
isis_global_instance_create(vrf_name);
|
||||||
@ -326,7 +335,7 @@ DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if the interface is a loopback and if so set it as passive */
|
/* check if the interface is a loopback and if so set it as passive */
|
||||||
if (if_is_loopback(ifp))
|
if (ifp && if_is_loopback(ifp))
|
||||||
nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
|
nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
|
||||||
NB_OP_MODIFY, "true");
|
NB_OP_MODIFY, "true");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user