mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-10 01:37:31 +00:00
pimd: Properly isolate zlookup
The qpim_zclient_lookup was a global variable. This is not needed. Isolate appropriately Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
f0ce50d470
commit
05b0d0d0ec
@ -51,6 +51,7 @@
|
|||||||
#include "pim_zebra.h"
|
#include "pim_zebra.h"
|
||||||
#include "pim_static.h"
|
#include "pim_static.h"
|
||||||
#include "pim_rp.h"
|
#include "pim_rp.h"
|
||||||
|
#include "pim_zlookup.h"
|
||||||
|
|
||||||
static struct cmd_node pim_global_node = {
|
static struct cmd_node pim_global_node = {
|
||||||
PIM_NODE,
|
PIM_NODE,
|
||||||
@ -2099,14 +2100,8 @@ DEFUN (show_ip_multicast,
|
|||||||
else {
|
else {
|
||||||
vty_out(vty, "<null zclient>%s", VTY_NEWLINE);
|
vty_out(vty, "<null zclient>%s", VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
vty_out(vty, "Zclient lookup socket: ");
|
|
||||||
if (qpim_zclient_lookup) {
|
pim_zlookup_show_ip_multicast (vty);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
vty_out(vty, "%s", VTY_NEWLINE);
|
vty_out(vty, "%s", VTY_NEWLINE);
|
||||||
vty_out(vty, "Current highest VifIndex: %d%s",
|
vty_out(vty, "Current highest VifIndex: %d%s",
|
||||||
|
@ -49,7 +49,7 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop,
|
|||||||
|
|
||||||
if (!incoming)
|
if (!incoming)
|
||||||
{
|
{
|
||||||
num_ifindex = zclient_lookup_nexthop(qpim_zclient_lookup, nexthop_tab,
|
num_ifindex = zclient_lookup_nexthop(nexthop_tab,
|
||||||
PIM_NEXTHOP_IFINDEX_TAB_SIZE,
|
PIM_NEXTHOP_IFINDEX_TAB_SIZE,
|
||||||
addr, PIM_NEXTHOP_LOOKUP_MAX);
|
addr, PIM_NEXTHOP_LOOKUP_MAX);
|
||||||
if (num_ifindex < 1) {
|
if (num_ifindex < 1) {
|
||||||
|
@ -718,9 +718,7 @@ void pim_zebra_init(char *zebra_sock_path)
|
|||||||
__PRETTY_FUNCTION__);
|
__PRETTY_FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
zassert(!qpim_zclient_lookup);
|
zclient_lookup_new();
|
||||||
qpim_zclient_lookup = zclient_lookup_new();
|
|
||||||
zassert(qpim_zclient_lookup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void igmp_anysource_forward_start(struct igmp_group *group)
|
void igmp_anysource_forward_start(struct igmp_group *group)
|
||||||
@ -758,7 +756,7 @@ static int fib_lookup_if_vif_index(struct in_addr addr)
|
|||||||
int vif_index;
|
int vif_index;
|
||||||
ifindex_t first_ifindex;
|
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_IFINDEX_TAB_SIZE, addr,
|
||||||
PIM_NEXTHOP_LOOKUP_MAX);
|
PIM_NEXTHOP_LOOKUP_MAX);
|
||||||
if (num_ifindex < 1) {
|
if (num_ifindex < 1) {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#include "vty.h"
|
||||||
|
|
||||||
#include "pimd.h"
|
#include "pimd.h"
|
||||||
#include "pim_pim.h"
|
#include "pim_pim.h"
|
||||||
@ -36,6 +37,8 @@
|
|||||||
|
|
||||||
extern int zclient_debug;
|
extern int zclient_debug;
|
||||||
|
|
||||||
|
static struct zclient *zlookup = NULL;
|
||||||
|
|
||||||
static void zclient_lookup_sched(struct zclient *zlookup, int delay);
|
static void zclient_lookup_sched(struct zclient *zlookup, int delay);
|
||||||
|
|
||||||
/* Connect to zebra for nexthop lookup. */
|
/* Connect to zebra for nexthop lookup. */
|
||||||
@ -117,15 +120,14 @@ static void zclient_lookup_failed(struct zclient *zlookup)
|
|||||||
zclient_lookup_reconnect(zlookup);
|
zclient_lookup_reconnect(zlookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct zclient *zclient_lookup_new()
|
void
|
||||||
|
zclient_lookup_new (void)
|
||||||
{
|
{
|
||||||
struct zclient *zlookup;
|
|
||||||
|
|
||||||
zlookup = zclient_new (master);
|
zlookup = zclient_new (master);
|
||||||
if (!zlookup) {
|
if (!zlookup) {
|
||||||
zlog_err("%s: zclient_new() failure",
|
zlog_err("%s: zclient_new() failure",
|
||||||
__PRETTY_FUNCTION__);
|
__PRETTY_FUNCTION__);
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zlookup->sock = -1;
|
zlookup->sock = -1;
|
||||||
@ -138,7 +140,6 @@ struct zclient *zclient_lookup_new()
|
|||||||
zlog_notice("%s: zclient lookup socket initialized",
|
zlog_notice("%s: zclient lookup socket initialized",
|
||||||
__PRETTY_FUNCTION__);
|
__PRETTY_FUNCTION__);
|
||||||
|
|
||||||
return zlookup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int zclient_read_nexthop(struct zclient *zlookup,
|
static int zclient_read_nexthop(struct zclient *zlookup,
|
||||||
@ -296,8 +297,8 @@ static int zclient_read_nexthop(struct zclient *zlookup,
|
|||||||
return num_ifindex;
|
return num_ifindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int zclient_lookup_nexthop_once(struct zclient *zlookup,
|
static int
|
||||||
struct pim_zlookup_nexthop nexthop_tab[],
|
zclient_lookup_nexthop_once (struct pim_zlookup_nexthop nexthop_tab[],
|
||||||
const int tab_size,
|
const int tab_size,
|
||||||
struct in_addr addr)
|
struct in_addr addr)
|
||||||
{
|
{
|
||||||
@ -344,8 +345,8 @@ static int zclient_lookup_nexthop_once(struct zclient *zlookup,
|
|||||||
tab_size, addr);
|
tab_size, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int zclient_lookup_nexthop(struct zclient *zlookup,
|
int
|
||||||
struct pim_zlookup_nexthop nexthop_tab[],
|
zclient_lookup_nexthop (struct pim_zlookup_nexthop nexthop_tab[],
|
||||||
const int tab_size,
|
const int tab_size,
|
||||||
struct in_addr addr,
|
struct in_addr addr,
|
||||||
int max_lookup)
|
int max_lookup)
|
||||||
@ -359,7 +360,7 @@ int zclient_lookup_nexthop(struct zclient *zlookup,
|
|||||||
int first_ifindex;
|
int first_ifindex;
|
||||||
struct in_addr nexthop_addr;
|
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);
|
PIM_NEXTHOP_IFINDEX_TAB_SIZE, addr);
|
||||||
if (num_ifindex < 1) {
|
if (num_ifindex < 1) {
|
||||||
if (PIM_DEBUG_ZEBRA) {
|
if (PIM_DEBUG_ZEBRA) {
|
||||||
@ -437,3 +438,16 @@ int zclient_lookup_nexthop(struct zclient *zlookup,
|
|||||||
|
|
||||||
return -2;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -35,12 +35,13 @@ struct pim_zlookup_nexthop {
|
|||||||
uint8_t protocol_distance;
|
uint8_t protocol_distance;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct zclient *zclient_lookup_new(void);
|
void zclient_lookup_new (void);
|
||||||
|
|
||||||
int zclient_lookup_nexthop(struct zclient *zlookup,
|
int zclient_lookup_nexthop(struct pim_zlookup_nexthop nexthop_tab[],
|
||||||
struct pim_zlookup_nexthop nexthop_tab[],
|
|
||||||
const int tab_size,
|
const int tab_size,
|
||||||
struct in_addr addr,
|
struct in_addr addr,
|
||||||
int max_lookup);
|
int max_lookup);
|
||||||
|
|
||||||
|
void pim_zlookup_show_ip_multicast (struct vty *vty);
|
||||||
|
|
||||||
#endif /* PIM_ZLOOKUP_H */
|
#endif /* PIM_ZLOOKUP_H */
|
||||||
|
@ -53,7 +53,6 @@ struct list *qpim_channel_oil_list = NULL;
|
|||||||
int qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */
|
int qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */
|
||||||
struct list *qpim_upstream_list = NULL;
|
struct list *qpim_upstream_list = NULL;
|
||||||
struct zclient *qpim_zclient_update = NULL;
|
struct zclient *qpim_zclient_update = NULL;
|
||||||
struct zclient *qpim_zclient_lookup = NULL;
|
|
||||||
struct pim_assert_metric qpim_infinite_assert_metric;
|
struct pim_assert_metric qpim_infinite_assert_metric;
|
||||||
long qpim_rpf_cache_refresh_delay_msec = 10000;
|
long qpim_rpf_cache_refresh_delay_msec = 10000;
|
||||||
struct thread *qpim_rpf_cache_refresher = NULL;
|
struct thread *qpim_rpf_cache_refresher = NULL;
|
||||||
|
@ -87,7 +87,6 @@ struct in_addr qpim_all_pim_routers_addr;
|
|||||||
int qpim_t_periodic; /* Period between Join/Prune Messages */
|
int qpim_t_periodic; /* Period between Join/Prune Messages */
|
||||||
struct list *qpim_upstream_list; /* list of struct pim_upstream */
|
struct list *qpim_upstream_list; /* list of struct pim_upstream */
|
||||||
struct zclient *qpim_zclient_update;
|
struct zclient *qpim_zclient_update;
|
||||||
struct zclient *qpim_zclient_lookup;
|
|
||||||
struct pim_assert_metric qpim_infinite_assert_metric;
|
struct pim_assert_metric qpim_infinite_assert_metric;
|
||||||
long qpim_rpf_cache_refresh_delay_msec;
|
long qpim_rpf_cache_refresh_delay_msec;
|
||||||
struct thread *qpim_rpf_cache_refresher;
|
struct thread *qpim_rpf_cache_refresher;
|
||||||
|
Loading…
Reference in New Issue
Block a user