]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/ldp_zebra.c
Merge pull request #13118 from opensourcerouting/fix/password_xfer_config
[mirror_frr.git] / ldpd / ldp_zebra.c
index 2d90412d173418e931fcf0969dedfe82b060369d..02cd1678e9b6d56dd4cabaa682b4da13b5ecb0ed 100644 (file)
@@ -1,20 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 by Open Source Routing.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- * MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -597,7 +583,7 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS)
                        if (!(kr.flags & F_CONNECTED))
                                continue;
                        break;
-               default:
+               case NEXTHOP_TYPE_BLACKHOLE:
                        continue;
                }
 
@@ -694,25 +680,28 @@ ldp_zebra_filter_update(struct access_list *access)
 
 extern struct zebra_privs_t ldpd_privs;
 
-void
-ldp_zebra_init(struct thread_master *master)
+static zclient_handler *const ldp_handlers[] = {
+       [ZEBRA_ROUTER_ID_UPDATE] = ldp_router_id_update,
+       [ZEBRA_INTERFACE_ADDRESS_ADD] = ldp_interface_address_add,
+       [ZEBRA_INTERFACE_ADDRESS_DELETE] = ldp_interface_address_delete,
+       [ZEBRA_REDISTRIBUTE_ROUTE_ADD] = ldp_zebra_read_route,
+       [ZEBRA_REDISTRIBUTE_ROUTE_DEL] = ldp_zebra_read_route,
+       [ZEBRA_PW_STATUS_UPDATE] = ldp_zebra_read_pw_status_update,
+       [ZEBRA_OPAQUE_MESSAGE] = ldp_zebra_opaque_msg_handler,
+};
+
+void ldp_zebra_init(struct event_loop *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 = zclient_new(master, &zclient_options_default, ldp_handlers,
+                             array_size(ldp_handlers));
        zclient_init(zclient, ZEBRA_ROUTE_LDP, 0, &ldpd_privs);
 
        /* set callbacks */
        zclient->zebra_connected = ldp_zebra_connected;
-       zclient->router_id_update = ldp_router_id_update;
-       zclient->interface_address_add = ldp_interface_address_add;
-       zclient->interface_address_delete = ldp_interface_address_delete;
-       zclient->redistribute_route_add = ldp_zebra_read_route;
-       zclient->redistribute_route_del = ldp_zebra_read_route;
-       zclient->pw_status_update = ldp_zebra_read_pw_status_update;
-       zclient->opaque_msg_handler = ldp_zebra_opaque_msg_handler;
 
        /* Access list initialize. */
        access_list_add_hook(ldp_zebra_filter_update);