#undef PIM_DEBUG_IFADDR_DUMP
#define PIM_DEBUG_IFADDR_DUMP
-struct zclient *zclient;
+struct zclient *pim_zclient;
/* Router-id update message from zebra. */
struct stream *s = NULL;
/* Check socket. */
- if (!zclient || zclient->sock < 0)
+ if (!pim_zclient || pim_zclient->sock < 0)
return;
- s = zclient->obuf;
+ s = pim_zclient->obuf;
stream_reset(s);
zclient_create_header(s, ZEBRA_VXLAN_SG_REPLAY, VRF_DEFAULT);
stream_putw_at(s, 0, stream_get_endp(s));
- zclient_send_message(zclient);
+ zclient_send_message(pim_zclient);
}
void pim_scan_oil(struct pim_instance *pim)
void pim_zebra_init(void)
{
/* Socket for receiving updates from Zebra daemon */
- zclient = zclient_new(router->master, &zclient_options_default,
- pim_handlers, array_size(pim_handlers));
+ pim_zclient = zclient_new(router->master, &zclient_options_default,
+ pim_handlers, array_size(pim_handlers));
- zclient->zebra_capabilities = pim_zebra_capabilities;
- zclient->zebra_connected = pim_zebra_connected;
- zclient->nexthop_update = pim_nexthop_update;
+ pim_zclient->zebra_capabilities = pim_zebra_capabilities;
+ pim_zclient->zebra_connected = pim_zebra_connected;
+ pim_zclient->nexthop_update = pim_nexthop_update;
- zclient_init(zclient, ZEBRA_ROUTE_PIM, 0, &pimd_privs);
+ zclient_init(pim_zclient, ZEBRA_ROUTE_PIM, 0, &pimd_privs);
if (PIM_DEBUG_PIM_TRACE) {
zlog_notice("%s: zclient socket initialized", __func__);
}
{
vty_out(vty, "Zclient update socket: ");
- if (zclient) {
- vty_out(vty, "%d failures=%d\n", zclient->sock, zclient->fail);
+ if (pim_zclient) {
+ vty_out(vty, "%d failures=%d\n", pim_zclient->sock, pim_zclient->fail);
} else {
vty_out(vty, "<null zclient>\n");
}
struct zclient *pim_zebra_zclient_get(void)
{
- if (zclient)
- return zclient;
+ if (pim_zclient)
+ return pim_zclient;
else
return NULL;
}
void pim_zebra_interface_set_master(struct interface *vrf,
struct interface *ifp)
{
- zclient_interface_set_master(zclient, vrf, ifp);
+ zclient_interface_set_master(pim_zclient, vrf, ifp);
}
#include "pim_zlookup.h"
#include "pim_addr.h"
-static struct zclient *zlookup = NULL;
+static struct zclient *pim_zlookup = NULL;
struct event *zlookup_read;
static void zclient_lookup_sched(struct zclient *zlookup, int delay);
void zclient_lookup_free(void)
{
EVENT_OFF(zlookup_read);
- zclient_stop(zlookup);
- zclient_free(zlookup);
- zlookup = NULL;
+ zclient_stop(pim_zlookup);
+ zclient_free(pim_zlookup);
+ pim_zlookup = NULL;
}
void zclient_lookup_new(void)
{
- zlookup = zclient_new(router->master, &zclient_options_sync, NULL, 0);
- if (!zlookup) {
+ pim_zlookup = zclient_new(router->master, &zclient_options_sync, NULL, 0);
+ if (!pim_zlookup) {
flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_new() failure",
__func__);
return;
}
- zlookup->sock = -1;
- zlookup->t_connect = NULL;
- zlookup->privs = &pimd_privs;
+ pim_zlookup->sock = -1;
+ pim_zlookup->t_connect = NULL;
+ pim_zlookup->privs = &pimd_privs;
- zclient_lookup_sched_now(zlookup);
+ zclient_lookup_sched_now(pim_zlookup);
zlog_notice("%s: zclient lookup socket initialized", __func__);
}
(safi == SAFI_MULTICAST ? "M" : "U"));
/* Check socket. */
- if (zlookup->sock < 0) {
+ if (pim_zlookup->sock < 0) {
flog_err(EC_LIB_ZAPI_SOCKET,
"%s: zclient lookup socket is not connected",
__func__);
- zclient_lookup_failed(zlookup);
+ zclient_lookup_failed(pim_zlookup);
return -1;
}
ipaddr.ipa_type = PIM_IPADDR;
ipaddr.ipaddr_pim = addr;
- s = zlookup->obuf;
+ s = pim_zlookup->obuf;
stream_reset(s);
zclient_create_header(s, ZEBRA_NEXTHOP_LOOKUP, pim->vrf->vrf_id);
stream_put_ipaddr(s, &ipaddr);
stream_putc(s, safi);
stream_putw_at(s, 0, stream_get_endp(s));
- ret = writen(zlookup->sock, s->data, stream_get_endp(s));
+ ret = writen(pim_zlookup->sock, s->data, stream_get_endp(s));
if (ret < 0) {
flog_err(
EC_LIB_SOCKET,
"%s: writen() failure: %d writing to zclient lookup socket",
__func__, errno);
- zclient_lookup_failed(zlookup);
+ zclient_lookup_failed(pim_zlookup);
return -2;
}
if (ret == 0) {
flog_err_sys(EC_LIB_SOCKET,
"%s: connection closed on zclient lookup socket",
__func__);
- zclient_lookup_failed(zlookup);
+ zclient_lookup_failed(pim_zlookup);
return -3;
}
- return zclient_read_nexthop(pim, zlookup, nexthop_tab, tab_size, addr);
+ return zclient_read_nexthop(pim, pim_zlookup, nexthop_tab, tab_size, addr);
}
static int zclient_lookup_nexthop_once(struct pim_instance *pim,
void pim_zlookup_show_ip_multicast(struct vty *vty)
{
vty_out(vty, "Zclient lookup socket: ");
- if (zlookup) {
- vty_out(vty, "%d failures=%d\n", zlookup->sock, zlookup->fail);
+ if (pim_zlookup) {
+ vty_out(vty, "%d failures=%d\n", pim_zlookup->sock, pim_zlookup->fail);
} else {
vty_out(vty, "<null zclient>\n");
}
int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
{
- struct stream *s = zlookup->obuf;
+ struct stream *s = pim_zlookup->obuf;
uint16_t command = 0;
unsigned long long lastused;
pim_sgaddr sg;
stream_putw_at(s, 0, stream_get_endp(s));
count = stream_get_endp(s);
- ret = writen(zlookup->sock, s->data, count);
+ ret = writen(pim_zlookup->sock, s->data, count);
if (ret <= 0) {
flog_err(
EC_LIB_SOCKET,
return -1;
}
- s = zlookup->ibuf;
+ s = pim_zlookup->ibuf;
while (command != ZEBRA_IPMR_ROUTE_STATS) {
int err;
uint8_t version;
stream_reset(s);
- err = zclient_read_header(s, zlookup->sock, &length, &marker,
+ err = zclient_read_header(s, pim_zlookup->sock, &length, &marker,
&version, &vrf_id, &command);
if (err < 0) {
flog_err(EC_LIB_ZAPI_MISSMATCH,
"%s: zclient_read_header() failed", __func__);
- zclient_lookup_failed(zlookup);
+ zclient_lookup_failed(pim_zlookup);
return -1;
}
}
EC_LIB_ZAPI_MISSMATCH,
"%s: Received wrong %pSG(%s) information requested",
__func__, &more, c_oil->pim->vrf->name);
- zclient_lookup_failed(zlookup);
+ zclient_lookup_failed(pim_zlookup);
return -3;
}