diff options
-rw-r--r-- | pimd/pim_bsm.h | 2 | ||||
-rw-r--r-- | pimd/pim_rp.c | 28 | ||||
-rw-r--r-- | pimd/pim_rp.h | 5 |
3 files changed, 13 insertions, 22 deletions
diff --git a/pimd/pim_bsm.h b/pimd/pim_bsm.h index a536b5068..fceabef9e 100644 --- a/pimd/pim_bsm.h +++ b/pimd/pim_bsm.h @@ -115,7 +115,7 @@ struct bsm_rpinfo { uint32_t elapse_time; /* upd at expiry of elected RP node */ uint16_t rp_prio; /* RP priority */ uint16_t rp_holdtime; /* RP holdtime - g2rp timer value */ - struct in_addr rp_address; /* RP Address */ + pim_addr rp_address; /* RP Address */ struct bsgrp_node *bsgrp_node; /* Back ptr to bsgrp_node */ struct thread *g2rp_timer; /* Run only for elected RP node */ }; 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); diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h index 98a3ae378..a63295209 100644 --- a/pimd/pim_rp.h +++ b/pimd/pim_rp.h @@ -47,9 +47,8 @@ void pim_rp_free(struct pim_instance *pim); void pim_rp_list_hash_clean(void *data); -int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, - struct prefix group, const char *plist, - enum rp_source rp_src_flag); +int pim_rp_new(struct pim_instance *pim, pim_addr rp_addr, struct prefix group, + const char *plist, enum rp_source rp_src_flag); void pim_rp_del_config(struct pim_instance *pim, pim_addr rp_addr, const char *group, const char *plist); int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr, |