From 9f4ffd809a24b55da45198e07e7232679dd75a8c Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Mon, 18 Oct 2021 17:16:35 +0300 Subject: ospfd: fix crash when creating vlink in unknown vrf if_create_name crashes when vrf_id is VRF_UNKNOWN: ``` nfware# conf t nfware(config)# router ospf vrf doesnt-exist nfware(config-router)# area 1.1.1.1 virtual-link 2.2.2.2 vtysh: error reading from ospfd: Success (0)Warning: closing connection to ospfd because of an I/O error! ``` Signed-off-by: Igor Ryzhov --- ospfd/ospf_interface.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ospfd/ospf_interface.c') diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index eb7a8348e8..2fea385594 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -909,6 +909,13 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf, return NULL; } + if (ospf->vrf_id == VRF_UNKNOWN) { + if (IS_DEBUG_OSPF_EVENT) + zlog_debug( + "ospf_vl_new(): Alarm: cannot create pseudo interface in unknown VRF"); + return NULL; + } + if (IS_DEBUG_OSPF_EVENT) zlog_debug( "ospf_vl_new(): creating pseudo zebra interface vrf id %u", -- cgit v1.2.3