From 921a85ba8c92eea6e104dea002870e323e5a19b5 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 2 Apr 2019 18:40:35 +0200 Subject: zebra, ifp: on netlink discovery, anticipate the vrf creation there may be cases where the vrf is yet allocated from the vty, and the discovery process did not make the relationship between the vrf_id and the name of the vrf. For instance, by parsing an interface belonging to vrf-id X, it is not sure that vrf-id X and vrfname XX are talking about the same vrf. For that, lets allocate the vrf, and lets try to detect there is a duplicate case in vrf, so that the merge can be done without any impact for the user. Signed-off-by: Philippe Guibert --- lib/if.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/if.c') diff --git a/lib/if.c b/lib/if.c index 0cfd591160..a803754375 100644 --- a/lib/if.c +++ b/lib/if.c @@ -177,6 +177,8 @@ void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id) if (ifp->ifindex != IFINDEX_INTERNAL) IFINDEX_RB_INSERT(vrf, ifp); + if (!old_vrf->name) + return; /* * HACK: Change the interface VRF in the running configuration directly, * bypassing the northbound layer. This is necessary to avoid deleting -- cgit v1.2.3