diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 8b27809c7c..218b154887 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -403,7 +403,7 @@ static int pim_sec_addr_update(struct interface *ifp) for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) { struct prefix *p = ifc->address; - if (PIM_INADDR_IS_ANY(p->u.prefix4)) { + if (p->u.prefix4.s_addr == INADDR_ANY) { continue; } @@ -598,7 +598,7 @@ void pim_if_addr_add(struct connected *ifc) if (PIM_IF_TEST_PIM(pim_ifp->options)) { - if (PIM_INADDR_ISNOT_ANY(pim_ifp->primary_address)) { + if (!pim_addr_is_any(pim_ifp->primary_address)) { /* Interface has a valid socket ? */ if (pim_ifp->pim_sock_fd < 0) { @@ -684,7 +684,7 @@ static void pim_if_addr_del_pim(struct connected *ifc) return; } - if (PIM_INADDR_ISNOT_ANY(pim_ifp->primary_address)) { + if (!pim_addr_is_any(pim_ifp->primary_address)) { /* Interface keeps a valid primary address */ return; } @@ -752,7 +752,7 @@ void pim_if_addr_add_all(struct interface *ifp) if (PIM_IF_TEST_PIM(pim_ifp->options)) { /* Interface has a valid primary address ? */ - if (PIM_INADDR_ISNOT_ANY(pim_ifp->primary_address)) { + if (!pim_addr_is_any(pim_ifp->primary_address)) { /* Interface has a valid socket ? */ if (pim_ifp->pim_sock_fd < 0) { @@ -836,7 +836,7 @@ struct in_addr pim_find_primary_addr(struct interface *ifp) int v6_addrs = 0; struct pim_interface *pim_ifp = ifp->info; - if (pim_ifp && PIM_INADDR_ISNOT_ANY(pim_ifp->update_source)) { + if (pim_ifp && !pim_addr_is_any(pim_ifp->update_source)) { return pim_ifp->update_source; } @@ -848,7 +848,7 @@ struct in_addr pim_find_primary_addr(struct interface *ifp) continue; } - if (PIM_INADDR_IS_ANY(p->u.prefix4)) { + if (p->u.prefix4.s_addr == INADDR_ANY) { zlog_warn( "%s: null IPv4 address connected to interface %s", __func__, ifp->name); @@ -916,7 +916,7 @@ static int pim_iface_next_vif_index(struct interface *ifp) int pim_if_add_vif(struct interface *ifp, bool ispimreg, bool is_vxlan_term) { struct pim_interface *pim_ifp = ifp->info; - struct in_addr ifaddr; + pim_addr ifaddr; unsigned char flags = 0; assert(pim_ifp); @@ -935,7 +935,7 @@ int pim_if_add_vif(struct interface *ifp, bool ispimreg, bool is_vxlan_term) } ifaddr = pim_ifp->primary_address; - if (!ispimreg && !is_vxlan_term && PIM_INADDR_IS_ANY(ifaddr)) { + if (!ispimreg && !is_vxlan_term && pim_addr_is_any(ifaddr)) { zlog_warn( "%s: could not get address for interface %s ifindex=%d", __func__, ifp->name, ifp->ifindex); diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 492af5f2d2..fafca5a148 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -1675,7 +1675,7 @@ void igmp_v3_send_query(struct gm_group *group, int fd, const char *ifname, */ if (!s_flag) { /* general query? */ - if (PIM_INADDR_IS_ANY(group_addr)) { + if (group_addr.s_addr == INADDR_ANY) { char dst_str[INET_ADDRSTRLEN]; char group_str[INET_ADDRSTRLEN]; pim_inet4_dump("", dst_addr, dst_str, @@ -1762,7 +1762,7 @@ void igmp_v3_recv_query(struct gm_sock *igmp, const char *from_str, if (!s_flag) { /* s_flag is clear */ - if (PIM_INADDR_IS_ANY(group_addr)) { + if (group_addr.s_addr == INADDR_ANY) { /* this is a general query */ /* log that general query should have the s_flag set */ zlog_warn( diff --git a/pimd/pim_join.c b/pimd/pim_join.c index f9aa791116..fa2d8d462b 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -477,7 +477,7 @@ int pim_joinprune_send(struct pim_rpf *rpf, struct list *groups) return -1; } - if (PIM_INADDR_IS_ANY(rpf->rpf_addr.u.prefix4)) { + if (rpf->rpf_addr.u.prefix4.s_addr == INADDR_ANY) { if (PIM_DEBUG_PIM_J_P) { char dst_str[INET_ADDRSTRLEN]; pim_inet4_dump("", rpf->rpf_addr.u.prefix4, diff --git a/pimd/pim_macro.c b/pimd/pim_macro.c index 81ef6962de..aa41033cea 100644 --- a/pimd/pim_macro.c +++ b/pimd/pim_macro.c @@ -128,7 +128,7 @@ int pim_macro_ch_lost_assert(const struct pim_ifchannel *ch) return 0; /* false */ } - if (PIM_INADDR_IS_ANY(ch->ifassert_winner)) + if (pim_addr_is_any(ch->ifassert_winner)) return 0; /* false */ /* AssertWinner(S,G,I) == me ? */ diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 8c4d2293c5..f35dc818a5 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -315,7 +315,7 @@ static void pim_msdp_sa_peer_ip_set(struct pim_msdp_sa *sa, } /* any time the peer ip changes also update the rp address */ - if (PIM_INADDR_ISNOT_ANY(sa->peer)) { + if (sa->peer.s_addr != INADDR_ANY) { old_mp = pim_msdp_peer_find(sa->pim, sa->peer); if (old_mp && old_mp->sa_cnt) { --old_mp->sa_cnt; diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c index c7411070d3..f5af227712 100644 --- a/pimd/pim_vty.c +++ b/pimd/pim_vty.c @@ -339,8 +339,7 @@ int pim_interface_config_write(struct vty *vty) } /* update source */ - if (PIM_INADDR_ISNOT_ANY( - pim_ifp->update_source)) { + if (!pim_addr_is_any(pim_ifp->update_source)) { char src_str[INET_ADDRSTRLEN]; pim_inet4_dump("", pim_ifp->update_source, diff --git a/pimd/pimd.h b/pimd/pimd.h index 5ba29f9c41..7732dc5b74 100644 --- a/pimd/pimd.h +++ b/pimd/pimd.h @@ -83,8 +83,6 @@ #define PIM_FORCE_BOOLEAN(expr) ((expr) != 0) #define PIM_NET_INADDR_ANY (htonl(INADDR_ANY)) -#define PIM_INADDR_IS_ANY(addr) (addr).s_addr == PIM_NET_INADDR_ANY -#define PIM_INADDR_ISNOT_ANY(addr) ((addr).s_addr != PIM_NET_INADDR_ANY) /* struct in_addr addr */ #define PIM_MASK_PIM_EVENTS (1 << 0) #define PIM_MASK_PIM_EVENTS_DETAIL (1 << 1)