summaryrefslogtreecommitdiff
path: root/pbrd/pbr_zebra.c
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2021-10-26 11:33:44 -0400
committerGitHub <noreply@github.com>2021-10-26 11:33:44 -0400
commita2b52cbeb43f28daea6363f2fc6962347dfab334 (patch)
tree7d7b62d44195d08642c826a80720b97635223d6c /pbrd/pbr_zebra.c
parentfd1aebbe776ce5ee5d5ba554bf277f820e4a27b5 (diff)
parenta243d1db93aaa123413a754fe69fbad36d810ae7 (diff)
Merge pull request #9854 from opensourcerouting/zapi-call-table
*: convert zclient callbacks to table
Diffstat (limited to 'pbrd/pbr_zebra.c')
-rw-r--r--pbrd/pbr_zebra.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c
index 44c258cb3d..8a9bb0201e 100644
--- a/pbrd/pbr_zebra.c
+++ b/pbrd/pbr_zebra.c
@@ -429,20 +429,24 @@ static int pbr_zebra_nexthop_update(ZAPI_CALLBACK_ARGS)
extern struct zebra_privs_t pbr_privs;
+static zclient_handler *const pbr_handlers[] = {
+ [ZEBRA_INTERFACE_ADDRESS_ADD] = interface_address_add,
+ [ZEBRA_INTERFACE_ADDRESS_DELETE] = interface_address_delete,
+ [ZEBRA_INTERFACE_VRF_UPDATE] = interface_vrf_update,
+ [ZEBRA_ROUTE_NOTIFY_OWNER] = route_notify_owner,
+ [ZEBRA_RULE_NOTIFY_OWNER] = rule_notify_owner,
+ [ZEBRA_NEXTHOP_UPDATE] = pbr_zebra_nexthop_update,
+};
+
void pbr_zebra_init(void)
{
struct zclient_options opt = { .receive_notify = true };
- zclient = zclient_new(master, &opt);
+ zclient = zclient_new(master, &opt, pbr_handlers,
+ array_size(pbr_handlers));
zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
zclient->zebra_connected = zebra_connected;
- zclient->interface_address_add = interface_address_add;
- zclient->interface_address_delete = interface_address_delete;
- zclient->interface_vrf_update = interface_vrf_update;
- zclient->route_notify_owner = route_notify_owner;
- zclient->rule_notify_owner = rule_notify_owner;
- zclient->nexthop_update = pbr_zebra_nexthop_update;
}
void pbr_send_rnh(struct nexthop *nhop, bool reg)