]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: More refactor for 'struct pim_instance *' for pim_nht.c
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 19 May 2017 19:45:51 +0000 (15:45 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 24 Jul 2017 17:51:35 +0000 (13:51 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_iface.c
pimd/pim_nht.c
pimd/pim_nht.h

index c08e4c842bc46bc2239a7b11b133994f912561d9..b9fa87831c398a331c6c6dcef3b5dccccc1feecd 100644 (file)
@@ -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 */
index 3c145dce1e27bace723627ff7af48f08be106421..7978ad671fa69dde6cce4bb006205d4f9b88f6d0 100644 (file)
@@ -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;
 }
index 4e1d0d180ac11c44e79bfdbe07a32029e9d1e0ff..6ed57c9ecbfc88d5ccb7265a0f16e793b9859053 100644 (file)
@@ -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);