]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #4040 from donaldsharp/pim_cleanup
authorJafar Al-Gharaibeh <Jafaral@users.noreply.github.com>
Mon, 1 Apr 2019 15:25:07 +0000 (10:25 -0500)
committerGitHub <noreply@github.com>
Mon, 1 Apr 2019 15:25:07 +0000 (10:25 -0500)
Pim cleanup

1  2 
pimd/pim_rp.c
pimd/pim_zebra.c

diff --combined pimd/pim_rp.c
index 76b82d9a58d5019ebcfa513a10b4ef8270fd92fb,0a98a2f7e90acbee061da0339d762e53928a0ace..b7db7d04187fc100ea57bca967a873f6eb68b2f2
@@@ -1091,34 -1091,13 +1091,13 @@@ int pim_rp_config_write(struct pim_inst
        return count;
  }
  
- int pim_rp_check_is_my_ip_address(struct pim_instance *pim,
-                                 struct in_addr group,
-                                 struct in_addr dest_addr)
+ bool pim_rp_check_is_my_ip_address(struct pim_instance *pim,
+                                  struct in_addr dest_addr)
  {
-       struct rp_info *rp_info;
-       struct prefix g;
-       memset(&g, 0, sizeof(g));
-       g.family = AF_INET;
-       g.prefixlen = 32;
-       g.u.prefix4 = group;
-       rp_info = pim_rp_find_match_group(pim, &g);
-       /*
-        * See if we can short-cut some?
-        * This might not make sense if we ever leave a static RP
-        * type of configuration.
-        * Note - Premature optimization might bite our patooeys' here.
-        */
-       if (I_am_RP(pim, group)) {
-               if (dest_addr.s_addr == rp_info->rp.rpf_addr.u.prefix4.s_addr)
-                       return 1;
-       }
        if (if_lookup_exact_address(&dest_addr, AF_INET, pim->vrf_id))
-               return 1;
+               return true;
  
-       return 0;
+       return false;
  }
  
  void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
                json = json_object_new_object();
        else
                vty_out(vty,
 -                      "RP address       group/prefix-list   OIF         I am RP\n");
 +                      "RP address       group/prefix-list   OIF               I am RP\n");
  
        for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) {
                if (!pim_rpf_addr_is_inaddr_none(&rp_info->rp)) {
                                                           48));
  
                                if (rp_info->rp.source_nexthop.interface)
 -                                      vty_out(vty, "%-10s  ",
 +                                      vty_out(vty, "%-16s  ",
                                                rp_info->rp.source_nexthop
                                                        .interface->name);
                                else
 -                                      vty_out(vty, "%-10s  ", "(Unknown)");
 +                                      vty_out(vty, "%-16s  ", "(Unknown)");
  
                                if (rp_info->i_am_rp)
                                        vty_out(vty, "yes\n");
diff --combined pimd/pim_zebra.c
index 753efb95006c6ff3413f1bb834b0c9bb4369c4f9,a27722688560207045f8207619dfc68e23299715..70f099b0d78d2c73b24bf53efd9b04ceb736d079
@@@ -150,8 -150,6 +150,8 @@@ static int pim_zebra_if_del(int command
        if (!if_is_operative(ifp))
                pim_if_addr_del_all(ifp);
  
 +      if_set_index(ifp, IFINDEX_INTERNAL);
 +
        return 0;
  }
  
@@@ -543,45 -541,6 +543,6 @@@ void pim_zebra_upstream_rpf_changed(str
        pim_upstream_update_join_desired(pim, up);
  }
  
- static void scan_upstream_rpf_cache(struct pim_instance *pim)
- {
-       struct listnode *up_node;
-       struct listnode *up_nextnode;
-       struct pim_upstream *up;
-       for (ALL_LIST_ELEMENTS(pim->upstream_list, up_node, up_nextnode, up)) {
-               enum pim_rpf_result rpf_result;
-               struct pim_rpf old;
-               struct prefix nht_p;
-               if (up->upstream_addr.s_addr == INADDR_ANY) {
-                       if (PIM_DEBUG_TRACE)
-                               zlog_debug(
-                                   "%s: RP not configured for Upstream %s",
-                                   __PRETTY_FUNCTION__, up->sg_str);
-                       continue;
-               }
-               nht_p.family = AF_INET;
-               nht_p.prefixlen = IPV4_MAX_BITLEN;
-               nht_p.u.prefix4.s_addr = up->upstream_addr.s_addr;
-               pim_resolve_upstream_nh(pim, &nht_p);
-               old.source_nexthop.interface = up->rpf.source_nexthop.interface;
-               old.source_nexthop.nbr = up->rpf.source_nexthop.nbr;
-               rpf_result = pim_rpf_update(pim, up, &old, 0);
-               if (rpf_result == PIM_RPF_FAILURE)
-                       continue;
-               if (rpf_result == PIM_RPF_CHANGED)
-                       pim_zebra_upstream_rpf_changed(pim, up, &old);
-       } /* for (qpim_upstream_list) */
-       pim_zebra_update_all_interfaces(pim);
- }
  void pim_scan_individual_oil(struct channel_oil *c_oil, int in_vif_index)
  {
        struct in_addr vif_source;
@@@ -745,9 -704,6 +706,6 @@@ static int on_rpf_cache_refresh(struct 
  {
        struct pim_instance *pim = THREAD_ARG(t);
  
-       /* update PIM protocol state */
-       scan_upstream_rpf_cache(pim);
        /* update kernel multicast forwarding cache (MFC) */
        pim_scan_oil(pim);