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>
diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c
index 38339da..e7619a5 100644
--- a/pimd/pim_rpf.c
+++ b/pimd/pim_rpf.c
@@ -121,14 +121,14 @@
}
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 @@
}
/* 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;
}
diff --git a/pimd/pim_rpf.h b/pimd/pim_rpf.h
index 078e89f..9a48ea0 100644
--- a/pimd/pim_rpf.h
+++ b/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 */
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 8f85b17..0a07c06 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -341,10 +341,10 @@
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 @@
/* 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 */);