zebra: anticipate zns creation at vrf creation when backend is vrf-lite

in the case the namespace pointer is already available, feed it at vrf
creation. this prevents from crashing if the netlink parsing already
began, and the vrf-lite is not enabled yet.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2020-12-08 11:11:05 +00:00
parent d5ecf80558
commit 91b1421e84

View File

@ -107,6 +107,8 @@ static int zebra_vrf_new(struct vrf *vrf)
zvrf = zebra_vrf_alloc(); zvrf = zebra_vrf_alloc();
vrf->info = zvrf; vrf->info = zvrf;
zvrf->vrf = vrf; zvrf->vrf = vrf;
if (!vrf_is_backend_netns())
zvrf->zns = zebra_ns_lookup(NS_DEFAULT);
otable_init(&zvrf->other_tables); otable_init(&zvrf->other_tables);