]> git.proxmox.com Git - mirror_frr.git/commit - lib/if.c
lib: fix vrf deletion when the last interface is deleted
authorIgor Ryzhov <iryzhov@nfware.com>
Fri, 5 Nov 2021 22:22:07 +0000 (01:22 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Thu, 11 Nov 2021 11:57:59 +0000 (14:57 +0300)
commitce27a13e90885de3a830e4ec78afc9efeadae42e
treeb1417330f259a03ee93bea098330e71d5a8c234b
parent0ac8055ca1a9662d6e8197dff9a91759331991e7
lib: fix vrf deletion when the last interface is deleted

Currently, we automatically delete an inactive VRF when its last
interface is deleted. This code introduces a couple of crashes because
of the following problems:
- vrf_delete is called before calling if_del hook, so daemons may try to
  dereference an ifp->vrf pointer which is freed
- in if_terminate, we continue to use the VRF in the loop condition
  after the last interface is deleted

This check is needed only when the interface is deleted by the user,
because if the interface is deleted by the system, VRF must still exist
in the system. Move the check to appropriate places to fix crashes.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
lib/if.c
lib/vrf.c
ospfd/ospf_interface.c