The qpim_zclient_lookup was a global variable.
This is not needed. Isolate appropriately
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
#include "pim_zebra.h"
#include "pim_static.h"
#include "pim_rp.h"
+#include "pim_zlookup.h"
static struct cmd_node pim_global_node = {
PIM_NODE,
else {
vty_out(vty, "<null zclient>%s", VTY_NEWLINE);
}
- vty_out(vty, "Zclient lookup socket: ");
- if (qpim_zclient_lookup) {
- vty_out(vty, "%d failures=%d%s", qpim_zclient_lookup->sock,
- qpim_zclient_lookup->fail, VTY_NEWLINE);
- }
- else {
- vty_out(vty, "<null zclient>%s", VTY_NEWLINE);
- }
+
+ pim_zlookup_show_ip_multicast (vty);
vty_out(vty, "%s", VTY_NEWLINE);
vty_out(vty, "Current highest VifIndex: %d%s",
if (!incoming)
{
- num_ifindex = zclient_lookup_nexthop(qpim_zclient_lookup, nexthop_tab,
+ num_ifindex = zclient_lookup_nexthop(nexthop_tab,
PIM_NEXTHOP_IFINDEX_TAB_SIZE,
addr, PIM_NEXTHOP_LOOKUP_MAX);
if (num_ifindex < 1) {
__PRETTY_FUNCTION__);
}
- zassert(!qpim_zclient_lookup);
- qpim_zclient_lookup = zclient_lookup_new();
- zassert(qpim_zclient_lookup);
+ zclient_lookup_new();
}
void igmp_anysource_forward_start(struct igmp_group *group)
int vif_index;
ifindex_t first_ifindex;
- num_ifindex = zclient_lookup_nexthop(qpim_zclient_lookup, nexthop_tab,
+ num_ifindex = zclient_lookup_nexthop(nexthop_tab,
PIM_NEXTHOP_IFINDEX_TAB_SIZE, addr,
PIM_NEXTHOP_LOOKUP_MAX);
if (num_ifindex < 1) {
#include "stream.h"
#include "network.h"
#include "thread.h"
+#include "vty.h"
#include "pimd.h"
#include "pim_pim.h"
extern int zclient_debug;
+static struct zclient *zlookup = NULL;
+
static void zclient_lookup_sched(struct zclient *zlookup, int delay);
/* Connect to zebra for nexthop lookup. */
zclient_lookup_reconnect(zlookup);
}
-struct zclient *zclient_lookup_new()
+void
+zclient_lookup_new (void)
{
- struct zclient *zlookup;
-
zlookup = zclient_new (master);
if (!zlookup) {
zlog_err("%s: zclient_new() failure",
__PRETTY_FUNCTION__);
- return 0;
+ return;
}
zlookup->sock = -1;
zlog_notice("%s: zclient lookup socket initialized",
__PRETTY_FUNCTION__);
- return zlookup;
}
static int zclient_read_nexthop(struct zclient *zlookup,
return num_ifindex;
}
-static int zclient_lookup_nexthop_once(struct zclient *zlookup,
- struct pim_zlookup_nexthop nexthop_tab[],
- const int tab_size,
- struct in_addr addr)
+static int
+zclient_lookup_nexthop_once (struct pim_zlookup_nexthop nexthop_tab[],
+ const int tab_size,
+ struct in_addr addr)
{
struct stream *s;
int ret;
tab_size, addr);
}
-int zclient_lookup_nexthop(struct zclient *zlookup,
- struct pim_zlookup_nexthop nexthop_tab[],
- const int tab_size,
- struct in_addr addr,
- int max_lookup)
+int
+zclient_lookup_nexthop (struct pim_zlookup_nexthop nexthop_tab[],
+ const int tab_size,
+ struct in_addr addr,
+ int max_lookup)
{
int lookup;
uint32_t route_metric = 0xFFFFFFFF;
int first_ifindex;
struct in_addr nexthop_addr;
- num_ifindex = zclient_lookup_nexthop_once(qpim_zclient_lookup, nexthop_tab,
+ num_ifindex = zclient_lookup_nexthop_once(nexthop_tab,
PIM_NEXTHOP_IFINDEX_TAB_SIZE, addr);
if (num_ifindex < 1) {
if (PIM_DEBUG_ZEBRA) {
return -2;
}
+
+void
+pim_zlookup_show_ip_multicast (struct vty *vty)
+{
+ vty_out(vty, "Zclient lookup socket: ");
+ if (zlookup) {
+ vty_out(vty, "%d failures=%d%s", zlookup->sock,
+ zlookup->fail, VTY_NEWLINE);
+ }
+ else {
+ vty_out(vty, "<null zclient>%s", VTY_NEWLINE);
+ }
+}
uint8_t protocol_distance;
};
-struct zclient *zclient_lookup_new(void);
+void zclient_lookup_new (void);
-int zclient_lookup_nexthop(struct zclient *zlookup,
- struct pim_zlookup_nexthop nexthop_tab[],
+int zclient_lookup_nexthop(struct pim_zlookup_nexthop nexthop_tab[],
const int tab_size,
struct in_addr addr,
int max_lookup);
+void pim_zlookup_show_ip_multicast (struct vty *vty);
+
#endif /* PIM_ZLOOKUP_H */
int qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */
struct list *qpim_upstream_list = NULL;
struct zclient *qpim_zclient_update = NULL;
-struct zclient *qpim_zclient_lookup = NULL;
struct pim_assert_metric qpim_infinite_assert_metric;
long qpim_rpf_cache_refresh_delay_msec = 10000;
struct thread *qpim_rpf_cache_refresher = NULL;
int qpim_t_periodic; /* Period between Join/Prune Messages */
struct list *qpim_upstream_list; /* list of struct pim_upstream */
struct zclient *qpim_zclient_update;
-struct zclient *qpim_zclient_lookup;
struct pim_assert_metric qpim_infinite_assert_metric;
long qpim_rpf_cache_refresh_delay_msec;
struct thread *qpim_rpf_cache_refresher;