case BGP_ATTR_NHLEN_IPV4:
stream_get(&attr->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
/* Probably needed for RFC 2283 */
- if (attr->nexthop.s_addr == 0)
+ if (attr->nexthop.s_addr == INADDR_ANY)
memcpy(&attr->nexthop.s_addr,
&attr->mp_nexthop_global_in, IPV4_MAX_BYTELEN);
break;
for (; pi; pi = pi->next) {
json_object *json_path = NULL;
- if (vtep_ip.s_addr
+ if (vtep_ip.s_addr != INADDR_ANY
&& !IPV4_ADDR_SAME(&(vtep_ip),
&(pi->attr->nexthop)))
continue;
* ignore that rule
*/
if (prefix->family == AF_INET
- && prefix->u.prefix4.s_addr == 0)
+ && prefix->u.prefix4.s_addr == INADDR_ANY)
bpem->match_bitmask_iprule |= bitmask;
else
bpem->match_bitmask |= bitmask;
}
/* Clear remote router-id. */
- peer->remote_id.s_addr = 0;
+ peer->remote_id.s_addr = INADDR_ANY;
/* Clear peer capability flag. */
peer->cap = 0;
}
/* Zap multipath attr nexthop so we set nexthop to self */
- attr.nexthop.s_addr = 0;
+ attr.nexthop.s_addr = INADDR_ANY;
memset(&attr.mp_nexthop_global, 0, sizeof(struct in6_addr));
/* TODO: should we set ATOMIC_AGGREGATE and AGGREGATOR? */
}
/* remote router-id check. */
- if (remote_id.s_addr == 0 || IPV4_CLASS_DE(ntohl(remote_id.s_addr))
+ if (remote_id.s_addr == INADDR_ANY
+ || IPV4_CLASS_DE(ntohl(remote_id.s_addr))
|| ntohl(peer->local_id.s_addr) == ntohl(remote_id.s_addr)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s bad OPEN, wrong router identifier %s",
|| peer->afc_nego[AFI_IP][SAFI_MULTICAST]
|| peer->afc_nego[AFI_IP][SAFI_MPLS_VPN]
|| peer->afc_nego[AFI_IP][SAFI_ENCAP]) {
- if (!peer->nexthop.v4.s_addr) {
+ if (peer->nexthop.v4.s_addr == INADDR_ANY) {
#if defined(HAVE_CUMULUS)
flog_err(
EC_BGP_SND_FAIL,
* draft-ietf-idr-flowspec-redirect
*/
if (api_action_redirect_ip) {
- if (api_action_redirect_ip->u
- .zr.redirect_ip_v4.s_addr)
+ if (api_action_redirect_ip->u.zr
+ .redirect_ip_v4.s_addr
+ != INADDR_ANY)
continue;
- if (!path->attr->nexthop.s_addr)
+ if (path->attr->nexthop.s_addr
+ == INADDR_ANY)
continue;
- api_action_redirect_ip->u
- .zr.redirect_ip_v4.s_addr =
+ api_action_redirect_ip->u.zr
+ .redirect_ip_v4.s_addr =
path->attr->nexthop.s_addr;
api_action_redirect_ip->u.zr.duplicate
= ecom_eval->val[7];
static void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr)
{
if (family == AF_INET) {
- attr->nexthop.s_addr = 0;
- attr->mp_nexthop_global_in.s_addr = 0;
+ attr->nexthop.s_addr = INADDR_ANY;
+ attr->mp_nexthop_global_in.s_addr = INADDR_ANY;
}
if (family == AF_INET6)
memset(&attr->mp_nexthop_global, 0, IPV6_MAX_BYTELEN);
/* If NEXT_HOP is present, validate it. */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) {
- if (attr->nexthop.s_addr == 0
+ if (attr->nexthop.s_addr == INADDR_ANY
|| IPV4_CLASS_DE(ntohl(attr->nexthop.s_addr))
- || bgp_nexthop_self(bgp, afi, type, stype,
- attr, rn))
+ || bgp_nexthop_self(bgp, afi, type, stype, attr, rn))
return 1;
}
switch (attr->mp_nexthop_len) {
case BGP_ATTR_NHLEN_IPV4:
case BGP_ATTR_NHLEN_VPNV4:
- ret = (attr->mp_nexthop_global_in.s_addr == 0
- || IPV4_CLASS_DE(ntohl(
- attr->mp_nexthop_global_in.s_addr))
- || bgp_nexthop_self(bgp, afi, type, stype,
- attr, rn));
+ ret = (attr->mp_nexthop_global_in.s_addr == INADDR_ANY
+ || IPV4_CLASS_DE(
+ ntohl(attr->mp_nexthop_global_in.s_addr))
+ || bgp_nexthop_self(bgp, afi, type, stype, attr,
+ rn));
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
bgp_static->backdoor = backdoor;
bgp_static->valid = 0;
bgp_static->igpmetric = 0;
- bgp_static->igpnexthop.s_addr = 0;
+ bgp_static->igpnexthop.s_addr = INADDR_ANY;
bgp_static->label_index = label_index;
if (rmap) {
bgp_static->backdoor = 0;
bgp_static->valid = 0;
bgp_static->igpmetric = 0;
- bgp_static->igpnexthop.s_addr = 0;
+ bgp_static->igpnexthop.s_addr = INADDR_ANY;
bgp_static->label = label;
bgp_static->prd = prd;
: inet_ntoa(attr->nexthop),
vrf_id_str);
} else if (safi == SAFI_FLOWSPEC) {
- if (attr->nexthop.s_addr != 0) {
+ if (attr->nexthop.s_addr != INADDR_ANY) {
if (json_paths) {
json_nexthop_global = json_object_new_object();
*/
SET_FLAG(path->attr->rmap_change_flags,
BATTR_RMAP_NEXTHOP_PEER_ADDRESS);
- path->attr->nexthop.s_addr = 0;
+ path->attr->nexthop.s_addr = INADDR_ANY;
}
} else {
/* Set next hop value. */
oid2in_addr(offset, len, &paddr);
} else
- paddr.s_addr = 0;
+ paddr.s_addr = INADDR_ANY;
if (!rn)
return NULL;
return min;
}
- paddr.s_addr = 0;
+ paddr.s_addr = INADDR_ANY;
} while ((rn = bgp_route_next(rn)) != NULL);
}
return NULL;
mod_v4nh = &peer->nexthop.v4;
nh_modified = 1;
}
- } else if (!v4nh.s_addr) {
+ } else if (v4nh.s_addr == INADDR_ANY) {
mod_v4nh = &peer->nexthop.v4;
nh_modified = 1;
- } else if (
- peer->sort == BGP_PEER_EBGP
- && (bgp_multiaccess_check_v4(v4nh, peer) == 0)
- && !CHECK_FLAG(
+ } else if (peer->sort == BGP_PEER_EBGP
+ && (bgp_multiaccess_check_v4(v4nh, peer)
+ == 0)
+ && !CHECK_FLAG(
vec->flags,
BPKT_ATTRVEC_FLAGS_RMAP_NH_UNCHANGED)
- && !peer_af_flag_check(
+ && !peer_af_flag_check(
peer, paf->afi, paf->safi,
PEER_FLAG_NEXTHOP_UNCHANGED)) {
/* NOTE: not handling case where NH has new AFI
mod_v4nh = &v4nh;
/* No route-map changes allowed for EVPN nexthops. */
- if (!v4nh.s_addr) {
+ if (v4nh.s_addr == INADDR_ANY) {
mod_v4nh = &peer->nexthop.v4;
nh_modified = 1;
}
/* IPv4 nexthop. */
ret = if_get_ipv4_address(ifp, &nexthop->v4);
- if (!ret && peer->local_id.s_addr)
+ if (!ret && peer->local_id.s_addr != INADDR_ANY)
nexthop->v4 = peer->local_id;
/* Global address*/
if (cmd == ZEBRA_VNI_ADD)
return bgp_evpn_local_vni_add(
- bgp, vni, vtep_ip.s_addr ? vtep_ip : bgp->router_id,
+ bgp, vni,
+ vtep_ip.s_addr != INADDR_ANY ? vtep_ip : bgp->router_id,
tenant_vrf_id, mcast_grp);
else
return bgp_evpn_local_vni_del(bgp, vni);
SET_FLAG(api.message, ZAPI_MESSAGE_DISTANCE);
/* redirect IP */
- if (nh->gate.ipv4.s_addr) {
+ if (nh->gate.ipv4.s_addr != INADDR_ANY) {
char buff[PREFIX_STRLEN];
api_nh->vrf_id = nh->vrf_id;
int bgp_router_id_static_set(struct bgp *bgp, struct in_addr id)
{
bgp->router_id_static = id;
- bgp_router_id_set(bgp, id.s_addr ? &id : &bgp->router_id_zebra,
+ bgp_router_id_set(bgp,
+ id.s_addr != INADDR_ANY ? &id : &bgp->router_id_zebra,
true /* is config */);
return 0;
}
rn->info = (void *)pref;
/* Schedule Router ID Update. */
- if (eigrp->router_id.s_addr == 0)
+ if (eigrp->router_id.s_addr == INADDR_ANY)
eigrp_router_id_update(eigrp);
/* Run network config now. */
/* Get target interface. */
break;
case NB_EV_APPLY:
eigrp = nb_running_get_entry(dnode, NULL, true);
- eigrp->router_id_static.s_addr = 0;
+ eigrp->router_id_static.s_addr = INADDR_ANY;
break;
}
router_id_old = eigrp->router_id;
- if (eigrp->router_id_static.s_addr != 0)
+ if (eigrp->router_id_static.s_addr != INADDR_ANY)
router_id = eigrp->router_id_static;
- else if (eigrp->router_id.s_addr != 0)
+ else if (eigrp->router_id.s_addr != INADDR_ANY)
router_id = eigrp->router_id;
else
eigrp->vrf_id = vrf_id;
eigrp->vrid = 0;
eigrp->AS = as;
- eigrp->router_id.s_addr = 0;
- eigrp->router_id_static.s_addr = 0;
+ eigrp->router_id.s_addr = INADDR_ANY;
+ eigrp->router_id_static.s_addr = INADDR_ANY;
eigrp->sequence_number = 1;
/*Configure default K Values for EIGRP Process*/
vty_out (vty, "mpls ldp\n");
- if (ldpd_conf->rtr_id.s_addr != 0)
- vty_out (vty, " router-id %s\n",
- inet_ntoa(ldpd_conf->rtr_id));
+ if (ldpd_conf->rtr_id.s_addr != INADDR_ANY)
+ vty_out(vty, " router-id %s\n", inet_ntoa(ldpd_conf->rtr_id));
if (ldpd_conf->lhello_holdtime != LINK_DFLT_HOLDTIME &&
ldpd_conf->lhello_holdtime != 0)
else {
vty_out(vty, " %s",
inet_ntoa(filter->addr));
- if (filter->addr_mask.s_addr != 0)
+ if (filter->addr_mask.s_addr
+ != INADDR_ANY)
vty_out(vty,
", wildcard bits %s",
inet_ntoa(
else {
vty_out(vty, " %s",
inet_ntoa(filter->addr));
- if (filter->addr_mask.s_addr != 0)
+ if (filter->addr_mask.s_addr
+ != INADDR_ANY)
vty_out(vty,
", wildcard bits %s",
inet_ntoa(
vty_out(vty, " ip");
if (filter->addr_mask.s_addr == 0xffffffff)
vty_out(vty, " any");
- else if (filter->addr_mask.s_addr == 0)
+ else if (filter->addr_mask.s_addr == INADDR_ANY)
vty_out(vty, " host %s", inet_ntoa(filter->addr));
else {
vty_out(vty, " %s", inet_ntoa(filter->addr));
if (filter->mask_mask.s_addr == 0xffffffff)
vty_out(vty, " any");
- else if (filter->mask_mask.s_addr == 0)
+ else if (filter->mask_mask.s_addr == INADDR_ANY)
vty_out(vty, " host %s", inet_ntoa(filter->mask));
else {
vty_out(vty, " %s", inet_ntoa(filter->mask));
vty_out(vty, " any\n");
else {
vty_out(vty, " %s", inet_ntoa(filter->addr));
- if (filter->addr_mask.s_addr != 0)
+ if (filter->addr_mask.s_addr != INADDR_ANY)
vty_out(vty, " %s",
inet_ntoa(filter->addr_mask));
vty_out(vty, "\n");
/* If prefix is 0.0.0.0/0 then return 1 else return 0. */
int prefix_ipv4_any(const struct prefix_ipv4 *p)
{
- return (p->prefix.s_addr == 0 && p->prefixlen == 0);
+ return (p->prefix.s_addr == INADDR_ANY && p->prefixlen == 0);
}
/* Allocate a new ip version 6 route */
} else {
destination = ntohl(network.s_addr);
- if (network.s_addr == 0)
+ if (network.s_addr == INADDR_ANY)
prefixlen = 0;
else if (IN_CLASSC(destination))
prefixlen = 24;
* only implemented action.
*/
yang_dnode_get_ipv4(&ia, dnode, NULL);
- if (ia.s_addr == 0 || IPV4_CLASS_DE(ntohl(ia.s_addr)))
+ if (ia.s_addr == INADDR_ANY || IPV4_CLASS_DE(ntohl(ia.s_addr)))
return NB_ERR_VALIDATION;
/* FALLTHROUGH */
case NB_EV_PREPARE:
&nifp->linkidx, &saddr);
debugf(NHRP_DEBUG_IF, "%s: GRE: %x %x %x", ifp->name,
nifp->grekey, nifp->linkidx, saddr.s_addr);
- if (saddr.s_addr)
+ if (saddr.s_addr != INADDR_ANY)
sockunion_set(&nbma, AF_INET, (uint8_t *)&saddr.s_addr,
sizeof(saddr.s_addr));
else if (!nbmaifp && nifp->linkidx != IFINDEX_INTERNAL)
tmp = SET_OPAQUE_LSID(opaque_type, opaque_id);
lsah->id.s_addr = htonl(tmp);
- lsah->adv_router.s_addr = 0;
+ lsah->adv_router.s_addr = INADDR_ANY;
lsah->ls_seqnum = 0;
lsah->checksum = 0;
lsah->length = htons(sizeof(struct lsa_header) + opaquelen);
ospf_schedule_abr_task(ospf);
UNSET_FLAG(range->flags, OSPF_AREA_RANGE_SUBSTITUTE);
- range->subst_addr.s_addr = 0;
+ range->subst_addr.s_addr = INADDR_ANY;
range->subst_masklen = 0;
return 1;
external-LSA. This indicates the IP address to which
packets for the destination should be forwarded. */
- if (al->e[0].fwd_addr.s_addr == 0) {
+ if (al->e[0].fwd_addr.s_addr == INADDR_ANY) {
/* If the forwarding address is set to 0.0.0.0, packets should
be sent to the ASBR itself. Among the multiple routing table
entries for the ASBR, select the preferred entry as follows.
ospf_route_add(ospf->new_external_route, &p, new, asbr_route);
- if (al->e[0].fwd_addr.s_addr)
+ if (al->e[0].fwd_addr.s_addr != INADDR_ANY)
ospf_ase_complete_direct_routes(new, al->e[0].fwd_addr);
return 0;
} else {
zlog_debug(
"Route[External]: New route is better");
ospf_route_subst(rn, new, asbr_route);
- if (al->e[0].fwd_addr.s_addr)
+ if (al->e[0].fwd_addr.s_addr != INADDR_ANY)
ospf_ase_complete_direct_routes(
new, al->e[0].fwd_addr);
or = new;
if (IS_DEBUG_OSPF(lsa, LSA))
zlog_debug("Route[External]: Routes are equal");
ospf_route_copy_nexthops(or, asbr_route->paths);
- if (al->e[0].fwd_addr.s_addr)
+ if (al->e[0].fwd_addr.s_addr != INADDR_ANY)
ospf_ase_complete_direct_routes(
or, al->e[0].fwd_addr);
}
p = prefix_ipv4_new();
p->family = AF_INET;
- p->prefix.s_addr = 0;
+ p->prefix.s_addr = INADDR_ANY;
p->prefixlen = 0;
co->address = (struct prefix *)p;
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("ospf_vl_new(): set if->name to %s", vi->name);
- area_id.s_addr = 0;
+ area_id.s_addr = INADDR_ANY;
area = ospf_area_get(ospf, area_id);
voi->area = area;
{
struct interface *ifp = vl_data->vl_oi->ifp;
- vl_data->vl_oi->address->u.prefix4.s_addr = 0;
+ vl_data->vl_oi->address->u.prefix4.s_addr = INADDR_ANY;
vl_data->vl_oi->address->prefixlen = 0;
ospf_if_free(vl_data->vl_oi);
if_delete(&ifp);
if ((oi = vl_data->vl_oi) == NULL)
return;
- oi->address->u.prefix4.s_addr = 0;
+ oi->address->u.prefix4.s_addr = INADDR_ANY;
oi->address->prefixlen = 0;
UNSET_FLAG(oi->ifp->flags, IFF_UP);
for (rn = route_top(nbrs); rn; rn = route_next(rn))
if ((nbr = rn->info) != NULL)
/* Ignore 0.0.0.0 node*/
- if (nbr->router_id.s_addr != 0)
+ if (nbr->router_id.s_addr != INADDR_ANY)
/* Is neighbor eligible? */
if (nbr->priority > 0)
/* Is neighbor upper 2-Way? */
for (rn = route_top(nbrs); rn; rn = route_next(rn))
if ((nbr = rn->info) != NULL)
/* Ignore 0.0.0.0 node*/
- if (nbr->router_id.s_addr != 0)
+ if (nbr->router_id.s_addr != INADDR_ANY)
/* Is neighbor upper 2-Way? */
if (nbr->state >= NSM_TwoWay)
/* Ignore myself. */
}
/* Sanity check. */
- if (new->data->adv_router.s_addr == 0) {
+ if (new->data->adv_router.s_addr == INADDR_ANY) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("LSA[Type1]: AdvRouter is 0, discard");
ospf_lsa_discard(new);
{
struct in_addr fwd;
- fwd.s_addr = 0;
+ fwd.s_addr = INADDR_ANY;
if (if_is_operative(oi->ifp))
return oi->address->u.prefix4;
struct prefix_ipv4 q;
q.family = AF_INET;
- q.prefix.s_addr = 0;
+ q.prefix.s_addr = INADDR_ANY;
q.prefixlen = 0;
return prefix_same((struct prefix *)p, (struct prefix *)&q);
*/
- if (ospf->router_id.s_addr == 0) {
+ if (ospf->router_id.s_addr == INADDR_ANY) {
if (IS_DEBUG_OSPF_EVENT)
- zlog_debug("LSA[Type5:%pI4]: deferring AS-external-LSA origination, router ID is zero",
- &ei->p.prefix);
+ zlog_debug(
+ "LSA[Type5:%pI4]: deferring AS-external-LSA origination, router ID is zero",
+ &ei->p.prefix);
return NULL;
}
p.family = AF_INET;
p.prefixlen = 0;
- p.prefix.s_addr = 0;
+ p.prefix.s_addr = INADDR_ANY;
ei = ospf_default_external_info(ospf);
lsa = ospf_external_info_find_lsa(ospf, &p);
/* If neighbor itself declares DR and no BDR exists,
cause event BackupSeen */
if (IPV4_ADDR_SAME(&nbr->address.u.prefix4, &hello->d_router))
- if (hello->bd_router.s_addr == 0 && oi->state == ISM_Waiting)
+ if (hello->bd_router.s_addr == INADDR_ANY
+ && oi->state == ISM_Waiting)
OSPF_ISM_EVENT_SCHEDULE(oi, ISM_BackupSeen);
/* neighbor itself declares BDR. */
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn))
if ((nbr = rn->info))
if (nbr->router_id.s_addr
- != 0) /* Ignore 0.0.0.0 node. */
+ != INADDR_ANY) /* Ignore 0.0.0.0 node. */
if (nbr->state
!= NSM_Attempt) /* Ignore Down neighbor. */
if (nbr->state
/* Check neighbor is
* sane? */
if (nbr->d_router.s_addr
- != 0
+ != INADDR_ANY
&& IPV4_ADDR_SAME(
- &nbr->d_router,
- &oi->address
- ->u
- .prefix4)
+ &nbr->d_router,
+ &oi->address
+ ->u
+ .prefix4)
&& IPV4_ADDR_SAME(
- &nbr->bd_router,
- &oi->address
- ->u
- .prefix4))
+ &nbr->bd_router,
+ &oi->address
+ ->u
+ .prefix4))
flag = 1;
/* Hello packet overflows interface MTU. */
IF_NAME(oi));
path = ospf_path_new();
- path->nexthop.s_addr = 0;
+ path->nexthop.s_addr = INADDR_ANY;
path->ifindex = oi->ifp->ifindex;
if (CHECK_FLAG(oi->connected->flags,
ZEBRA_IFA_UNNUMBERED))
new_or = ospf_route_new();
new_or->type = OSPF_DESTINATION_DISCARD;
- new_or->id.s_addr = 0;
+ new_or->id.s_addr = INADDR_ANY;
new_or->cost = 0;
new_or->u.std.area_id = area->area_id;
new_or->u.std.external_routing = area->external_routing;
}
/* Show DR information. */
- if (DR(oi).s_addr == 0) {
+ if (DR(oi).s_addr == INADDR_ANY) {
if (!use_json)
vty_out(vty,
" No backup designated router on this network\n");
}
if (nbr->state == NSM_Attempt
- && nbr->router_id.s_addr == 0)
+ && nbr->router_id.s_addr == INADDR_ANY)
strlcpy(neigh_str, "neighbor",
sizeof(neigh_str));
else
ospf_nbr_state_message(nbr, msgbuf, 16);
if (nbr->state == NSM_Attempt
- && nbr->router_id.s_addr == 0)
+ && nbr->router_id.s_addr == INADDR_ANY)
vty_out(vty, "%-15s %3d %-15s ", "-",
nbr->priority, msgbuf);
else
json_neigh_array = NULL;
}
- if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
+ if (nbr->state == NSM_Attempt
+ && nbr->router_id.s_addr == INADDR_ANY)
strlcpy(neigh_str, "noNbrId", sizeof(neigh_str));
else
strlcpy(neigh_str, inet_ntoa(nbr->router_id),
} else {
/* Show neighbor ID. */
- if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
+ if (nbr->state == NSM_Attempt
+ && nbr->router_id.s_addr == INADDR_ANY)
vty_out(vty, " Neighbor %s,", "-");
else
vty_out(vty, " Neighbor %s,",
int cur_originate = ospf->default_originate;
const char *type_str = NULL;
- nexthop.s_addr = 0;
+ nexthop.s_addr = INADDR_ANY;
p.family = AF_INET;
- p.prefix.s_addr = 0;
+ p.prefix.s_addr = INADDR_ANY;
p.prefixlen = 0;
ospf->default_originate = originate;
/* Nothing has changed, so nothing to do; return */
return 0;
}
- if (ospf->router_id.s_addr != 0) {
+ if (ospf->router_id.s_addr != INADDR_ANY) {
if (ei) {
if (is_prefix_default(&p))
ospf_external_lsa_refresh_default(ospf);
static int ospf_is_ready(struct ospf *ospf)
{
/* OSPF must be on and Router-ID must be configured. */
- if (!ospf || ospf->router_id.s_addr == 0)
+ if (!ospf || ospf->router_id.s_addr == INADDR_ANY)
return 0;
return 1;
ospf = ospf_new(instance, name);
ospf_add(ospf);
- if (ospf->router_id_static.s_addr == 0)
+ if (ospf->router_id_static.s_addr == INADDR_ANY)
ospf_router_id_update(ospf);
ospf_opaque_type11_lsa_init(ospf);
ospf = ospf_new(instance, NULL /* VRF_DEFAULT*/);
ospf_add(ospf);
- if (ospf->router_id_static.s_addr == 0)
+ if (ospf->router_id_static.s_addr == INADDR_ANY)
ospf_router_id_update(ospf);
ospf_opaque_type11_lsa_init(ospf);
* ospf_router_id_update() will call ospf_if_update
* whenever r-id is configured instead.
*/
- if ((area->ospf->router_id.s_addr != 0) && if_is_operative(co->ifp))
+ if ((area->ospf->router_id.s_addr != INADDR_ANY)
+ && if_is_operative(co->ifp))
ospf_if_up(oi);
}
struct interface *ifp;
/* Schedule Router ID Update. */
- if (area->ospf->router_id.s_addr == 0)
+ if (area->ospf->router_id.s_addr == INADDR_ANY)
ospf_router_id_update(area->ospf);
/* Get target interface. */
exit(EXIT_FAILURE);
}
- mc_group.s_addr = 0;
+ mc_group.s_addr = INADDR_ANY;
not_group = false;
if (argc == 3) {
continue;
RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
- if (sg->grp.s_addr != 0
+ if (sg->grp.s_addr != INADDR_ANY
&& sg->grp.s_addr != ch->sg.grp.s_addr)
continue;
- if (sg->src.s_addr != 0
+ if (sg->src.s_addr != INADDR_ANY
&& sg->src.s_addr != ch->sg.src.s_addr)
- continue;
+ continue;
pim_show_join_helper(vty, pim_ifp, ch, json, now, uj);
} /* scan interface channels */
}
char msdp_reg_timer[10];
char state_str[PIM_REG_STATE_STR_LEN];
- if (sg->grp.s_addr != 0 && sg->grp.s_addr != up->sg.grp.s_addr)
+ if (sg->grp.s_addr != INADDR_ANY
+ && sg->grp.s_addr != up->sg.grp.s_addr)
continue;
- if (sg->src.s_addr != 0 && sg->src.s_addr != up->sg.src.s_addr)
+ if (sg->src.s_addr != INADDR_ANY
+ && sg->src.s_addr != up->sg.src.s_addr)
continue;
pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
ch->ifassert_my_metric = pim_macro_ch_my_assert_metric_eval(ch);
ch->ifassert_winner_metric = pim_macro_ch_my_assert_metric_eval(ch);
- ch->ifassert_winner.s_addr = 0;
+ ch->ifassert_winner.s_addr = INADDR_ANY;
/* Assert state */
ch->t_ifassert_timer = NULL;
struct in_addr nh_addr;
char nexthop_str[INET_ADDRSTRLEN];
- nh_addr.s_addr = 0;
+ nh_addr.s_addr = INADDR_ANY;
memset(&nexthop, 0, sizeof(nexthop));
up = pim_upstream_find(pim, &sg);
if (!up) {
- sg.src.s_addr = 0;
+ sg.src.s_addr = INADDR_ANY;
up = pim_upstream_find(pim, &sg);
}
rspp->rtg_proto = MTRACE_RTG_PROTO_PIM;
/* 6.2.2. 4. Fill in ... S, and Src Mask */
- if (sg.src.s_addr) {
+ if (sg.src.s_addr != INADDR_ANY) {
rspp->s = 1;
rspp->src_mask = MTRACE_SRC_MASK_SOURCE;
} else {
static void mtrace_rsp_init(struct igmp_mtrace_rsp *mtrace_rspp)
{
mtrace_rspp->arrival = 0;
- mtrace_rspp->incoming.s_addr = 0;
- mtrace_rspp->outgoing.s_addr = 0;
- mtrace_rspp->prev_hop.s_addr = 0;
+ mtrace_rspp->incoming.s_addr = INADDR_ANY;
+ mtrace_rspp->outgoing.s_addr = INADDR_ANY;
+ mtrace_rspp->prev_hop.s_addr = INADDR_ANY;
mtrace_rspp->in_count = htonl(MTRACE_UNKNOWN_COUNT);
mtrace_rspp->out_count = htonl(MTRACE_UNKNOWN_COUNT);
mtrace_rspp->total = htonl(MTRACE_UNKNOWN_COUNT);
/* 6.2.2. 2. Attempt to determine the forwarding information... */
- if (mtracep->grp_addr.s_addr)
+ if (mtracep->grp_addr.s_addr != INADDR_ANY)
fwd_info = mtrace_fwd_info(pim, mtracep, rspp, &out_ifp);
else
fwd_info = mtrace_fwd_info_weak(pim, mtracep, rspp, &out_ifp);
reached_source = false;
- if (nh_addr.s_addr == 0) {
+ if (nh_addr.s_addr == INADDR_ANY) {
/* no pim? i.e. 7.5.3. No Previous Hop */
if (!out_ifp->info) {
if (PIM_DEBUG_MTRACE)
struct prefix_sg *sg)
{
struct in_addr rp;
- rp.s_addr = 0;
+ rp.s_addr = INADDR_ANY;
pim_msdp_sa_ref(pim, NULL /* mp */, sg, rp);
}
if (type == RMAP_RIP) {
rinfo = object;
p.family = AF_INET;
- p.prefix = (rinfo->nh.gate.ipv4.s_addr) ? rinfo->nh.gate.ipv4
- : rinfo->from;
+ p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY)
+ ? rinfo->nh.gate.ipv4
+ : rinfo->from;
p.prefixlen = IPV4_MAX_BITLEN;
alist = access_list_lookup(AFI_IP, (char *)rule);
if (type == RMAP_RIP) {
rinfo = object;
p.family = AF_INET;
- p.prefix = (rinfo->nh.gate.ipv4.s_addr) ? rinfo->nh.gate.ipv4
- : rinfo->from;
+ p.prefix = (rinfo->nh.gate.ipv4.s_addr != INADDR_ANY)
+ ? rinfo->nh.gate.ipv4
+ : rinfo->from;
p.prefixlen = IPV4_MAX_BITLEN;
plist = prefix_list_lookup(AFI_IP, (char *)rule);
}
/* RIPv1 does not have nexthop value. */
- if (packet->version == RIPv1 && rte->nexthop.s_addr != 0) {
+ if (packet->version == RIPv1
+ && rte->nexthop.s_addr != INADDR_ANY) {
zlog_info("RIPv1 packet with nexthop value %s",
inet_ntoa(rte->nexthop));
rip_peer_bad_route(rip, from);
sub-optimal, but absolutely valid, route may be taken. If
the received Next Hop is not directly reachable, it should be
treated as 0.0.0.0. */
- if (packet->version == RIPv2 && rte->nexthop.s_addr != 0) {
+ if (packet->version == RIPv2
+ && rte->nexthop.s_addr != INADDR_ANY) {
uint32_t addrval;
/* Multicast address check. */
"Next hop %s is not directly reachable. Treat it as 0.0.0.0",
inet_ntoa(
rte->nexthop));
- rte->nexthop.s_addr = 0;
+ rte->nexthop.s_addr =
+ INADDR_ANY;
}
route_unlock_node(rn);
"Next hop %s is not directly reachable. Treat it as 0.0.0.0",
inet_ntoa(
rte->nexthop));
- rte->nexthop.s_addr = 0;
+ rte->nexthop.s_addr = INADDR_ANY;
}
}
}
(/16 for class B's) except when the RIP packet does to inside
the classful network in question. */
- if ((packet->version == RIPv1 && rte->prefix.s_addr != 0)
+ if ((packet->version == RIPv1
+ && rte->prefix.s_addr != INADDR_ANY)
|| (packet->version == RIPv2
- && (rte->prefix.s_addr != 0
- && rte->mask.s_addr == 0))) {
+ && (rte->prefix.s_addr != INADDR_ANY
+ && rte->mask.s_addr == INADDR_ANY))) {
uint32_t destination;
if (subnetted == -1) {
/* In case of RIPv2, if prefix in RTE is not netmask applied one
ignore the entry. */
- if ((packet->version == RIPv2) && (rte->mask.s_addr != 0)
+ if ((packet->version == RIPv2)
+ && (rte->mask.s_addr != INADDR_ANY)
&& ((rte->prefix.s_addr & rte->mask.s_addr)
!= rte->prefix.s_addr)) {
zlog_warn(
}
/* Default route's netmask is ignored. */
- if (packet->version == RIPv2 && (rte->prefix.s_addr == 0)
- && (rte->mask.s_addr != 0)) {
+ if (packet->version == RIPv2
+ && (rte->prefix.s_addr == INADDR_ANY)
+ && (rte->mask.s_addr != INADDR_ANY)) {
if (IS_RIP_DEBUG_EVENT)
zlog_debug(
"Default route with non-zero netmask. Set zero to netmask");
- rte->mask.s_addr = 0;
+ rte->mask.s_addr = INADDR_ANY;
}
/* Routing table updates. */
struct connected *c;
struct zebra_vrf *zvrf = vrf_info_get(vrf_id);
- p->u.prefix4.s_addr = 0;
+ p->u.prefix4.s_addr = INADDR_ANY;
p->family = AF_INET;
p->prefixlen = 32;
- if (zvrf->rid_user_assigned.u.prefix4.s_addr)
+ if (zvrf->rid_user_assigned.u.prefix4.s_addr != INADDR_ANY)
p->u.prefix4.s_addr = zvrf->rid_user_assigned.u.prefix4.s_addr;
else if (!list_isempty(zvrf->rid_lo_sorted_list)) {
node = listtail(zvrf->rid_lo_sorted_list);
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if ((zvrf = vrf->info) != NULL)
- if (zvrf->rid_user_assigned.u.prefix4.s_addr) {
+ if (zvrf->rid_user_assigned.u.prefix4.s_addr
+ != INADDR_ANY) {
if (zvrf_id(zvrf) == VRF_DEFAULT)
vty_out(vty, "router-id %s\n",
inet_ntoa(
addattr_l(nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4);
addattr32(nlmsg, req_size, RTA_OIF, nexthop->ifindex);
- if (nexthop->rmap_src.ipv4.s_addr && (cmd == RTM_NEWROUTE))
+ if (nexthop->rmap_src.ipv4.s_addr != INADDR_ANY
+ && (cmd == RTM_NEWROUTE))
addattr_l(nlmsg, req_size, RTA_PREFSRC,
&nexthop->rmap_src.ipv4, bytelen);
- else if (nexthop->src.ipv4.s_addr && (cmd == RTM_NEWROUTE))
+ else if (nexthop->src.ipv4.s_addr != INADDR_ANY
+ && (cmd == RTM_NEWROUTE))
addattr_l(nlmsg, req_size, RTA_PREFSRC,
&nexthop->src.ipv4, bytelen);
bytelen, nexthop);
if (cmd == RTM_NEWROUTE) {
- if (nexthop->rmap_src.ipv4.s_addr)
+ if (nexthop->rmap_src.ipv4.s_addr != INADDR_ANY)
addattr_l(nlmsg, req_size, RTA_PREFSRC,
&nexthop->rmap_src.ipv4, bytelen);
- else if (nexthop->src.ipv4.s_addr)
+ else if (nexthop->src.ipv4.s_addr != INADDR_ANY)
addattr_l(nlmsg, req_size, RTA_PREFSRC,
&nexthop->src.ipv4, bytelen);
}
if (nexthop->type == NEXTHOP_TYPE_IFINDEX) {
if (cmd == RTM_NEWROUTE) {
- if (nexthop->rmap_src.ipv4.s_addr)
+ if (nexthop->rmap_src.ipv4.s_addr != INADDR_ANY)
addattr_l(nlmsg, req_size, RTA_PREFSRC,
&nexthop->rmap_src.ipv4, bytelen);
- else if (nexthop->src.ipv4.s_addr)
+ else if (nexthop->src.ipv4.s_addr != INADDR_ANY)
addattr_l(nlmsg, req_size, RTA_PREFSRC,
&nexthop->src.ipv4, bytelen);
}
rtnh->rtnh_len += sizeof(struct rtattr) + bytelen;
rtnh->rtnh_ifindex = nexthop->ifindex;
- if (nexthop->rmap_src.ipv4.s_addr)
+ if (nexthop->rmap_src.ipv4.s_addr != INADDR_ANY)
*src = &nexthop->rmap_src;
- else if (nexthop->src.ipv4.s_addr)
+ else if (nexthop->src.ipv4.s_addr != INADDR_ANY)
*src = &nexthop->src;
if (IS_ZEBRA_DEBUG_KERNEL)
_netlink_route_rta_add_gateway_info(rtmsg->rtm_family, AF_INET,
rta, rtnh, NL_PKT_BUF_SIZE,
bytelen, nexthop);
- if (nexthop->rmap_src.ipv4.s_addr)
+ if (nexthop->rmap_src.ipv4.s_addr != INADDR_ANY)
*src = &nexthop->rmap_src;
- else if (nexthop->src.ipv4.s_addr)
+ else if (nexthop->src.ipv4.s_addr != INADDR_ANY)
*src = &nexthop->src;
if (IS_ZEBRA_DEBUG_KERNEL)
/* ifindex */
if (nexthop->type == NEXTHOP_TYPE_IFINDEX) {
- if (nexthop->rmap_src.ipv4.s_addr)
+ if (nexthop->rmap_src.ipv4.s_addr != INADDR_ANY)
*src = &nexthop->rmap_src;
- else if (nexthop->src.ipv4.s_addr)
+ else if (nexthop->src.ipv4.s_addr != INADDR_ANY)
*src = &nexthop->src;
if (IS_ZEBRA_DEBUG_KERNEL)
if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) {
nhi.gateway = &nexthop->gate;
- if (nexthop->src.ipv4.s_addr)
+ if (nexthop->src.ipv4.s_addr != INADDR_ANY)
src = &nexthop->src;
}
}
if (nexthop->type == NEXTHOP_TYPE_IFINDEX) {
- if (nexthop->src.ipv4.s_addr)
+ if (nexthop->src.ipv4.s_addr != INADDR_ANY)
src = &nexthop->src;
}
if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) {
gateway = &nexthop->gate;
- if (nexthop->src.ipv4.s_addr)
+ if (nexthop->src.ipv4.s_addr != INADDR_ANY)
src = &nexthop->src;
}
}
if (nexthop->type == NEXTHOP_TYPE_IFINDEX) {
- if (nexthop->src.ipv4.s_addr)
+ if (nexthop->src.ipv4.s_addr != INADDR_ANY)
src = &nexthop->src;
}
vtep_ip = n->r_vtep_ip;
/* Mark appropriately */
UNSET_FLAG(n->flags, ZEBRA_NEIGH_REMOTE);
- n->r_vtep_ip.s_addr = 0;
+ n->r_vtep_ip.s_addr = INADDR_ANY;
SET_FLAG(n->flags, ZEBRA_NEIGH_LOCAL);
n->ifindex = ifp->ifindex;
}
* 2. the XG entry is used by pimd to setup the
* vxlan-termination-mroute
*/
- if (sg->src.s_addr) {
+ if (sg->src.s_addr != INADDR_ANY) {
memset(&sip, 0, sizeof(sip));
parent = zebra_vxlan_sg_do_ref(zvrf, sip, sg->grp);
if (!parent)
/* On SG entry deletion remove the reference to its parent XG
* entry
*/
- if (vxlan_sg->sg.src.s_addr) {
+ if (vxlan_sg->sg.src.s_addr != INADDR_ANY) {
memset(&sip, 0, sizeof(sip));
zebra_vxlan_sg_do_deref(zvrf, sip, vxlan_sg->sg.grp);
}
{
struct zebra_vrf *zvrf;
- if (!local_vtep_ip.s_addr || !mcast_grp.s_addr)
+ if (local_vtep_ip.s_addr == INADDR_ANY
+ || mcast_grp.s_addr == INADDR_ANY)
return;
zvrf = vrf_info_lookup(VRF_DEFAULT);
{
struct zebra_vrf *zvrf;
- if (!local_vtep_ip.s_addr || !mcast_grp.s_addr)
+ if (local_vtep_ip.s_addr == INADDR_ANY
+ || mcast_grp.s_addr == INADDR_ANY)
return;
zvrf = vrf_info_lookup(VRF_DEFAULT);