Skip to content

Commit 79c23c4

Browse files
authored
Merge pull request FRRouting#9845 from idryzhov/8.1-ospf-vlink-crash
[8.1] ospfd: fix crash when creating vlink in unknown vrf
2 parents cc6a704 + 9f4ffd8 commit 79c23c4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ospfd/ospf_interface.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,13 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
909909
return NULL;
910910
}
911911

912+
if (ospf->vrf_id == VRF_UNKNOWN) {
913+
if (IS_DEBUG_OSPF_EVENT)
914+
zlog_debug(
915+
"ospf_vl_new(): Alarm: cannot create pseudo interface in unknown VRF");
916+
return NULL;
917+
}
918+
912919
if (IS_DEBUG_OSPF_EVENT)
913920
zlog_debug(
914921
"ospf_vl_new(): creating pseudo zebra interface vrf id %u",

ospfd/ospf_vty.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,12 @@ ospf_find_vl_data(struct ospf *ospf, struct ospf_vl_config_data *vl_config)
892892
vl_data = ospf_vl_data_new(area, vl_config->vl_peer);
893893
if (vl_data->vl_oi == NULL) {
894894
vl_data->vl_oi = ospf_vl_new(ospf, vl_data);
895+
if (!vl_data->vl_oi) {
896+
ospf_vl_data_free(vl_data);
897+
vty_out(vty,
898+
"Can't create VL, check logs for more information\n");
899+
return NULL;
900+
}
895901
ospf_vl_add(ospf, vl_data);
896902
ospf_spf_calculate_schedule(ospf,
897903
SPF_FLAG_CONFIG_CHANGE);

0 commit comments

Comments
 (0)