diff options
author | Mobashshera Rasool <mrasool@vmware.com> | 2022-02-02 16:00:50 +0100 |
---|---|---|
committer | Mobashshera Rasool <mrasool@vmware.com> | 2022-03-08 09:57:51 +0100 |
commit | 6ed1cea1dca63693b06d7b4a0c9a95820d9d2efc (patch) | |
tree | ad95a05fc67e842b4224413b149079aa676683a1 /pimd/pim_rp.c | |
parent | pim6d: Return type and parameter changes for api pim_rp_del_config (diff) | |
download | frr-6ed1cea1dca63693b06d7b4a0c9a95820d9d2efc.tar.xz frr-6ed1cea1dca63693b06d7b4a0c9a95820d9d2efc.zip |
pim6d: Modify pim_rp_new for pimv6
Modify the api pim_rp_new to accomodate pimv6 changes.
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
Diffstat (limited to 'pimd/pim_rp.c')
-rw-r--r-- | pimd/pim_rp.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 6752b9fa0..88e824225 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -412,7 +412,7 @@ void pim_upstream_update(struct pim_instance *pim, struct pim_upstream *up) } -int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix group, +int pim_rp_new(struct pim_instance *pim, pim_addr rp_addr, struct prefix group, const char *plist, enum rp_source rp_src_flag) { int result = 0; @@ -427,14 +427,12 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix g struct pim_upstream *up; bool upstream_updated = false; - if (rp_addr.s_addr == INADDR_ANY) + if (pim_addr_is_any(rp_addr)) return PIM_RP_BAD_ADDRESS; rp_info = XCALLOC(MTYPE_PIM_RP, sizeof(*rp_info)); - rp_info->rp.rpf_addr.family = AF_INET; - rp_info->rp.rpf_addr.prefixlen = IPV4_MAX_BITLEN; - rp_info->rp.rpf_addr.u.prefix4 = rp_addr; + pim_addr_to_prefix(&rp_info->rp.rpf_addr, rp_addr); prefix_copy(&rp_info->group, &group); rp_info->rp_src = rp_src_flag; @@ -461,8 +459,8 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix g */ for (ALL_LIST_ELEMENTS(pim->rp_list, node, nnode, tmp_rp_info)) { - if (rp_info->rp.rpf_addr.u.prefix4.s_addr - == tmp_rp_info->rp.rpf_addr.u.prefix4.s_addr) { + if (prefix_same(&rp_info->rp.rpf_addr, + &tmp_rp_info->rp.rpf_addr)) { if (tmp_rp_info->plist) pim_rp_del_config(pim, rp_addr, NULL, tmp_rp_info->plist); @@ -497,10 +495,9 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix g */ for (ALL_LIST_ELEMENTS(pim->rp_list, node, nnode, tmp_rp_info)) { - if (tmp_rp_info->plist - && rp_info->rp.rpf_addr.u.prefix4.s_addr - == tmp_rp_info->rp.rpf_addr.u.prefix4 - .s_addr) { + if (tmp_rp_info->plist && + prefix_same(&rp_info->rp.rpf_addr, + &tmp_rp_info->rp.rpf_addr)) { pim_rp_del_config(pim, rp_addr, NULL, tmp_rp_info->plist); } @@ -516,10 +513,7 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix g XFREE(MTYPE_PIM_RP, rp_info); /* Register addr with Zebra NHT */ - nht_p.family = AF_INET; - nht_p.prefixlen = IPV4_MAX_BITLEN; - nht_p.u.prefix4 = - rp_all->rp.rpf_addr.u.prefix4; // RP address + nht_p = rp_all->rp.rpf_addr; if (PIM_DEBUG_PIM_NHT_RP) zlog_debug( "%s: NHT Register rp_all addr %pFX grp %pFX ", @@ -640,9 +634,7 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix g pim_rp_refresh_group_to_rp_mapping(pim); /* Register addr with Zebra NHT */ - nht_p.family = AF_INET; - nht_p.prefixlen = IPV4_MAX_BITLEN; - nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; + nht_p = rp_info->rp.rpf_addr; if (PIM_DEBUG_PIM_NHT_RP) zlog_debug("%s: NHT Register RP addr %pFX grp %pFX with Zebra ", __func__, &nht_p, &rp_info->group); |