{
struct pim_rpf old_rpf;
enum pim_rpf_result rpf_result;
- struct in_addr old_upstream_addr;
- struct in_addr new_upstream_addr;
+ pim_addr old_upstream_addr;
+ pim_addr new_upstream_addr;
struct prefix nht_p;
old_upstream_addr = up->upstream_addr;
zlog_debug("%s: pim upstream update for old upstream %pI4",
__func__, &old_upstream_addr);
- if (old_upstream_addr.s_addr == new_upstream_addr.s_addr)
+ if (!pim_addr_cmp(old_upstream_addr, new_upstream_addr))
return;
/* Lets consider a case, where a PIM upstream has a better RP as a
* This upstream has to be added to the upstream hash of new RP's
* NHT(pnc) and has to be removed from old RP's NHT upstream hash
*/
- if (old_upstream_addr.s_addr != INADDR_ANY) {
+ if (!pim_addr_is_any(old_upstream_addr)) {
/* Deregister addr with Zebra NHT */
- nht_p.family = AF_INET;
- nht_p.prefixlen = IPV4_MAX_BITLEN;
- nht_p.u.prefix4 = old_upstream_addr;
+ pim_addr_to_prefix(&nht_p, old_upstream_addr);
if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
"%s: Deregister upstream %s addr %pFX with Zebra NHT",
struct prefix grp;
struct rp_info *trp_info;
- grp.family = AF_INET;
- grp.prefixlen = IPV4_MAX_BITLEN;
- grp.u.prefix4 = up->sg.grp;
+ pim_addr_to_prefix(&grp, up->sg.grp);
trp_info = pim_rp_find_match_group(
pim, &grp);
if (trp_info == rp_all) {
struct prefix grp;
struct rp_info *trp_info;
- grp.family = AF_INET;
- grp.prefixlen = IPV4_MAX_BITLEN;
- grp.u.prefix4 = up->sg.grp;
+ pim_addr_to_prefix(&grp, up->sg.grp);
trp_info = pim_rp_find_match_group(pim, &grp);
if (trp_info == rp_info) {
rp_info->rp.rpf_addr.u.prefix4.s_addr) &&
pim_addr_is_any(up->sg.src)) {
struct prefix grp;
- grp.family = AF_INET;
- grp.prefixlen = IPV4_MAX_BITLEN;
- grp.u.prefix4 = up->sg.grp;
+
+ pim_addr_to_prefix(&grp, up->sg.grp);
trp_info = pim_rp_find_match_group(pim, &grp);
if (trp_info == rp_all) {
pim_upstream_rpf_clear(pim, up);
pim_addr_is_any(up->sg.src)) {
struct prefix grp;
- grp.family = AF_INET;
- grp.prefixlen = IPV4_MAX_BITLEN;
- grp.u.prefix4 = up->sg.grp;
-
+ pim_addr_to_prefix(&grp, up->sg.grp);
trp_info = pim_rp_find_match_group(pim, &grp);
/* RP not found for the group grp */
struct prefix grp;
struct rp_info *trp_info;
- grp.family = AF_INET;
- grp.prefixlen = IPV4_MAX_BITLEN;
- grp.u.prefix4 = up->sg.grp;
+ pim_addr_to_prefix(&grp, up->sg.grp);
trp_info = pim_rp_find_match_group(pim, &grp);
if (trp_info == rp_info) {
}
}
+#if PIM_IPV == 4
/*
* I_am_RP(G) is true if the group-to-RP mapping indicates that
* this router is the RP for the group.
*
* Since we only have static RP, all groups are part of this RP
*/
-int pim_rp_i_am_rp(struct pim_instance *pim, struct in_addr group)
+int pim_rp_i_am_rp(struct pim_instance *pim, pim_addr group)
{
struct prefix g;
struct rp_info *rp_info;
if (rp_info)
return rp_info->i_am_rp;
-
return 0;
}
*
* Return the RP that the Group belongs too.
*/
-struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group)
+struct pim_rpf *pim_rp_g(struct pim_instance *pim, pim_addr group)
{
struct prefix g;
struct rp_info *rp_info;
* then set the upstream addr as INADDR_ANY and return failure.
*
*/
-int pim_rp_set_upstream_addr(struct pim_instance *pim, struct in_addr *up,
- struct in_addr source, struct in_addr group)
+int pim_rp_set_upstream_addr(struct pim_instance *pim, pim_addr *up,
+ pim_addr source, pim_addr group)
{
struct rp_info *rp_info;
struct prefix g;
return 1;
}
+#else
+CPP_NOTICE("functions stubbed out for IPv6");
+
+int pim_rp_i_am_rp(struct pim_instance *pim, pim_addr group)
+{
+ return 0;
+}
+
+struct pim_rpf *pim_rp_g(struct pim_instance *pim, pim_addr group)
+{
+ return NULL;
+}
+
+int pim_rp_set_upstream_addr(struct pim_instance *pim, pim_addr *up,
+ pim_addr source, pim_addr group)
+{
+ return 0;
+}
+#endif
int pim_rp_config_write(struct pim_instance *pim, struct vty *vty,
const char *spaces)
void pim_rp_setup(struct pim_instance *pim);
-int pim_rp_i_am_rp(struct pim_instance *pim, struct in_addr group);
+int pim_rp_i_am_rp(struct pim_instance *pim, pim_addr group);
void pim_rp_check_on_if_add(struct pim_interface *pim_ifp);
void pim_i_am_rp_re_evaluate(struct pim_instance *pim);
bool pim_rp_check_is_my_ip_address(struct pim_instance *pim,
struct in_addr dest_addr);
-int pim_rp_set_upstream_addr(struct pim_instance *pim, struct in_addr *up,
- struct in_addr source, struct in_addr group);
+int pim_rp_set_upstream_addr(struct pim_instance *pim, pim_addr *up,
+ pim_addr source, pim_addr group);
-struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group);
+struct pim_rpf *pim_rp_g(struct pim_instance *pim, pim_addr group);
#define I_am_RP(P, G) pim_rp_i_am_rp ((P), (G))
#define RP(P, G) pim_rp_g ((P), (G))