]> git.puffer.fish Git - mirror/frr.git/commitdiff
*: Add infrastructure to support zapi interface callbacks
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 18 Sep 2019 20:20:04 +0000 (16:20 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 19 Sep 2019 17:34:06 +0000 (13:34 -0400)
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.

This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff

Create 4 new callback functions that will be controlled by
lib/if.c

create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.

At this point this is just boilerplate setup for future commits.
There is no new functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
30 files changed:
babeld/babel_interface.c
babeld/babel_interface.h
babeld/babel_main.c
bfdd/ptm_adapter.c
bgpd/bgp_zebra.c
eigrpd/eigrp_interface.c
eigrpd/eigrp_interface.h
isisd/isis_circuit.c
ldpd/ldp_zebra.c
lib/if.c
lib/if.h
nhrpd/nhrp_interface.c
nhrpd/nhrp_main.c
nhrpd/nhrpd.h
ospf6d/ospf6_interface.c
ospfd/ospf_interface.c
pbrd/pbr_main.c
pbrd/pbr_zebra.c
pbrd/pbr_zebra.h
pimd/pim_iface.c
pimd/pim_iface.h
pimd/pim_main.c
ripd/rip_interface.c
ripngd/ripng_interface.c
sharpd/sharp_zebra.c
staticd/static_zebra.c
vrrpd/vrrp_vty.c
vrrpd/vrrp_zebra.c
vrrpd/vrrp_zebra.h
zebra/interface.c

index 0eeb9b2bbbfaac3d459ed23831a15e16cfd6cea7..898848f84e00b5c956372a34e5e5ed9da4548e91 100644 (file)
@@ -1260,6 +1260,26 @@ DEFUN (show_babel_parameters,
     return CMD_SUCCESS;
 }
 
+int babel_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+int babel_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+int babel_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+int babel_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void
 babel_if_init(void)
 {
index d9e2745827067df91a58024c3aeb534c751612b9..9833827927e64900bd84e83a2d6f2a7647d5bc1f 100644 (file)
@@ -121,6 +121,11 @@ int babel_interface_delete (int, struct zclient *, zebra_size_t, vrf_id_t);
 int babel_interface_address_add (int, struct zclient *, zebra_size_t, vrf_id_t);
 int babel_interface_address_delete (int, struct zclient *, zebra_size_t, vrf_id_t);
 
+int babel_ifp_create(struct interface *ifp);
+int babel_ifp_up(struct interface *ifp);
+int babel_ifp_down(struct interface *ifp);
+int babel_ifp_destroy(struct interface *ifp);
+
 unsigned jitter(babel_interface_nfo *, int);
 unsigned update_jitter(babel_interface_nfo *babel_ifp, int urgent);
 /* return "true" if "address" is one of our ipv6 addresses */
index a3f2b4e7d846457bdd80fee08e68913aec3aa767..4bb840815735e07d68c6894b872fac254b558bb3 100644 (file)
@@ -202,6 +202,8 @@ main(int argc, char **argv)
     babel_replace_by_null(STDIN_FILENO);
 
     /* init some quagga's dependencies, and babeld's commands */
+    if_zapi_callbacks(babel_ifp_create, babel_ifp_up,
+                     babel_ifp_down, babel_ifp_destroy);
     babeld_quagga_init();
     /* init zebra client's structure and it's commands */
     /* this replace kernel_setup && kernel_setup_socket */
index ae6d04e77d5e72065a20304847d41b2c5fdf97c2..2d1b17ce4a62d17abeb7888d0deb01b6cb40504d 100644 (file)
@@ -756,8 +756,19 @@ static int bfdd_interface_address_update(ZAPI_CALLBACK_ARGS)
        return 0;
 }
 
+static int bfd_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int bfd_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void bfdd_zclient_init(struct zebra_privs_t *bfdd_priv)
 {
+       if_zapi_callbacks(bfd_ifp_create, NULL, NULL, bfd_ifp_destroy);
        zclient = zclient_new(master, &zclient_options_default);
        assert(zclient != NULL);
        zclient_init(zclient, ZEBRA_ROUTE_BFD, 0, bfdd_priv);
index 71f7f6d0e3fb9f0d176aefa8f3d218b35bef6045..ee523e51cbfae825f5e0b1a803bd13d336f21a54 100644 (file)
@@ -2721,10 +2721,33 @@ stream_failure:         /* for STREAM_GETX */
 
 extern struct zebra_privs_t bgpd_privs;
 
+static int bgp_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int bgp_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int bgp_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int bgp_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void bgp_zebra_init(struct thread_master *master, unsigned short instance)
 {
        zclient_num_connects = 0;
 
+       if_zapi_callbacks(bgp_ifp_create, bgp_ifp_up,
+                         bgp_ifp_down, bgp_ifp_destroy);
+
        /* Set default values. */
        zclient = zclient_new(master, &zclient_options_default);
        zclient_init(zclient, ZEBRA_ROUTE_BGP, 0, &bgpd_privs);
index fd1d3f5cb9e0e1fef680c4665363f2afe762a279..76e101b0101ecb9ac2bd85fb3456dbf6c495e930 100644 (file)
@@ -122,10 +122,32 @@ int eigrp_if_delete_hook(struct interface *ifp)
        return 0;
 }
 
+static int eigrp_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int eigrp_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int eigrp_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int eigrp_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 struct list *eigrp_iflist;
 
 void eigrp_if_init(void)
 {
+       if_zapi_callbacks(eigrp_ifp_create, eigrp_ifp_up,
+                         eigrp_ifp_down, eigrp_ifp_destroy);
        /* Initialize Zebra interface data structure. */
        // hook_register_prio(if_add, 0, eigrp_if_new);
        hook_register_prio(if_del, 0, eigrp_if_delete_hook);
index a18b0b7015d0f1c69d5f07bf9a1c7d78f7b21714..1e66dafde254595c54f7e1e6b1409b31882a7a85 100644 (file)
@@ -63,5 +63,4 @@ extern uint32_t eigrp_scaled_to_bandwidth(uint32_t);
 extern uint32_t eigrp_delay_to_scaled(uint32_t);
 extern uint32_t eigrp_scaled_to_delay(uint32_t);
 
-
 #endif /* ZEBRA_EIGRP_INTERFACE_H_ */
index 5da8e6ee9e2e97cff3d1ef0c589ccb2d385f7a4b..64ec047054300789b54709e7b1e385ae79c4cc85 100644 (file)
@@ -1389,6 +1389,26 @@ int isis_if_delete_hook(struct interface *ifp)
        return 0;
 }
 
+static int isis_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int isis_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int isis_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int isis_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void isis_circuit_init(void)
 {
        /* Initialize Zebra interface data structure */
@@ -1398,4 +1418,6 @@ void isis_circuit_init(void)
        /* Install interface node */
        install_node(&interface_node, isis_interface_config_write);
        if_cmd_init();
+       if_zapi_callbacks(isis_ifp_create, isis_ifp_up,
+                         isis_ifp_down, isis_ifp_destroy);
 }
index 884ae159be437b7c4062bbc099fd62b10e69c9f5..251df738889c49f6bfc73acaf6367b0d6ec55542 100644 (file)
@@ -532,9 +532,32 @@ ldp_zebra_connected(struct zclient *zclient)
 
 extern struct zebra_privs_t ldpd_privs;
 
+static int ldp_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ldp_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ldp_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ldp_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void
 ldp_zebra_init(struct thread_master *master)
 {
+       if_zapi_callbacks(ldp_ifp_create, ldp_ifp_up,
+                         ldp_ifp_down, ldp_ifp_destroy);
+
        /* Set default values. */
        zclient = zclient_new(master, &zclient_options_default);
        zclient_init(zclient, ZEBRA_ROUTE_LDP, 0, &ldpd_privs);
index 371c6bef876ac604e05c3af9ea7c20ae8846b5c2..9d316856da5542fedcb0964d6d153d12d741dd30 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -58,6 +58,13 @@ DEFINE_QOBJ_TYPE(interface)
 DEFINE_HOOK(if_add, (struct interface * ifp), (ifp))
 DEFINE_KOOH(if_del, (struct interface * ifp), (ifp))
 
+struct interface_master{
+       int (*create_hook)(struct interface *ifp);
+       int (*up_hook)(struct interface *ifp);
+       int (*down_hook)(struct interface *ifp);
+       int (*destroy_hook)(struct interface *ifp);
+} ifp_master = { 0, };
+
 /* Compare interface names, returning an integer greater than, equal to, or
  * less than 0, (following the strcmp convention), according to the
  * relationship between ifp1 and ifp2.  Interface names consist of an
@@ -1367,6 +1374,17 @@ void if_cmd_init(void)
        install_element(INTERFACE_NODE, &no_interface_desc_cmd);
 }
 
+void if_zapi_callbacks(int (*create)(struct interface *ifp),
+                      int (*up)(struct interface *ifp),
+                      int (*down)(struct interface *ifp),
+                      int (*destroy)(struct interface *ifp))
+{
+       ifp_master.create_hook = create;
+       ifp_master.up_hook = up;
+       ifp_master.down_hook = down;
+       ifp_master.destroy_hook = destroy;
+}
+
 /* ------- Northbound callbacks ------- */
 
 /*
index ee99fad2e16b68339edb48baa198d724980d25df..ce79a3a46389c1b826f5173269051a2f4244333c 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -558,6 +558,11 @@ void if_link_params_free(struct interface *);
 
 /* Northbound. */
 extern void if_cmd_init(void);
+extern void if_zapi_callbacks(int (*create)(struct interface *ifp),
+                             int (*up)(struct interface *ifp),
+                             int (*down)(struct interface *ifp),
+                             int (*destroy)(struct interface *ifp));
+
 extern const struct frr_yang_module_info frr_interface_info;
 
 #ifdef __cplusplus
index 8f1ba14fe4f200636ae85fcb9eedc505bf94539a..31e19eda3ed383b141d8dafc42643133eb70279d 100644 (file)
@@ -436,3 +436,23 @@ void nhrp_interface_set_source(struct interface *ifp, const char *ifname)
 
        nhrp_interface_update_nbma(ifp);
 }
+
+int nhrp_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+int nhrp_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+int nhrp_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+int nhrp_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
index 969638cd77f14b5284e27239535f76f8fd495347..c6c83614ef55111ad1976498976938e48b9c44d9 100644 (file)
@@ -152,6 +152,8 @@ int main(int argc, char **argv)
        nhrp_vc_init();
        nhrp_packet_init();
        vici_init();
+       if_zapi_callbacks(nhrp_ifp_create, nhrp_ifp_up,
+                         nhrp_ifp_down, nhrp_ifp_destroy);
        nhrp_zebra_init();
        nhrp_shortcut_init();
 
index 670c9f4f18c6878d1e7b7a6d86b925d4310e0bea..50746d9ad5c096ac843bfeb726d9ba74f6ef5137 100644 (file)
@@ -319,6 +319,10 @@ void nhrp_interface_notify_del(struct interface *ifp, struct notifier_block *n);
 void nhrp_interface_set_protection(struct interface *ifp, const char *profile,
                                   const char *fallback_profile);
 void nhrp_interface_set_source(struct interface *ifp, const char *ifname);
+extern int nhrp_ifp_create(struct interface *ifp);
+extern int nhrp_ifp_up(struct interface *ifp);
+extern int nhrp_ifp_down(struct interface *ifp);
+extern int nhrp_ifp_destroy(struct interface *ifp);
 
 int nhrp_nhs_add(struct interface *ifp, afi_t afi, union sockunion *proto_addr,
                 const char *nbma_fqdn);
index 692c84ad08e7f7f82c144f4a4f3ce631fe222782..50e9f80cc21d167105e793430c3f1260aec5fced 100644 (file)
@@ -1935,11 +1935,33 @@ static struct cmd_node interface_node = {
        INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */
 };
 
+static int ospf6_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ospf6_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ospf6_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ospf6_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void ospf6_interface_init(void)
 {
        /* Install interface node. */
        install_node(&interface_node, config_write_ospf6_interface);
        if_cmd_init();
+       if_zapi_callbacks(ospf6_ifp_create, ospf6_ifp_up,
+                         ospf6_ifp_down, ospf6_ifp_destroy);
 
        install_element(VIEW_NODE, &show_ipv6_ospf6_interface_prefix_cmd);
        install_element(VIEW_NODE, &show_ipv6_ospf6_interface_ifname_cmd);
index 387770870811b45a0867c63bb210648695d80beb..3324740d59464f18d294e2f40baed1536c57693f 100644 (file)
@@ -1218,8 +1218,31 @@ uint8_t ospf_default_iftype(struct interface *ifp)
                return OSPF_IFTYPE_BROADCAST;
 }
 
+static int ospf_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ospf_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ospf_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ospf_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void ospf_if_init(void)
 {
+       if_zapi_callbacks(ospf_ifp_create, ospf_ifp_up,
+                         ospf_ifp_down, ospf_ifp_destroy);
+
        /* Initialize Zebra interface data structure. */
        hook_register_prio(if_add, 0, ospf_if_new_hook);
        hook_register_prio(if_del, 0, ospf_if_delete_hook);
index 246d836acf2e05271bac21d80ca15c8dfbdb6dca..bb92703ae48e2cb69f7d85d1197acee7b7847989 100644 (file)
@@ -166,6 +166,8 @@ int main(int argc, char **argv, char **envp)
        access_list_init();
        pbr_nht_init();
        pbr_map_init();
+       if_zapi_callbacks(pbr_ifp_create, pbr_ifp_up,
+                         pbr_ifp_down, pbr_ifp_destroy);
        pbr_zebra_init();
        pbr_vty_init();
 
index d74d0fcd23d35e5acf4eb69e105a5e65164015f2..b8df7fc5ae940ceb16732dc829cc3cc95b4644ac 100644 (file)
@@ -579,3 +579,23 @@ void pbr_send_pbr_map(struct pbr_map_sequence *pbrms,
 
        zclient_send_message(zclient);
 }
+
+int pbr_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+int pbr_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+int pbr_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+int pbr_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
index 4cbefe2636350ea3a5473464d2f4b978b6296cad..d5d938021ae790c391294907b0e3e48eb92816af 100644 (file)
@@ -39,4 +39,10 @@ extern void pbr_send_pbr_map(struct pbr_map_sequence *pbrms,
                             struct pbr_map_interface *pmi, bool install);
 
 extern struct pbr_interface *pbr_if_new(struct interface *ifp);
+
+extern int pbr_ifp_create(struct interface *ifp);
+extern int pbr_ifp_up(struct interface *ifp);
+extern int pbr_ifp_down(struct interface *ifp);
+extern int pbr_ifp_destroy(struct interface *ifp);
+
 #endif
index bdeda2d76b717d5f07a5658517a7542313e3f3e4..d20713b9c520553d1a3b7540933dd677a6a1908e 100644 (file)
@@ -1526,3 +1526,23 @@ int pim_if_ifchannel_count(struct pim_interface *pim_ifp)
 
        return count;
 }
+
+int pim_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+int pim_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+int pim_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+int pim_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
index 1c11e85705189364f398a783d43055808c4b943f..1b76b5230595f24e85e0ffc070816ba73db8b752 100644 (file)
@@ -227,4 +227,10 @@ int pim_update_source_set(struct interface *ifp, struct in_addr source);
 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);
+
 #endif /* PIM_IFACE_H */
index 5a8991c4c0b64332977c07d74239aa94b026c863..6a7dbe769ff26e79e43817bb1f2209834ee0f77a 100644 (file)
@@ -127,6 +127,8 @@ 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_zebra_init();
        pim_bfd_init();
 
index 80561f350ba2abcf901d1873c5447f2477e80387..f20058a173d86b34f9a3bd3879c0d159dd89c6a3 100644 (file)
@@ -1253,6 +1253,26 @@ static int rip_interface_delete_hook(struct interface *ifp)
        return 0;
 }
 
+static int rip_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int rip_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int rip_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int rip_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 /* Allocate and initialize interface vector. */
 void rip_if_init(void)
 {
@@ -1263,4 +1283,6 @@ void rip_if_init(void)
        /* Install interface node. */
        install_node(&interface_node, rip_interface_config_write);
        if_cmd_init();
+       if_zapi_callbacks(rip_ifp_create, rip_ifp_up,
+                         rip_ifp_down, rip_ifp_destroy);
 }
index 9ed9dc28feb22c9de5ae9bda91f6685fe1fe8226..02c35e04cac08b74cd17d6e497a7971c529024b9 100644 (file)
@@ -989,6 +989,26 @@ static struct cmd_node interface_node = {
        INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */
 };
 
+static int ripng_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ripng_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ripng_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int ripng_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 /* Initialization of interface. */
 void ripng_if_init(void)
 {
@@ -999,4 +1019,6 @@ void ripng_if_init(void)
        /* Install interface node. */
        install_node(&interface_node, interface_config_write);
        if_cmd_init();
+       if_zapi_callbacks(ripng_ifp_create, ripng_ifp_up,
+                         ripng_ifp_down, ripng_ifp_destroy);
 }
index 6263f429ea989a1ebb8354a609772e457c0d358f..6e34785554237fb0b57a0ef3a10c26bdd499fd79 100644 (file)
@@ -392,12 +392,35 @@ static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS)
        return 0;
 }
 
+static int sharp_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int sharp_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int sharp_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int sharp_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 extern struct zebra_privs_t sharp_privs;
 
 void sharp_zebra_init(void)
 {
        struct zclient_options opt = {.receive_notify = true};
 
+       if_zapi_callbacks(sharp_ifp_create, sharp_ifp_up,
+                         sharp_ifp_down, sharp_ifp_destroy);
+
        zclient = zclient_new(master, &opt);
 
        zclient_init(zclient, ZEBRA_ROUTE_SHARP, 0, &sharp_privs);
index 1965c2968ef3deea29cd3c1820ca5e0b10a862b7..c18cbed6bac748744eb8a2322868bd13ecc436ee 100644 (file)
@@ -504,10 +504,34 @@ extern void static_zebra_route_add(struct route_node *rn,
                           ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE,
                           zclient, &api);
 }
+
+static int static_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+static int static_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+static int static_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+static int static_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void static_zebra_init(void)
 {
        struct zclient_options opt = { .receive_notify = true };
 
+       if_zapi_callbacks(static_ifp_create, static_ifp_up,
+                         static_ifp_down, static_ifp_destroy);
+
        zclient = zclient_new(master, &opt);
 
        zclient_init(zclient, ZEBRA_ROUTE_STATIC, 0, &static_privs);
index 2dc3d3f8a393f30b325b2471828dc163303882cb..f71b343140f26e69519c7b9db1f41bb5eb53fefd 100644 (file)
@@ -30,6 +30,7 @@
 #include "vrrp.h"
 #include "vrrp_debug.h"
 #include "vrrp_vty.h"
+#include "vrrp_zebra.h"
 #ifndef VTYSH_EXTRACT_PL
 #include "vrrpd/vrrp_vty_clippy.c"
 #endif
index 72b77c1313697efd8b5ee3b441fdad7129386909..0844b90266e7d2c61252b2c1689a17c54caa8c31 100644 (file)
@@ -236,8 +236,31 @@ int vrrp_zclient_send_interface_protodown(struct interface *ifp, bool down)
                                                down);
 }
 
+int vrrp_ifp_create(struct interface *ifp)
+{
+       return 0;
+}
+
+int vrrp_ifp_up(struct interface *ifp)
+{
+       return 0;
+}
+
+int vrrp_ifp_down(struct interface *ifp)
+{
+       return 0;
+}
+
+int vrrp_ifp_destroy(struct interface *ifp)
+{
+       return 0;
+}
+
 void vrrp_zebra_init(void)
 {
+       if_zapi_callbacks(vrrp_ifp_create, vrrp_ifp_up,
+                         vrrp_ifp_down, vrrp_ifp_destroy);
+
        /* Socket for receiving updates from Zebra daemon */
        zclient = zclient_new(master, &zclient_options_default);
 
index 84bcba23c19afcc482a6ba8d49eeaeb00a489321..02d7055b8600ed8e13c091bf6c34872bcee2ab6b 100644 (file)
@@ -29,4 +29,9 @@ extern void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable);
 extern int vrrp_zclient_send_interface_protodown(struct interface *ifp,
                                                 bool down);
 
+extern int vrrp_ifp_create(struct interface *ifp);
+extern int vrrp_ifp_up(struct interface *ifp);
+extern int vrrp_ifp_down(struct interface *ifp);
+extern int vrrp_ifp_destroy(struct interface *ifp);
+
 #endif /* __VRRP_ZEBRA_H__ */
index d21ab25fed450135120fd3a505cf24bf56713cc6..baf94ad285f19f4380e5a3ee7747a7c5e37feea6 100644 (file)
@@ -3202,6 +3202,11 @@ void zebra_if_init(void)
        install_node(&interface_node, if_config_write);
        install_node(&link_params_node, NULL);
        if_cmd_init();
+       /*
+        * This is *intentionally* setting this to NULL, signaling
+        * that interface creation for zebra acts differently
+        */
+       if_zapi_callbacks(NULL, NULL, NULL, NULL);
 
        install_element(VIEW_NODE, &show_interface_cmd);
        install_element(VIEW_NODE, &show_interface_vrf_all_cmd);