Browse Source

pimd: send pim prune via correct interface when rpf upstream interface for a source changes

When the rpf upstream interface for a joined source changes, a prune was
being sent out the new rpf upstream interface that was intended for the old
upstream router.  The prune should be sent out the old rpf upstream
interface so that the old route for the multicast source is pruned.

Reviewed-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
Signed-off-by: Taylor Bouvin <tbouvin@atcorp.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
Jafar Al-Gharaibeh 2 years ago
parent
commit
06de82eaeb
3 changed files with 11 additions and 11 deletions
  1. 6 6
      pimd/pim_rpf.c
  2. 1 1
      pimd/pim_rpf.h
  3. 4 4
      pimd/pim_zebra.c

+ 6 - 6
pimd/pim_rpf.c

@@ -121,14 +121,14 @@ static int nexthop_mismatch(const struct pim_nexthop *nh1,
 }
 
 enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
-				   struct in_addr *old_rpf_addr)
+				   struct pim_rpf *old_rpf)
 {
-  struct in_addr      save_rpf_addr;
   struct pim_nexthop  save_nexthop;
+  struct pim_rpf	  save_rpf;
   struct pim_rpf     *rpf = &up->rpf;
 
   save_nexthop  = rpf->source_nexthop; /* detect change in pim_nexthop */
-  save_rpf_addr = rpf->rpf_addr;       /* detect change in RPF'(S,G) */
+  save_rpf = up->rpf;
 
   if (pim_nexthop_lookup(&rpf->source_nexthop,
 			 up->source_addr)) {
@@ -193,11 +193,11 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
   }
 
   /* detect change in RPF'(S,G) */
-  if (save_rpf_addr.s_addr != rpf->rpf_addr.s_addr) {
+  if (save_rpf.rpf_addr.s_addr != rpf->rpf_addr.s_addr) {
 
     /* return old rpf to caller ? */
-    if (old_rpf_addr)
-      *old_rpf_addr = save_rpf_addr;
+    if (old_rpf)
+      *old_rpf = save_rpf;
 
     return PIM_RPF_CHANGED;
   }

+ 1 - 1
pimd/pim_rpf.h

@@ -31,6 +31,6 @@
 int pim_nexthop_lookup(struct pim_nexthop *nexthop,
 		       struct in_addr addr);
 enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
-				   struct in_addr *old_rpf_addr);
+				   struct pim_rpf *old_rpf);
 
 #endif /* PIM_RPF_H */

+ 4 - 4
pimd/pim_zebra.c

@@ -341,10 +341,10 @@ static void scan_upstream_rpf_cache()
   struct pim_upstream *up;
 
   for (ALL_LIST_ELEMENTS(qpim_upstream_list, up_node, up_nextnode, up)) {
-    struct in_addr      old_rpf_addr;
+    struct pim_rpf		old_rpf;
     enum pim_rpf_result rpf_result;
 
-    rpf_result = pim_rpf_update(up, &old_rpf_addr);
+    rpf_result = pim_rpf_update(up, &old_rpf);
     if (rpf_result == PIM_RPF_FAILURE)
       continue;
 
@@ -368,8 +368,8 @@ static void scan_upstream_rpf_cache()
 
     
 	/* send Prune(S,G) to the old upstream neighbor */
-	pim_joinprune_send(up->rpf.source_nexthop.interface,
-			   old_rpf_addr,
+	pim_joinprune_send(old_rpf.source_nexthop.interface,
+			   old_rpf.rpf_addr,
 			   up->source_addr,
 			   up->group_addr,
 			   0 /* prune */);