From: Philippe Guibert Date: Thu, 22 Mar 2018 17:00:10 +0000 (+0100) Subject: zebra: move hash rules creation to the vrf_enable place X-Git-Tag: frr-5.0-dev~120^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=5e280e568809c18589cc58d785c7f49e0bab3945;p=matthieu%2Ffrr.git 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 --- 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);