DEFINE_MTYPE_STATIC(PBRD, PBR_INTERFACE, "PBR Interface");
/* Zebra structure to hold current status. */
-struct zclient *zclient;
+struct zclient *pbr_zclient;
struct pbr_interface *pbr_if_new(struct interface *ifp)
{
}
api->nexthop_num = i;
- zclient_route_send(ZEBRA_ROUTE_ADD, zclient, api);
+ zclient_route_send(ZEBRA_ROUTE_ADD, pbr_zclient, api);
}
/*
switch (afi) {
case AFI_IP:
api.prefix.family = AF_INET;
- zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
+ zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
break;
case AFI_IP6:
api.prefix.family = AF_INET6;
- zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
+ zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
break;
case AFI_MAX:
api.prefix.family = AF_INET;
- zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
+ zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
api.prefix.family = AF_INET6;
- zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
+ zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
break;
case AFI_L2VPN:
DEBUGD(&pbr_dbg_zebra,
void pbr_zebra_init(void)
{
- zclient = zclient_new(master, &zclient_options_default, pbr_handlers,
- array_size(pbr_handlers));
+ pbr_zclient = zclient_new(master, &zclient_options_default, pbr_handlers,
+ array_size(pbr_handlers));
- zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
- zclient->zebra_connected = zebra_connected;
- zclient->nexthop_update = pbr_zebra_nexthop_update;
+ zclient_init(pbr_zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
+ pbr_zclient->zebra_connected = zebra_connected;
+ pbr_zclient->nexthop_update = pbr_zebra_nexthop_update;
}
void pbr_zebra_destroy(void)
{
- if (zclient == NULL)
+ if (pbr_zclient == NULL)
return;
- zclient_stop(zclient);
- zclient_free(zclient);
- zclient = NULL;
+ zclient_stop(pbr_zclient);
+ zclient_free(pbr_zclient);
+ pbr_zclient = NULL;
}
void pbr_send_rnh(struct nexthop *nhop, bool reg)
break;
}
- if (zclient_send_rnh(zclient, command, &p, SAFI_UNICAST, false, false,
+ if (zclient_send_rnh(pbr_zclient, command, &p, SAFI_UNICAST, false, false,
nhop->vrf_id)
== ZCLIENT_SEND_FAILURE) {
zlog_warn("%s: Failure to send nexthop to zebra", __func__);
if (!install && !is_installed)
return false;
- s = zclient->obuf;
+ s = pbr_zclient->obuf;
stream_reset(s);
zclient_create_header(s,
if (pbr_encode_pbr_map_sequence(s, pbrms, pmi->ifp)) {
stream_putw_at(s, 0, stream_get_endp(s));
- zclient_send_message(zclient);
+ zclient_send_message(pbr_zclient);
} else {
DEBUGD(&pbr_dbg_zebra, "%s: %s seq %u encode failed, skipped",
__func__, pbrm->name, pbrms->seqno);
static struct static_nht_hash_head static_nht_hash[1];
/* Zebra structure to hold current status. */
-struct zclient *zclient;
+struct zclient *static_zclient;
uint32_t zebra_ecmp_count = MULTIPATH_NUM;
/* Interface addition message from zebra. */
struct static_nht_data *nhtd, lookup;
afi_t afi = AFI_IP;
- if (zclient->bfd_integration)
+ if (static_zclient->bfd_integration)
bfd_nht_update(matched, nhr);
if (matched->family == AF_INET6)
"Unregistering nexthop(%pFX) for %pRN", &lookup.nh, rn);
}
- if (zclient_send_rnh(zclient, cmd, &lookup.nh, si->safi, false, false,
+ if (zclient_send_rnh(static_zclient, cmd, &lookup.nh, si->safi, false, false,
nh->nh_vrf_id) == ZCLIENT_SEND_FAILURE)
zlog_warn("%s: Failure to send nexthop %pFX for %pRN to zebra",
__func__, &lookup.nh, rn);
zclient_route_send(install ?
ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE,
- zclient, &api);
+ static_zclient, &api);
}
/**
memcpy(&api.prefix, &p, sizeof(p));
if (cmd == ZEBRA_ROUTE_DELETE)
- return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
+ return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, static_zclient, &api);
SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
api.nexthop_num = 1;
- zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
+ zclient_route_send(ZEBRA_ROUTE_ADD, static_zclient, &api);
}
/**
}
/* Request SRv6 SID from SID Manager */
- ret = srv6_manager_get_sid(zclient, &ctx, &sid->addr.prefix, sid->locator->name, NULL);
+ ret = srv6_manager_get_sid(static_zclient, &ctx, &sid->addr.prefix, sid->locator->name,
+ NULL);
if (ret < 0)
zlog_warn("%s: error getting SRv6 SID!", __func__);
}
}
/* remove the SRv6 SID from the zebra RIB */
- ret = srv6_manager_release_sid(zclient, &ctx);
+ ret = srv6_manager_release_sid(static_zclient, &ctx);
if (ret == ZCLIENT_SEND_FAILURE)
flog_err(EC_LIB_ZAPI_SOCKET, "zclient_send_get_srv6_sid() delete failed: %s",
safe_strerror(errno));
* Send the Get Locator request to the SRv6 Manager and return the
* result
*/
- return srv6_manager_get_locator(zclient, name);
+ return srv6_manager_get_locator(static_zclient, name);
}
static void request_srv6_sids(struct static_srv6_locator *locator)
hook_register_prio(if_down, 0, static_ifp_down);
hook_register_prio(if_unreal, 0, static_ifp_destroy);
- zclient = zclient_new(master, &zclient_options_default, static_handlers,
- array_size(static_handlers));
+ static_zclient = zclient_new(master, &zclient_options_default, static_handlers,
+ array_size(static_handlers));
- zclient_init(zclient, ZEBRA_ROUTE_STATIC, 0, &static_privs);
- zclient->zebra_capabilities = static_zebra_capabilities;
- zclient->zebra_connected = zebra_connected;
- zclient->nexthop_update = static_zebra_nexthop_update;
+ zclient_init(static_zclient, ZEBRA_ROUTE_STATIC, 0, &static_privs);
+ static_zclient->zebra_capabilities = static_zebra_capabilities;
+ static_zclient->zebra_connected = zebra_connected;
+ static_zclient->nexthop_update = static_zebra_nexthop_update;
static_nht_hash_init(static_nht_hash);
- static_bfd_initialize(zclient, master);
+ static_bfd_initialize(static_zclient, master);
}
/* static_zebra_stop used by tests/lib/test_grpc.cpp */
static_nht_hash_clear();
static_nht_hash_fini(static_nht_hash);
- if (!zclient)
+ if (!static_zclient)
return;
- zclient_stop(zclient);
- zclient_free(zclient);
- zclient = NULL;
+ zclient_stop(static_zclient);
+ zclient_free(static_zclient);
+ static_zclient = NULL;
}
void static_zebra_vrf_register(struct vrf *vrf)
{
if (vrf->vrf_id == VRF_DEFAULT)
return;
- zclient_send_reg_requests(zclient, vrf->vrf_id);
+ zclient_send_reg_requests(static_zclient, vrf->vrf_id);
}
void static_zebra_vrf_unregister(struct vrf *vrf)
{
if (vrf->vrf_id == VRF_DEFAULT)
return;
- zclient_send_dereg_requests(zclient, vrf->vrf_id);
+ zclient_send_dereg_requests(static_zclient, vrf->vrf_id);
}
#define VRRP_LOGPFX "[ZEBRA] "
-static struct zclient *zclient;
+static struct zclient *vrrp_zclient;
static void vrrp_zebra_debug_if_state(struct interface *ifp, const char *func)
{
"Requesting Zebra to turn router advertisements %s for %s",
r->vr->vrid, enable ? "on" : "off", r->mvl_ifp->name);
- zclient_send_interface_radv_req(zclient, r->mvl_ifp->vrf->vrf_id,
+ zclient_send_interface_radv_req(vrrp_zclient, r->mvl_ifp->vrf->vrf_id,
r->mvl_ifp, enable, VRRP_RADV_INT);
}
VRRP_LOGPFX "Requesting Zebra to set %s protodown %s", ifp->name,
down ? "on" : "off");
- zclient_send_interface_protodown(zclient, ifp->vrf->vrf_id, ifp, down);
+ zclient_send_interface_protodown(vrrp_zclient, ifp->vrf->vrf_id, ifp, down);
}
static zclient_handler *const vrrp_handlers[] = {
hook_register_prio(if_unreal, 0, vrrp_ifp_destroy);
/* Socket for receiving updates from Zebra daemon */
- zclient = zclient_new(master, &zclient_options_default, vrrp_handlers,
- array_size(vrrp_handlers));
+ vrrp_zclient = zclient_new(master, &zclient_options_default, vrrp_handlers,
+ array_size(vrrp_handlers));
- zclient->zebra_connected = vrrp_zebra_connected;
+ vrrp_zclient->zebra_connected = vrrp_zebra_connected;
- zclient_init(zclient, ZEBRA_ROUTE_VRRP, 0, &vrrp_privs);
+ zclient_init(vrrp_zclient, ZEBRA_ROUTE_VRRP, 0, &vrrp_privs);
zlog_notice("%s: zclient socket initialized", __func__);
}