From beef199002568adfc8d64f0bda289ace3e2badd2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 13 May 2016 12:24:50 +0000 Subject: [PATCH] lib: Fix crash in 'no vrf' command If a routing protocol does not have a vrf configed and the vrf happens to be down a 'no vrf X' line will cause the system to crash. This fixes the issue, I do believe though that we need to revisit the issue and re-think start/stop/config/unconfig of vrf's a bit more. Ticket: CM-10952 Signed-off-by: Donald Sharp Signed-off-by: Dinesh Dutt --- lib/zclient.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/zclient.c b/lib/zclient.c index 35a5b9e857..d86b576c1b 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -974,6 +974,14 @@ zclient_vrf_delete (struct stream *s, vrf_id_t vrf_id) /* Lookup vrf by vrf_id. */ vrf = vrf_lookup (vrf_id); + /* + * If a routing protocol doesn't know about a + * vrf that is about to be deleted. There is + * no point in attempting to delete it. + */ + if (!vrf) + return; + vrf_delete (vrf); } -- 2.39.5