diff options
-rw-r--r-- | pimd/pim_addr.c | 8 | ||||
-rw-r--r-- | pimd/pim_addr.h | 7 | ||||
-rw-r--r-- | pimd/pim_bsm.c | 2 | ||||
-rw-r--r-- | pimd/pim_cmd.c | 4 | ||||
-rw-r--r-- | pimd/pim_ifchannel.c | 36 | ||||
-rw-r--r-- | pimd/pim_igmp_mtrace.c | 2 | ||||
-rw-r--r-- | pimd/pim_join.c | 2 | ||||
-rw-r--r-- | pimd/pim_mlag.c | 4 | ||||
-rw-r--r-- | pimd/pim_msdp.c | 7 | ||||
-rw-r--r-- | pimd/pim_msg.c | 4 | ||||
-rw-r--r-- | pimd/pim_nht.c | 2 | ||||
-rw-r--r-- | pimd/pim_oil.c | 4 | ||||
-rw-r--r-- | pimd/pim_register.c | 2 | ||||
-rw-r--r-- | pimd/pim_rp.c | 20 | ||||
-rw-r--r-- | pimd/pim_rpf.c | 2 | ||||
-rw-r--r-- | pimd/pim_str.h | 5 | ||||
-rw-r--r-- | pimd/pim_upstream.c | 36 | ||||
-rw-r--r-- | pimd/pim_vxlan.h | 8 | ||||
-rw-r--r-- | pimd/pim_zebra.c | 2 |
19 files changed, 75 insertions, 82 deletions
diff --git a/pimd/pim_addr.c b/pimd/pim_addr.c index 8d89b5714..2a6b4fe20 100644 --- a/pimd/pim_addr.c +++ b/pimd/pim_addr.c @@ -39,12 +39,8 @@ static ssize_t printfrr_pimaddr(struct fbuf *buf, struct printfrr_eargs *ea, if (!addr) return bputs(buf, "(null)"); - if (use_star) { - pim_addr zero = {}; - - if (memcmp(addr, &zero, sizeof(zero)) == 0) - return bputch(buf, '*'); - } + if (use_star && pim_addr_is_any(*addr)) + return bputch(buf, '*'); #if PIM_IPV == 4 return bprintfrr(buf, "%pI4", addr); diff --git a/pimd/pim_addr.h b/pimd/pim_addr.h index a1a8b55a5..b43969553 100644 --- a/pimd/pim_addr.h +++ b/pimd/pim_addr.h @@ -34,6 +34,13 @@ typedef struct in6_addr pim_addr; #define PIM_ADDRSTRLEN INET6_ADDRSTRLEN #endif +static inline bool pim_addr_is_any(pim_addr addr) +{ + pim_addr zero = {}; + + return memcmp(&addr, &zero, sizeof(zero)) == 0; +} + /* don't use this struct directly, use the pim_sgaddr typedef */ struct _pim_sgaddr { pim_addr grp; diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index 238c19d2c..0e6f78ab6 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -663,7 +663,7 @@ void pim_bsm_clear(struct pim_instance *pim) /* Find the upstream (*, G) whose upstream address is same as * the RP */ - if (up->sg.src.s_addr != INADDR_ANY) + if (!pim_addr_is_any(up->sg.src)) continue; struct prefix grp; diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 566c79c81..b365370f9 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -2536,8 +2536,8 @@ static void pim_show_upstream(struct pim_instance *pim, struct vty *vty, * we are the FHR, else we just put * the RP as the rpfAddress */ - if (up->flags & PIM_UPSTREAM_FLAG_MASK_FHR - || up->sg.src.s_addr == INADDR_ANY) { + if (up->flags & PIM_UPSTREAM_FLAG_MASK_FHR || + pim_addr_is_any(up->sg.src)) { char rpf[PREFIX_STRLEN]; struct pim_rpf *rpg; diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index dba1a10cc..d7011cabf 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -107,18 +107,16 @@ static void pim_ifchannel_find_new_children(struct pim_ifchannel *ch) struct pim_ifchannel *child; // Basic Sanity that we are not being silly - if ((ch->sg.src.s_addr != INADDR_ANY) - && (ch->sg.grp.s_addr != INADDR_ANY)) + if (!pim_addr_is_any(ch->sg.src) && !pim_addr_is_any(ch->sg.grp)) return; - if ((ch->sg.src.s_addr == INADDR_ANY) - && (ch->sg.grp.s_addr == INADDR_ANY)) + if (pim_addr_is_any(ch->sg.src) && pim_addr_is_any(ch->sg.grp)) return; RB_FOREACH (child, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) { - if ((ch->sg.grp.s_addr != INADDR_ANY) - && (child->sg.grp.s_addr == ch->sg.grp.s_addr) - && (child != ch)) { + if (!pim_addr_is_any(ch->sg.grp) && + (child->sg.grp.s_addr == ch->sg.grp.s_addr) && + (child != ch)) { child->parent = ch; listnode_add_sort(ch->sources, child); } @@ -162,9 +160,9 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) * being inherited. So let's figure out what * needs to be done here */ - if ((ch->sg.src.s_addr != INADDR_ANY) && - pim_upstream_evaluate_join_desired_interface( - ch->upstream, ch, ch->parent)) + if (!pim_addr_is_any(ch->sg.src) && + pim_upstream_evaluate_join_desired_interface( + ch->upstream, ch, ch->parent)) pim_channel_add_oif(ch->upstream->channel_oil, ch->interface, PIM_OIF_FLAG_PROTO_STAR, @@ -293,7 +291,7 @@ void pim_ifchannel_ifjoin_switch(const char *caller, struct pim_ifchannel *ch, ch->ifjoin_state = new_state; - if (ch->sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(ch->sg.src)) { struct pim_upstream *up = ch->upstream; struct pim_upstream *child; struct listnode *up_node; @@ -527,8 +525,8 @@ static struct pim_ifchannel *pim_ifchannel_find_parent(struct pim_ifchannel *ch) struct pim_ifchannel *parent = NULL; // (S,G) - if ((parent_sg.src.s_addr != INADDR_ANY) - && (parent_sg.grp.s_addr != INADDR_ANY)) { + if (!pim_addr_is_any(parent_sg.src) && + !pim_addr_is_any(parent_sg.grp)) { parent_sg.src.s_addr = INADDR_ANY; parent = pim_ifchannel_find(ch->interface, &parent_sg); @@ -576,7 +574,7 @@ struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp, pim_sgaddr *sg, ch->sg = *sg; snprintfrr(ch->sg_str, sizeof(ch->sg_str), "%pSG", sg); ch->parent = pim_ifchannel_find_parent(ch); - if (ch->sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(ch->sg.src)) { ch->sources = list_new(); ch->sources->cmp = (int (*)(void *, void *))pim_ifchannel_compare; @@ -992,8 +990,8 @@ void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr, THREAD_OFF(ch->t_ifjoin_prune_pending_timer); /* Check if SGRpt join Received */ - if ((source_flags & PIM_ENCODE_RPT_BIT) - && (sg->src.s_addr != INADDR_ANY)) { + if ((source_flags & PIM_ENCODE_RPT_BIT) && + !pim_addr_is_any(sg->src)) { /* * Transitions from Prune-Pending State (Rcv SGRpt Join) * RFC 7761 Sec 4.5.3: @@ -1194,7 +1192,7 @@ int pim_ifchannel_local_membership_add(struct interface *ifp, pim_sgaddr *sg, pim = pim_ifp->pim; /* skip (*,G) ch creation if G is of type SSM */ - if (sg->src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(sg->src)) { if (pim_is_grp_ssm(pim, sg->grp)) { if (PIM_DEBUG_PIM_EVENTS) zlog_debug("%s: local membership (S,G)=%pSG ignored as group is SSM", @@ -1212,7 +1210,7 @@ int pim_ifchannel_local_membership_add(struct interface *ifp, pim_sgaddr *sg, ifmembership_set(ch, PIM_IFMEMBERSHIP_INCLUDE); - if (sg->src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(sg->src)) { struct pim_upstream *up = pim_upstream_find(pim, sg); struct pim_upstream *child; struct listnode *up_node; @@ -1288,7 +1286,7 @@ void pim_ifchannel_local_membership_del(struct interface *ifp, pim_sgaddr *sg) return; ifmembership_set(ch, PIM_IFMEMBERSHIP_NOINFO); - if (sg->src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(sg->src)) { struct pim_upstream *up = pim_upstream_find(pim_ifp->pim, sg); struct pim_upstream *child; struct listnode *up_node, *up_nnode; diff --git a/pimd/pim_igmp_mtrace.c b/pimd/pim_igmp_mtrace.c index 1518ef232..c11f2b35d 100644 --- a/pimd/pim_igmp_mtrace.c +++ b/pimd/pim_igmp_mtrace.c @@ -154,7 +154,7 @@ static bool mtrace_fwd_info(struct pim_instance *pim, rspp->rtg_proto = MTRACE_RTG_PROTO_PIM; /* 6.2.2. 4. Fill in ... S, and Src Mask */ - if (sg.src.s_addr != INADDR_ANY) { + if (!pim_addr_is_any(sg.src)) { rspp->s = 1; rspp->src_mask = MTRACE_SRC_MASK_SOURCE; } else { diff --git a/pimd/pim_join.c b/pimd/pim_join.c index 93bbed48e..6569e832f 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -315,7 +315,7 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh, msg_upstream_addr.u.prefix4, &sg, msg_source_flags); - if (sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(sg.src)) { starg_ch = pim_ifchannel_find(ifp, &sg); if (starg_ch) pim_ifchannel_set_star_g_join_state( diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c index a9fb8205b..f4ddc1bf6 100644 --- a/pimd/pim_mlag.c +++ b/pimd/pim_mlag.c @@ -174,8 +174,8 @@ bool pim_mlag_up_df_role_update(struct pim_instance *pim, /* If DF role changed on a (*,G) termination mroute update the * associated DF role on the inherited (S,G) entries */ - if ((up->sg.src.s_addr == INADDR_ANY) && - PIM_UPSTREAM_FLAG_TEST_MLAG_VXLAN(up->flags)) + if (pim_addr_is_any(up->sg.src) && + PIM_UPSTREAM_FLAG_TEST_MLAG_VXLAN(up->flags)) pim_vxlan_inherit_mlag_flags(pim, up, true /* inherit */); return true; diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 1e91a931b..520d93bbf 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -625,8 +625,7 @@ void pim_msdp_up_join_state_changed(struct pim_instance *pim, } /* If this is not really an XG entry just move on */ - if ((xg_up->sg.src.s_addr != INADDR_ANY) - || (xg_up->sg.grp.s_addr == INADDR_ANY)) { + if (!pim_addr_is_any(xg_up->sg.src) || pim_addr_is_any(xg_up->sg.grp)) { return; } @@ -650,7 +649,7 @@ static void pim_msdp_up_xg_del(struct pim_instance *pim, pim_sgaddr *sg) } /* If this is not really an XG entry just move on */ - if ((sg->src.s_addr != INADDR_ANY) || (sg->grp.s_addr == INADDR_ANY)) { + if (!pim_addr_is_any(sg->src) || pim_addr_is_any(sg->grp)) { return; } @@ -669,7 +668,7 @@ void pim_msdp_up_del(struct pim_instance *pim, pim_sgaddr *sg) if (PIM_DEBUG_MSDP_INTERNAL) { zlog_debug("MSDP up %pSG del", sg); } - if (sg->src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(sg->src)) { pim_msdp_up_xg_del(pim, sg); } else { pim_msdp_sa_local_del_on_up_del(pim, sg); diff --git a/pimd/pim_msg.c b/pimd/pim_msg.c index 65b6405c8..c493ded0c 100644 --- a/pimd/pim_msg.c +++ b/pimd/pim_msg.c @@ -115,7 +115,7 @@ size_t pim_msg_get_jp_group_size(struct list *sources) size += sizeof(struct pim_encoded_source_ipv4) * sources->count; js = listgetdata(listhead(sources)); - if (js && js->up->sg.src.s_addr == INADDR_ANY && js->is_join) { + if (js && pim_addr_is_any(js->up->sg.src) && js->is_join) { struct pim_upstream *child, *up; struct listnode *up_node; @@ -193,7 +193,7 @@ size_t pim_msg_build_jp_groups(struct pim_jp_groups *grp, else grp->prunes++; - if (source->up->sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(source->up->sg.src)) { struct pim_instance *pim = source->up->channel_oil->pim; struct pim_rpf *rpf = pim_rp_g(pim, source->up->sg.grp); bits = PIM_ENCODE_SPARSE_BIT | PIM_ENCODE_WC_BIT diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index cd6f4c45f..0943e288b 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -234,7 +234,7 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr, struct prefix grp; struct rp_info *trp_info; - if (upstream->sg.src.s_addr != INADDR_ANY) + if (!pim_addr_is_any(upstream->sg.src)) continue; grp.family = AF_INET; diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index e3e1628a6..b17f821dd 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -326,8 +326,8 @@ void pim_channel_del_inherited_oif(struct channel_oil *c_oil, /* if an inherited OIF is being removed join-desired can change * if the inherited OIL is now empty and KAT is running */ - if (up && up->sg.src.s_addr != INADDR_ANY && - pim_upstream_empty_inherited_olist(up)) + if (up && !pim_addr_is_any(up->sg.src) && + pim_upstream_empty_inherited_olist(up)) pim_upstream_update_join_desired(up->pim, up); } diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 2d91e27d2..7d90701a1 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -381,7 +381,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr, } if (pim_is_grp_ssm(pim_ifp->pim, sg.grp)) { - if (sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(sg.src)) { zlog_warn( "%s: Received Register message for Group(%pI4) is now in SSM, dropping the packet", __func__, &sg.grp); diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index d356aff9f..f35adb0ce 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -536,8 +536,8 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, /* Find (*, G) upstream whose RP is not * configured yet */ - if ((up->upstream_addr.s_addr == INADDR_ANY) - && (up->sg.src.s_addr == INADDR_ANY)) { + if ((up->upstream_addr.s_addr == INADDR_ANY) && + pim_addr_is_any(up->sg.src)) { struct prefix grp; struct rp_info *trp_info; @@ -628,7 +628,7 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, route_node_get_lock_count(rn)); frr_each (rb_pim_upstream, &pim->upstream_head, up) { - if (up->sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(up->sg.src)) { struct prefix grp; struct rp_info *trp_info; @@ -778,9 +778,9 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr, /* Find the upstream (*, G) whose upstream address is * same as the deleted RP */ - if ((up->upstream_addr.s_addr - == rp_info->rp.rpf_addr.u.prefix4.s_addr) - && (up->sg.src.s_addr == INADDR_ANY)) { + if ((up->upstream_addr.s_addr == + 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; @@ -826,9 +826,9 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr, /* Find the upstream (*, G) whose upstream address is same as * the deleted RP */ - if ((up->upstream_addr.s_addr - == rp_info->rp.rpf_addr.u.prefix4.s_addr) - && (up->sg.src.s_addr == INADDR_ANY)) { + if ((up->upstream_addr.s_addr == + rp_info->rp.rpf_addr.u.prefix4.s_addr) && + pim_addr_is_any(up->sg.src)) { struct prefix grp; grp.family = AF_INET; @@ -914,7 +914,7 @@ int pim_rp_change(struct pim_instance *pim, struct in_addr new_rp_addr, listnode_add_sort(pim->rp_list, rp_info); frr_each (rb_pim_upstream, &pim->upstream_head, up) { - if (up->sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(up->sg.src)) { struct prefix grp; struct rp_info *trp_info; diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index aa89431d3..1e865a395 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -259,7 +259,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, grp.prefixlen = IPV4_MAX_BITLEN; grp.u.prefix4 = up->sg.grp; - if ((up->sg.src.s_addr == INADDR_ANY && I_am_RP(pim, up->sg.grp)) || + if ((pim_addr_is_any(up->sg.src) && I_am_RP(pim, up->sg.grp)) || PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) neigh_needed = false; pim_find_or_track_nexthop(pim, &nht_p, up, NULL, NULL); diff --git a/pimd/pim_str.h b/pimd/pim_str.h index d3cae2436..617dbb9a4 100644 --- a/pimd/pim_str.h +++ b/pimd/pim_str.h @@ -44,11 +44,6 @@ static inline void pim_addr_copy(pim_addr *dest, pim_addr *source) dest->s_addr = source->s_addr; } -static inline int pim_is_addr_any(pim_addr addr) -{ - return (addr.s_addr == INADDR_ANY); -} - static inline int pim_addr_cmp(pim_addr addr1, pim_addr addr2) { return IPV4_ADDR_CMP(&addr1, &addr2); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 8a9a9f973..e6536edfd 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -101,18 +101,16 @@ static void pim_upstream_find_new_children(struct pim_instance *pim, { struct pim_upstream *child; - if ((up->sg.src.s_addr != INADDR_ANY) - && (up->sg.grp.s_addr != INADDR_ANY)) + if (!pim_addr_is_any(up->sg.src) && !pim_addr_is_any(up->sg.grp)) return; - if ((up->sg.src.s_addr == INADDR_ANY) - && (up->sg.grp.s_addr == INADDR_ANY)) + if (pim_addr_is_any(up->sg.src) && pim_addr_is_any(up->sg.grp)) return; frr_each (rb_pim_upstream, &pim->upstream_head, child) { - if ((up->sg.grp.s_addr != INADDR_ANY) - && (child->sg.grp.s_addr == up->sg.grp.s_addr) - && (child != up)) { + if (!pim_addr_is_any(up->sg.grp) && + (child->sg.grp.s_addr == up->sg.grp.s_addr) && + (child != up)) { child->parent = up; listnode_add_sort(up->sources, child); if (PIM_UPSTREAM_FLAG_TEST_USE_RPT(child->flags)) @@ -135,8 +133,8 @@ static struct pim_upstream *pim_upstream_find_parent(struct pim_instance *pim, struct pim_upstream *up = NULL; // (S,G) - if ((child->sg.src.s_addr != INADDR_ANY) - && (child->sg.grp.s_addr != INADDR_ANY)) { + if (!pim_addr_is_any(child->sg.src) && + !pim_addr_is_any(child->sg.grp)) { any.src.s_addr = INADDR_ANY; up = pim_upstream_find(pim, &any); @@ -217,7 +215,7 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim, if (up->join_state == PIM_UPSTREAM_JOINED) { pim_jp_agg_single_upstream_send(&up->rpf, up, 0); - if (up->sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(up->sg.src)) { /* if a (*, G) entry in the joined state is being * deleted we * need to notify MSDP */ @@ -229,7 +227,7 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim, pim_jp_agg_upstream_verification(up, false); up->rpf.source_nexthop.interface = NULL; - if (up->sg.src.s_addr != INADDR_ANY) { + if (!pim_addr_is_any(up->sg.src)) { if (pim->upstream_sg_wheel) wheel_remove_item(pim->upstream_sg_wheel, up); notify_msdp = true; @@ -656,7 +654,7 @@ void pim_upstream_update_use_rpt(struct pim_upstream *up, bool old_use_rpt; bool new_use_rpt; - if (up->sg.src.s_addr == INADDR_ANY) + if (pim_addr_is_any(up->sg.src)) return; old_use_rpt = !!PIM_UPSTREAM_FLAG_TEST_USE_RPT(up->flags); @@ -704,7 +702,7 @@ void pim_upstream_reeval_use_rpt(struct pim_instance *pim) struct pim_upstream *up; frr_each (rb_pim_upstream, &pim->upstream_head, up) { - if (up->sg.src.s_addr == INADDR_ANY) + if (pim_addr_is_any(up->sg.src)) continue; pim_upstream_update_use_rpt(up, true /*update_mroute*/); @@ -775,7 +773,7 @@ void pim_upstream_switch(struct pim_instance *pim, struct pim_upstream *up, * RFC 4601 Sec 4.5.7: * JoinDesired(S,G) -> False, set SPTbit to false. */ - if (up->sg.src.s_addr != INADDR_ANY) + if (!pim_addr_is_any(up->sg.src)) up->sptbit = PIM_UPSTREAM_SPTBIT_FALSE; if (old_state == PIM_UPSTREAM_JOINED) @@ -889,7 +887,7 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim, } up->parent = pim_upstream_find_parent(pim, up); - if (up->sg.src.s_addr == INADDR_ANY) { + if (pim_addr_is_any(up->sg.src)) { up->sources = list_new(); up->sources->cmp = (int (*)(void *, void *))pim_upstream_compare; @@ -923,7 +921,7 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim, up->ifchannels = list_new(); up->ifchannels->cmp = (int (*)(void *, void *))pim_ifchannel_compare; - if (up->sg.src.s_addr != INADDR_ANY) { + if (!pim_addr_is_any(up->sg.src)) { wheel_add_item(pim->upstream_sg_wheel, up); /* Inherit the DF role from the parent (*, G) entry for @@ -1225,7 +1223,7 @@ bool pim_upstream_evaluate_join_desired(struct pim_instance *pim, empty_imm_oil = pim_upstream_empty_immediate_olist(pim, up); /* (*,G) */ - if (up->sg.src.s_addr == INADDR_ANY) + if (pim_addr_is_any(up->sg.src)) return !empty_imm_oil; /* (S,G) */ @@ -2131,7 +2129,7 @@ void pim_upstream_add_lhr_star_pimreg(struct pim_instance *pim) struct pim_upstream *up; frr_each (rb_pim_upstream, &pim->upstream_head, up) { - if (up->sg.src.s_addr != INADDR_ANY) + if (!pim_addr_is_any(up->sg.src)) continue; if (!PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(up->flags)) @@ -2178,7 +2176,7 @@ void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim, g.prefixlen = IPV4_MAX_BITLEN; frr_each (rb_pim_upstream, &pim->upstream_head, up) { - if (up->sg.src.s_addr != INADDR_ANY) + if (!pim_addr_is_any(up->sg.src)) continue; if (!PIM_UPSTREAM_FLAG_TEST_CAN_BE_LHR(up->flags)) diff --git a/pimd/pim_vxlan.h b/pimd/pim_vxlan.h index cd3de23e6..96882918a 100644 --- a/pimd/pim_vxlan.h +++ b/pimd/pim_vxlan.h @@ -109,14 +109,14 @@ struct pim_vxlan { */ static inline bool pim_vxlan_is_orig_mroute(struct pim_vxlan_sg *vxlan_sg) { - return (vxlan_sg->sg.src.s_addr != INADDR_ANY); + return !pim_addr_is_any(vxlan_sg->sg.src); } static inline bool pim_vxlan_is_local_sip(struct pim_upstream *up) { - return (up->sg.src.s_addr != INADDR_ANY) && - up->rpf.source_nexthop.interface && - if_is_loopback(up->rpf.source_nexthop.interface); + return !pim_addr_is_any(up->sg.src) && + up->rpf.source_nexthop.interface && + if_is_loopback(up->rpf.source_nexthop.interface); } static inline bool pim_vxlan_is_term_dev_cfg(struct pim_instance *pim, diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 1ffd4bf74..371812b45 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -562,7 +562,7 @@ void igmp_source_forward_reevaluate_all(struct pim_instance *pim) RB_FOREACH_SAFE (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb, ch_temp) { if (pim_is_grp_ssm(pim, ch->sg.grp)) { - if (ch->sg.src.s_addr == INADDR_ANY) + if (pim_addr_is_any(ch->sg.src)) pim_ifchannel_delete(ch); } } |