]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: Abstract sending of data to peers
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 31 Jul 2018 21:40:37 +0000 (17:40 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 31 Jul 2018 21:40:37 +0000 (17:40 -0400)
After we have decided what has changed as part of a update
we need to send the j/p messages to our peers.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_nht.c
pimd/pim_zebra.c
pimd/pim_zebra.h

index 7d1940bec1c07c3e4b0978d2b68d5274981133fb..f24bf0ac81aebc2afcec7c7237fc923ef4568e9c 100644 (file)
@@ -367,25 +367,9 @@ static int pim_update_upstream_nh_helper(struct hash_backet *backet, void *arg)
 static int pim_update_upstream_nh(struct pim_instance *pim,
                                  struct pim_nexthop_cache *pnc)
 {
-       struct listnode *node;
-       struct interface *ifp;
-
        hash_walk(pnc->upstream_hash, pim_update_upstream_nh_helper, pim);
 
-       FOR_ALL_INTERFACES (pim->vrf, ifp)
-               if (ifp->info) {
-                       struct pim_interface *pim_ifp = ifp->info;
-                       struct pim_iface_upstream_switch *us;
-
-                       for (ALL_LIST_ELEMENTS_RO(pim_ifp->upstream_switch_list,
-                                                 node, us)) {
-                               struct pim_rpf rpf;
-                               rpf.source_nexthop.interface = ifp;
-                               rpf.rpf_addr.u.prefix4 = us->address;
-                               pim_joinprune_send(&rpf, us->us);
-                               pim_jp_agg_clear_group(us->us);
-                       }
-               }
+       pim_zebra_update_all_interfaces(pim);
 
        return 0;
 }
index b947ca06256b1d8c52740ed67932e0cc230ba94d..f383c367a5062d496686a2ea98dc4185c32fc710 100644 (file)
@@ -425,13 +425,35 @@ static int pim_zebra_if_address_del(int command, struct zclient *client,
        return 0;
 }
 
+void pim_zebra_update_all_interfaces(struct pim_instance *pim)
+{
+       struct interface *ifp;
+
+       FOR_ALL_INTERFACES (pim->vrf, ifp) {
+               struct pim_interface *pim_ifp = ifp->info;
+               struct pim_iface_upstream_switch *us;
+               struct listnode *node;
+
+               if (!pim_ifp)
+                       continue;
+
+               for (ALL_LIST_ELEMENTS_RO(pim_ifp->upstream_switch_list, node,
+                                         us)) {
+                       struct pim_rpf rpf;
+
+                       rpf.source_nexthop.interface = ifp;
+                       rpf.rpf_addr.u.prefix4 = us->address;
+                       pim_joinprune_send(&rpf, us->us);
+                       pim_jp_agg_clear_group(us->us);
+               }
+       }
+}
+
 static void scan_upstream_rpf_cache(struct pim_instance *pim)
 {
        struct listnode *up_node;
        struct listnode *up_nextnode;
-       struct listnode *node;
        struct pim_upstream *up;
-       struct interface *ifp;
 
        for (ALL_LIST_ELEMENTS(pim->upstream_list, up_node, up_nextnode, up)) {
                enum pim_rpf_result rpf_result;
@@ -509,21 +531,7 @@ static void scan_upstream_rpf_cache(struct pim_instance *pim)
 
        } /* for (qpim_upstream_list) */
 
-       FOR_ALL_INTERFACES (pim->vrf, ifp)
-               if (ifp->info) {
-                       struct pim_interface *pim_ifp = ifp->info;
-                       struct pim_iface_upstream_switch *us;
-
-                       for (ALL_LIST_ELEMENTS_RO(pim_ifp->upstream_switch_list,
-                                                 node, us)) {
-                               struct pim_rpf rpf;
-
-                               rpf.source_nexthop.interface = ifp;
-                               rpf.rpf_addr.u.prefix4 = us->address;
-                               pim_joinprune_send(&rpf, us->us);
-                               pim_jp_agg_clear_group(us->us);
-                       }
-               }
+       pim_zebra_update_all_interfaces(pim);
 }
 
 void pim_scan_individual_oil(struct channel_oil *c_oil, int in_vif_index)
index dd46fd40f9acea7ed15b69f980213f2097e396b4..a0b59a6db8dc731a5a0c145a2a1a10565f4f5f36 100644 (file)
@@ -46,4 +46,6 @@ void pim_forward_stop(struct pim_ifchannel *ch, bool install_it);
 
 void sched_rpf_cache_refresh(struct pim_instance *pim);
 struct zclient *pim_zebra_zclient_get(void);
+
+void pim_zebra_update_all_interfaces(struct pim_instance *pim);
 #endif /* PIM_ZEBRA_H */