]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_nht.c
Merge pull request #5767 from ton31337/fix/replace_s_addr_0_to_INADDR_ANY
[mirror_frr.git] / pimd / pim_nht.c
index 2fbde2007558dda5a35c5982b6f471b3c7065bd5..5cb9492ec36ae2c8e68162bad175f16ef3237ab0 100644 (file)
@@ -177,7 +177,6 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
        struct pim_nexthop_cache *pnc = NULL;
        struct pim_nexthop_cache lookup;
        struct zclient *zclient = NULL;
-       struct listnode *upnode = NULL;
        struct pim_upstream *upstream = NULL;
 
        zclient = pim_zebra_zclient_get();
@@ -190,8 +189,8 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
                        /* Release the (*, G)upstream from pnc->upstream_hash,
                         * whose Group belongs to the RP getting deleted
                         */
-                       for (ALL_LIST_ELEMENTS_RO(pim->upstream_list, upnode,
-                               upstream)) {
+                       frr_each (rb_pim_upstream, &pim->upstream_head,
+                                 upstream) {
                                struct prefix grp;
                                struct rp_info *trp_info;
 
@@ -447,15 +446,16 @@ static int pim_update_upstream_nh_helper(struct hash_bucket *bucket, void *arg)
 
        old.source_nexthop.interface = up->rpf.source_nexthop.interface;
        rpf_result = pim_rpf_update(pim, up, &old, __func__);
-       if (rpf_result == PIM_RPF_FAILURE) {
-               pim_upstream_rpf_clear(pim, up);
-               return HASHWALK_CONTINUE;
-       }
 
-       /* update kernel multicast forwarding cache (MFC) */
-       pim_upstream_mroute_iif_update(up->channel_oil, __func__);
+       /* update kernel multicast forwarding cache (MFC); if the
+        * RPF nbr is now unreachable the MFC has already been updated
+        * by pim_rpf_clear
+        */
+       if (rpf_result != PIM_RPF_FAILURE)
+               pim_upstream_mroute_iif_update(up->channel_oil, __func__);
 
-       if (rpf_result == PIM_RPF_CHANGED)
+       if (rpf_result == PIM_RPF_CHANGED ||
+               (rpf_result == PIM_RPF_FAILURE && old.source_nexthop.interface))
                pim_zebra_upstream_rpf_changed(pim, up, &old);
 
 
@@ -464,7 +464,8 @@ static int pim_update_upstream_nh_helper(struct hash_bucket *bucket, void *arg)
                        __PRETTY_FUNCTION__, up->sg_str, pim->vrf->name,
                        old.source_nexthop.interface
                        ? old.source_nexthop.interface->name : "Unknown",
-                       up->rpf.source_nexthop.interface->name);
+                       up->rpf.source_nexthop.interface
+                       ? up->rpf.source_nexthop.interface->name : "Unknown");
        }
 
        return HASHWALK_CONTINUE;