]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: move iface lib initialization to a proper place
authorIgor Ryzhov <iryzhov@nfware.com>
Sun, 23 Jan 2022 21:16:59 +0000 (00:16 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Mon, 24 Jan 2022 17:14:18 +0000 (20:14 +0300)
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
pimd/pim6_main.c
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_main.c

index 02654e1cb649e2efd9022aa79589cc47f4d208f6..3d8ebd0d8665ef74684dbf2ba2b4a5c488f4c0fc 100644 (file)
@@ -178,8 +178,7 @@ int main(int argc, char **argv, char **envp)
        /*
         * Initialize zclient "update" and "lookup" sockets
         */
-       if_zapi_callbacks(pim_ifp_create, pim_ifp_up,
-                         pim_ifp_down, pim_ifp_destroy);
+       pim_iface_init();
 
        /* TODO PIM6: next line is temporary since pim_cmd_init is disabled */
        if_cmd_init(NULL);
index 8b27809c7c1ae06946896caaad5589828a5a9d93..6727be01bcaba1978b984c4c37799cb9d5f46bd5 100644 (file)
@@ -1521,7 +1521,7 @@ int pim_if_ifchannel_count(struct pim_interface *pim_ifp)
        return count;
 }
 
-int pim_ifp_create(struct interface *ifp)
+static int pim_ifp_create(struct interface *ifp)
 {
        struct pim_instance *pim;
 
@@ -1589,7 +1589,7 @@ int pim_ifp_create(struct interface *ifp)
        return 0;
 }
 
-int pim_ifp_up(struct interface *ifp)
+static int pim_ifp_up(struct interface *ifp)
 {
        struct pim_interface *pim_ifp;
        struct pim_instance *pim;
@@ -1645,7 +1645,7 @@ int pim_ifp_up(struct interface *ifp)
        return 0;
 }
 
-int pim_ifp_down(struct interface *ifp)
+static int pim_ifp_down(struct interface *ifp)
 {
        if (PIM_DEBUG_ZEBRA) {
                zlog_debug(
@@ -1681,7 +1681,7 @@ int pim_ifp_down(struct interface *ifp)
        return 0;
 }
 
-int pim_ifp_destroy(struct interface *ifp)
+static int pim_ifp_destroy(struct interface *ifp)
 {
        struct pim_instance *pim;
 
@@ -1702,3 +1702,22 @@ int pim_ifp_destroy(struct interface *ifp)
 
        return 0;
 }
+
+static int pim_if_new_hook(struct interface *ifp)
+{
+       return 0;
+}
+
+static int pim_if_delete_hook(struct interface *ifp)
+{
+       return 0;
+}
+
+void pim_iface_init(void)
+{
+       hook_register_prio(if_add, 0, pim_if_new_hook);
+       hook_register_prio(if_del, 0, pim_if_delete_hook);
+
+       if_zapi_callbacks(pim_ifp_create, pim_ifp_up, pim_ifp_down,
+                         pim_ifp_destroy);
+}
index f251c55e72af8dd7a5ebb3d6c56d43f1e2cf1c1f..1ddf743619dfdc5d4e2d1bca4bf4e56e9169bd7d 100644 (file)
@@ -259,9 +259,6 @@ bool pim_if_is_vrf_device(struct interface *ifp);
 
 int pim_if_ifchannel_count(struct pim_interface *pim_ifp);
 
-extern int pim_ifp_create(struct interface *ifp);
-extern int pim_ifp_up(struct interface *ifp);
-extern int pim_ifp_down(struct interface *ifp);
-extern int pim_ifp_destroy(struct interface *ifp);
+void pim_iface_init(void);
 
 #endif /* PIM_IFACE_H */
index eb1cedd90ddafa2b948034fbd0fe1365764e198e..92c34f51a1433416c9bf2d82ab670da0bf1760ff 100644 (file)
@@ -136,8 +136,7 @@ int main(int argc, char **argv, char **envp)
        /*
         * Initialize zclient "update" and "lookup" sockets
         */
-       if_zapi_callbacks(pim_ifp_create, pim_ifp_up,
-                         pim_ifp_down, pim_ifp_destroy);
+       pim_iface_init();
        pim_zebra_init();
        pim_bfd_init();
        pim_mlag_init();