]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Further work to fix rpf lookups and nbrs
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 15 Sep 2016 20:50:08 +0000 (16:50 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:10 +0000 (20:26 -0500)
When we do a RPF lookup return a path that we have
neighbors for in those cases where we need to have
a neighbor to pass along the SG state via a pim
join/prune message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_assert.c
pimd/pim_ifchannel.c
pimd/pim_ifchannel.h
pimd/pim_mroute.c
pimd/pim_register.c
pimd/pim_rpf.c
pimd/pim_upstream.c
pimd/pim_upstream.h

index 1add2ebb009ca7caad4609430227d49969aa2e1a..481a2851d55c9976669e6c31cf8dc2981ffae4b6 100644 (file)
@@ -150,7 +150,7 @@ static int dispatch_assert(struct interface *ifp,
   memset (&sg, 0, sizeof (struct prefix_sg));
   sg.src = source_addr;
   sg.grp = group_addr;
-  ch = pim_ifchannel_add(ifp, &sg);
+  ch = pim_ifchannel_add(ifp, &sg, 0);
   if (!ch) {
     zlog_warn("%s: (S,G)=%s failure creating channel on interface %s",
              __PRETTY_FUNCTION__,
index eaf7ab7096460487679c975fbdbb201117e8a5a7..1bc10f4ccef19770857a544b53aa5e041f788283 100644 (file)
@@ -39,6 +39,7 @@
 #include "pim_rpf.h"
 #include "pim_macro.h"
 #include "pim_oil.h"
+#include "pim_upstream.h"
 
 /*
  * A (*,G) or a (*,*) is going away
@@ -366,7 +367,7 @@ pim_ifchannel_find_parent (struct interface *ifp,
 
 struct pim_ifchannel *
 pim_ifchannel_add(struct interface *ifp,
-                 struct prefix_sg *sg)
+                 struct prefix_sg *sg, int flags)
 {
   struct pim_interface *pim_ifp;
   struct pim_ifchannel *ch;
@@ -379,7 +380,7 @@ pim_ifchannel_add(struct interface *ifp,
   pim_ifp = ifp->info;
   zassert(pim_ifp);
 
-  up = pim_upstream_add(sg, NULL);
+  up = pim_upstream_add(sg, NULL, flags);
   if (!up) {
     zlog_err("%s: could not attach upstream (S,G)=%s on interface %s",
             __PRETTY_FUNCTION__,
@@ -615,7 +616,7 @@ void pim_ifchannel_join_add(struct interface *ifp,
     return;
   }
 
-  ch = pim_ifchannel_add(ifp, sg);
+  ch = pim_ifchannel_add(ifp, sg, PIM_UPSTREAM_FLAG_MASK_SRC_PIM);
   if (!ch)
     return;
 
@@ -715,7 +716,7 @@ void pim_ifchannel_prune(struct interface *ifp,
     return;
   }
 
-  ch = pim_ifchannel_add(ifp, sg);
+  ch = pim_ifchannel_add(ifp, sg, PIM_UPSTREAM_FLAG_MASK_SRC_PIM);
   if (!ch)
     return;
 
@@ -772,7 +773,7 @@ void pim_ifchannel_local_membership_add(struct interface *ifp,
   if (!PIM_IF_TEST_PIM(pim_ifp->options))
     return;
 
-  ch = pim_ifchannel_add(ifp, sg);
+  ch = pim_ifchannel_add(ifp, sg, PIM_UPSTREAM_FLAG_MASK_SRC_IGMP);
   if (!ch) {
     return;
   }
index 0c39210642d55171ebdce102771fd18a8347bb13..8c542d17f2be44fad8a89c4793bbf78e41326acc 100644 (file)
@@ -105,7 +105,7 @@ void pim_ifchannel_delete_on_noinfo(struct interface *ifp);
 struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp,
                                         struct prefix_sg *sg);
 struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp,
-                                       struct prefix_sg *sg);
+                                       struct prefix_sg *sg, int flags);
 void pim_ifchannel_join_add(struct interface *ifp,
                            struct in_addr neigh_addr,
                            struct in_addr upstream,
index dd3ae3117d1154f60411ad9899e44cb3e7c1ac17..8ac1a708bb67c9620d3758d9028424f6cb5c1d46 100644 (file)
@@ -136,7 +136,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
     return 0;
   }
 
-  up = pim_upstream_add (&sg, ifp);
+  up = pim_upstream_add (&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR);
   if (!up) {
     if (PIM_DEBUG_MROUTE) {
       zlog_debug("%s: Failure to add upstream information for %s",
@@ -363,7 +363,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf)
     pim_mroute_add (oil);
   if (pim_if_connected_to_source (ifp, sg.src))
     {
-      up = pim_upstream_add (&sg, ifp);
+      up = pim_upstream_add (&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR);
       if (!up)
        {
          if (PIM_DEBUG_MROUTE)
index 69a3d6167f38d44041a39b9bfdc331fb6c099097..c2e666f17bf32a70195080bc1ab8e048525537af 100644 (file)
@@ -333,7 +333,7 @@ pim_register_recv (struct interface *ifp,
      */
     if (!upstream)
       {
-       upstream = pim_upstream_add (&sg, ifp);
+       upstream = pim_upstream_add (&sg, ifp, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM);
         if (!upstream)
           {
             zlog_warn ("Failure to create upstream state");
index 3d88f9e70b2c2e15d161af9f44b865a189409227..46a6ef1ca409dddec2abf9996f1878f0a5563589 100644 (file)
@@ -46,7 +46,6 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei
   int found = 0;
   int i = 0;
 
-  neighbor_needed = 0;
   memset (nexthop_tab, 0, sizeof (struct pim_zlookup_nexthop) * MULTIPATH_NUM);
   num_ifindex = zclient_lookup_nexthop(nexthop_tab,
                                       MULTIPATH_NUM,
@@ -87,7 +86,7 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei
                     ifp->name, first_ifindex, addr_str);
         }
 
-      if (neighbor_needed)
+      if (neighbor_needed && !pim_if_connected_to_source (ifp, addr))
         {
           struct pim_neighbor *nbr;
 
@@ -148,7 +147,9 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct in_addr *old_
   save_rpf_addr = rpf->rpf_addr;       /* detect change in RPF'(S,G) */
 
   if (pim_nexthop_lookup(&rpf->source_nexthop,
-                         up->upstream_addr, !PIM_UPSTREAM_FLAG_TEST_FHR (up->flags))) {
+                         up->upstream_addr,
+                         !PIM_UPSTREAM_FLAG_TEST_FHR (up->flags) && 
+                         !PIM_UPSTREAM_FLAG_TEST_SRC_IGMP (up->flags))) {
     return PIM_RPF_FAILURE;
   }
 
index 625795092cbbc5fa450e0872d8f93a66e0df4ce7..b495f39182db798294a25a7d4c85c95e5f92b76e 100644 (file)
@@ -468,7 +468,8 @@ pim_upstream_switch(struct pim_upstream *up,
 }
 
 static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
-                                            struct interface *incoming)
+                                            struct interface *incoming,
+                                            int flags)
 {
   struct pim_upstream *up;
   enum pim_rpf_result rpf_result;
@@ -492,7 +493,7 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
 
   up->parent                     = pim_upstream_find_parent (sg);
   pim_upstream_find_new_children (up);
-  up->flags                      = 0;
+  up->flags                      = flags;
   up->ref_count                  = 1;
   up->t_join_timer               = NULL;
   up->t_ka_timer                 = NULL;
@@ -512,6 +513,9 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
 
   rpf_result = pim_rpf_update(up, NULL);
   if (rpf_result == PIM_RPF_FAILURE) {
+    if (PIM_DEBUG_PIM_TRACE)
+      zlog_debug ("%s: Attempting to create upstream(%s), Unable to RPF for source", __PRETTY_FUNCTION__,
+                  pim_str_sg_dump (&up->sg));
     XFREE(MTYPE_PIM_UPSTREAM, up);
     return NULL;
   }
@@ -557,7 +561,8 @@ struct pim_upstream *pim_upstream_find(struct prefix_sg *sg)
 }
 
 struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
-                                     struct interface *incoming)
+                                     struct interface *incoming,
+                                     int flags)
 {
   struct pim_upstream *up;
 
@@ -566,7 +571,7 @@ struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
     ++up->ref_count;
   }
   else {
-    up = pim_upstream_new(sg, incoming);
+    up = pim_upstream_new(sg, incoming, flags);
   }
 
   return up;
index 6d30349bd63c556d2aec00d8012ee89a562eea37..3c9862fe9885cca36d1be9729f8c30735a0fadc4 100644 (file)
@@ -113,7 +113,7 @@ void pim_upstream_delete(struct pim_upstream *up);
 struct pim_upstream *pim_upstream_find (struct prefix_sg *sg);
 struct pim_upstream *pim_upstream_find_non_any (struct prefix_sg *sg);
 struct pim_upstream *pim_upstream_add (struct prefix_sg *sg,
-                                     struct interface *ifp);
+                                     struct interface *ifp, int);
 void pim_upstream_del(struct pim_upstream *up);
 
 int pim_upstream_evaluate_join_desired(struct pim_upstream *up);