Skip to content

Commit

Permalink
pimd,pim6d: Set RP to true if the address matches, ignore prefix-length
Browse files Browse the repository at this point in the history
The API pim_rp_check_interface_addrs checks if the RP address matches
with the primary address then it returns true.
In case of PIMv4 this condition is true, therefore the router becomes RP.
But in case of PIMv6, this condition does not pass because primary address
for PIMv6 is link-local address.

Also PIMv4 allows secondary addresses to be used as RP
if it is a host route in case primary does not match.

Fixing it by only checking the configured
RP address with the interface address and ignoring the prefix
length since it does not matter.

Fixes: #11335

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
  • Loading branch information
mobash-rasool committed Jul 12, 2022
1 parent a770da1 commit f7fa567
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pimd/pim_rp.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ static int pim_rp_check_interface_addrs(struct rp_info *rp_info,
struct listnode *node;
struct pim_secondary_addr *sec_addr;
struct prefix rpf_addr;
pim_addr sec_paddr;

pim_addr_to_prefix(&rpf_addr, rp_info->rp.rpf_addr);

Expand All @@ -351,9 +352,11 @@ static int pim_rp_check_interface_addrs(struct rp_info *rp_info,
}

for (ALL_LIST_ELEMENTS_RO(pim_ifp->sec_addr_list, node, sec_addr)) {
if (prefix_same(&sec_addr->addr, &rpf_addr)) {
sec_paddr = pim_addr_from_prefix(&sec_addr->addr);
/* If an RP-address is self, It should be enough to say
* I am RP the prefix-length should not matter here */
if (!pim_addr_cmp(sec_paddr, rp_info->rp.rpf_addr))
return 1;
}
}

return 0;
Expand Down

0 comments on commit f7fa567

Please sign in to comment.