From 5e280e568809c18589cc58d785c7f49e0bab3945 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Thu, 22 Mar 2018 18:00:10 +0100 Subject: [PATCH] zebra: move hash rules creation to the vrf_enable place The vrf netns usage makes a crash, when deleting vrf, due to the hash list of rules not initialised for non default VRF. Signed-off-by: Philippe Guibert --- zebra/zebra_ns.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index 29c179245b..d841bdeec4 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -135,6 +135,10 @@ int zebra_ns_enable(ns_id_t ns_id, void **info) zns->ns_id = ns_id; + zns->rules_hash = + hash_create_size(8, zebra_pbr_rules_hash_key, + zebra_pbr_rules_hash_equal, "Rules Hash"); + #if defined(HAVE_RTADV) rtadv_init(zns); #endif @@ -287,9 +291,6 @@ int zebra_ns_init(void) /* Default NS is activated */ zebra_ns_enable(ns_id, (void **)&dzns); - dzns->rules_hash = - hash_create_size(8, zebra_pbr_rules_hash_key, - zebra_pbr_rules_hash_equal, "Rules Hash"); if (vrf_is_backend_netns()) { ns_add_hook(NS_NEW_HOOK, zebra_ns_new); ns_add_hook(NS_ENABLE_HOOK, zebra_ns_enabled); -- 2.39.5