summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-05-19 15:45:51 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-07-24 13:51:35 -0400
commitcf663cebb3af7d147a8272af6e501db41ed26286 (patch)
treef2be1f073d0bf7aed47751bba9cd8f7612264e32
parent25bdac421ea883ce14a97aacb7f5058cbfbfe76d (diff)
pimd: More refactor for 'struct pim_instance *' for pim_nht.c
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--pimd/pim_iface.c3
-rw-r--r--pimd/pim_nht.c15
-rw-r--r--pimd/pim_nht.h2
3 files changed, 12 insertions, 8 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index c08e4c842b..b9fa87831c 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -678,7 +678,8 @@ void pim_if_addr_add(struct connected *ifc)
rpf.rpf_addr.u.prefix4 = ifc->address->u.prefix4;
pnc = pim_nexthop_cache_find(pim_ifp->pim, &rpf);
if (pnc)
- pim_sendmsg_zebra_rnh(zclient, pnc,
+ pim_sendmsg_zebra_rnh(zclient, pim_ifp->pim,
+ pnc,
ZEBRA_NEXTHOP_REGISTER);
}
} /* pim */
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index 3c145dce1e..7978ad671f 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -44,7 +44,7 @@
* pim_sendmsg_zebra_rnh -- Format and send a nexthop register/Unregister
* command to Zebra.
*/
-void pim_sendmsg_zebra_rnh(struct zclient *zclient,
+void pim_sendmsg_zebra_rnh(struct zclient *zclient, struct pim_instance *pim,
struct pim_nexthop_cache *pnc, int command)
{
struct stream *s;
@@ -58,7 +58,7 @@ void pim_sendmsg_zebra_rnh(struct zclient *zclient,
p = &(pnc->rpf.rpf_addr);
s = zclient->obuf;
stream_reset(s);
- zclient_create_header(s, command, pimg->vrf_id);
+ zclient_create_header(s, command, pim->vrf_id);
/* get update for all routes for a prefix */
stream_putc(s, 0);
@@ -171,7 +171,7 @@ int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
if (!pnc) {
pnc = pim_nexthop_cache_add(pim, &rpf);
if (pnc)
- pim_sendmsg_zebra_rnh(zclient, pnc,
+ pim_sendmsg_zebra_rnh(zclient, pim, pnc,
ZEBRA_NEXTHOP_REGISTER);
else {
char rpf_str[PREFIX_STRLEN];
@@ -246,7 +246,7 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
if (pnc->rp_list->count == 0
&& pnc->upstream_list->count == 0) {
- pim_sendmsg_zebra_rnh(zclient, pnc,
+ pim_sendmsg_zebra_rnh(zclient, pim, pnc,
ZEBRA_NEXTHOP_UNREGISTER);
list_delete(pnc->rp_list);
@@ -334,7 +334,8 @@ void pim_resolve_upstream_nh(struct prefix *nht_p)
}
/* Update Upstream nexthop info based on Nexthop update received from Zebra.*/
-static int pim_update_upstream_nh(struct pim_nexthop_cache *pnc)
+static int pim_update_upstream_nh(struct pim_instance *pim,
+ struct pim_nexthop_cache *pnc)
{
struct listnode *up_node;
struct listnode *ifnode;
@@ -683,6 +684,8 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient,
struct interface *ifp1 = NULL;
struct pim_interface *pim_ifp = NULL;
char str[INET_ADDRSTRLEN];
+ struct vrf *vrf = vrf_lookup_by_id(vrf_id);
+ struct pim_instance *pim = vrf->info;
s = zclient->ibuf;
memset(&p, 0, sizeof(struct prefix));
@@ -868,7 +871,7 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient,
if (listcount(pnc->rp_list))
pim_update_rp_nh(pnc);
if (listcount(pnc->upstream_list))
- pim_update_upstream_nh(pnc);
+ pim_update_upstream_nh(pim, pnc);
return 0;
}
diff --git a/pimd/pim_nht.h b/pimd/pim_nht.h
index 4e1d0d180a..6ed57c9ecb 100644
--- a/pimd/pim_nht.h
+++ b/pimd/pim_nht.h
@@ -64,7 +64,7 @@ int pim_ecmp_nexthop_search(struct pim_nexthop_cache *pnc,
int pim_ecmp_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr,
struct prefix *src, struct prefix *grp,
int neighbor_needed);
-void pim_sendmsg_zebra_rnh(struct zclient *zclient,
+void pim_sendmsg_zebra_rnh(struct zclient *zclient, struct pim_instance *pim,
struct pim_nexthop_cache *pnc, int command);
int pim_update_rp_nh(struct pim_nexthop_cache *pnc);
void pim_resolve_upstream_nh(struct prefix *nht_p);