]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: move hash rules creation to the vrf_enable place
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 22 Mar 2018 17:00:10 +0000 (18:00 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 23 Mar 2018 08:04:33 +0000 (09:04 +0100)
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 <philippe.guibert@6wind.com>
zebra/zebra_ns.c

index 29c179245bf9398a1275fee0d1b0b0dc0cde32cd..d841bdeec4784590abb5b298ce176386b1a8f04f 100644 (file)
@@ -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);