mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 09:06:46 +00:00
pimd: Reduce RP checks a bit
The pim_rp_check_is_my_ip_address function was checking to see if we were the actual RP as well as the pim_register code was doing the same thing. Remove the reduncancy a bit and just make this function check for that we are the actual receiver of this data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
4f9aec30ea
commit
f43593d958
@ -279,14 +279,13 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
|
|||||||
#define PIM_MSG_REGISTER_BIT_RESERVED_LEN 4
|
#define PIM_MSG_REGISTER_BIT_RESERVED_LEN 4
|
||||||
ip_hdr = (struct ip *)(tlv_buf + PIM_MSG_REGISTER_BIT_RESERVED_LEN);
|
ip_hdr = (struct ip *)(tlv_buf + PIM_MSG_REGISTER_BIT_RESERVED_LEN);
|
||||||
|
|
||||||
if (!pim_rp_check_is_my_ip_address(pim_ifp->pim, ip_hdr->ip_dst,
|
if (!pim_rp_check_is_my_ip_address(pim_ifp->pim, dest_addr)) {
|
||||||
dest_addr)) {
|
|
||||||
if (PIM_DEBUG_PIM_REG) {
|
if (PIM_DEBUG_PIM_REG) {
|
||||||
char dest[INET_ADDRSTRLEN];
|
char dest[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
pim_inet4_dump("<dst?>", dest_addr, dest, sizeof(dest));
|
pim_inet4_dump("<dst?>", dest_addr, dest, sizeof(dest));
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: Received Register message for %s that I do not own",
|
"%s: Received Register message for destination address: %s that I do not own",
|
||||||
__func__, dest);
|
__func__, dest);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1091,34 +1091,13 @@ int pim_rp_config_write(struct pim_instance *pim, struct vty *vty,
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_rp_check_is_my_ip_address(struct pim_instance *pim,
|
bool pim_rp_check_is_my_ip_address(struct pim_instance *pim,
|
||||||
struct in_addr group,
|
|
||||||
struct in_addr dest_addr)
|
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))
|
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)
|
void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
|
||||||
|
@ -55,8 +55,7 @@ int pim_rp_i_am_rp(struct pim_instance *pim, struct in_addr group);
|
|||||||
void pim_rp_check_on_if_add(struct pim_interface *pim_ifp);
|
void pim_rp_check_on_if_add(struct pim_interface *pim_ifp);
|
||||||
void pim_i_am_rp_re_evaluate(struct pim_instance *pim);
|
void pim_i_am_rp_re_evaluate(struct pim_instance *pim);
|
||||||
|
|
||||||
int pim_rp_check_is_my_ip_address(struct pim_instance *pim,
|
bool pim_rp_check_is_my_ip_address(struct pim_instance *pim,
|
||||||
struct in_addr group,
|
|
||||||
struct in_addr dest_addr);
|
struct in_addr dest_addr);
|
||||||
|
|
||||||
int pim_rp_set_upstream_addr(struct pim_instance *pim, struct in_addr *up,
|
int pim_rp_set_upstream_addr(struct pim_instance *pim, struct in_addr *up,
|
||||||
|
Loading…
Reference in New Issue
Block a user