summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-02-06 07:49:02 +0100
committerDonatas Abraitis <donatas.abraitis@gmail.com>2020-02-06 08:00:12 +0100
commit975a328e2eb3d1bea5fbc3c232580dd4739d59f0 (patch)
tree587e51ff3bbf8dc368ecd1c414615d19ff5139ae /ospfd
parentMerge pull request #5761 from qlyoung/fix-bgp-gr-cruft (diff)
downloadfrr-975a328e2eb3d1bea5fbc3c232580dd4739d59f0.tar.xz
frr-975a328e2eb3d1bea5fbc3c232580dd4739d59f0.zip
*: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_abr.c2
-rw-r--r--ospfd/ospf_ase.c8
-rw-r--r--ospfd/ospf_interface.c8
-rw-r--r--ospfd/ospf_ism.c4
-rw-r--r--ospfd/ospf_lsa.c15
-rw-r--r--ospfd/ospf_packet.c23
-rw-r--r--ospfd/ospf_route.c4
-rw-r--r--ospfd/ospf_vty.c12
-rw-r--r--ospfd/ospf_zebra.c6
-rw-r--r--ospfd/ospfd.c11
10 files changed, 49 insertions, 44 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index c8b8b611e..b4690cfa4 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -310,7 +310,7 @@ int ospf_area_range_substitute_unset(struct ospf *ospf, struct in_addr area_id,
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;
diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c
index 44244f651..2c80d485a 100644
--- a/ospfd/ospf_ase.c
+++ b/ospfd/ospf_ase.c
@@ -370,7 +370,7 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
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.
@@ -470,7 +470,7 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
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 {
@@ -512,7 +512,7 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
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;
@@ -530,7 +530,7 @@ int ospf_ase_calculate_route(struct ospf *ospf, struct ospf_lsa *lsa)
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);
}
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 3eb03f53c..f2efaf322 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -862,7 +862,7 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
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;
@@ -885,7 +885,7 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
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;
@@ -907,7 +907,7 @@ static void ospf_vl_if_delete(struct ospf_vl_data *vl_data)
{
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);
@@ -971,7 +971,7 @@ static void ospf_vl_shutdown(struct ospf_vl_data *vl_data)
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);
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index e394b6f47..f4e89da45 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -169,7 +169,7 @@ static void ospf_dr_eligible_routers(struct route_table *nbrs,
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? */
@@ -186,7 +186,7 @@ static void ospf_dr_change(struct ospf *ospf, struct route_table *nbrs)
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. */
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 6eec87c93..35bbe06cd 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -820,7 +820,7 @@ static struct ospf_lsa *ospf_router_lsa_originate(struct ospf_area *area)
}
/* 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);
@@ -1459,7 +1459,7 @@ struct in_addr ospf_get_ip_from_ifp(struct ospf_interface *oi)
{
struct in_addr fwd;
- fwd.s_addr = 0;
+ fwd.s_addr = INADDR_ANY;
if (if_is_operative(oi->ifp))
return oi->address->u.prefix4;
@@ -1931,7 +1931,7 @@ int is_prefix_default(struct prefix_ipv4 *p)
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);
@@ -1979,10 +1979,11 @@ struct ospf_lsa *ospf_external_lsa_originate(struct ospf *ospf,
*/
- 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;
}
@@ -2197,7 +2198,7 @@ void ospf_external_lsa_refresh_default(struct ospf *ospf)
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);
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 95fb69492..1b47fde21 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -1074,7 +1074,8 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
/* 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. */
@@ -3352,7 +3353,7 @@ static int ospf_make_hello(struct ospf_interface *oi, struct stream *s)
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
@@ -3364,17 +3365,17 @@ static int ospf_make_hello(struct ospf_interface *oi, struct stream *s)
/* 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. */
diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c
index 6cabc0c98..b6e8338ee 100644
--- a/ospfd/ospf_route.c
+++ b/ospfd/ospf_route.c
@@ -603,7 +603,7 @@ void ospf_intra_add_stub(struct route_table *rt, struct router_lsa_link *link,
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))
@@ -962,7 +962,7 @@ int ospf_add_discard_route(struct ospf *ospf, struct route_table *rt,
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;
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 1542ef88f..fb4082e50 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -3551,7 +3551,7 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
}
/* 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");
@@ -4199,7 +4199,7 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty,
}
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
@@ -4258,7 +4258,7 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty,
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
@@ -4908,7 +4908,8 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty,
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),
@@ -4926,7 +4927,8 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty,
} 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,",
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 68d9d3bf8..64013435f 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -585,9 +585,9 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
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;
@@ -854,7 +854,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
/* 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);
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 6a4e63372..2a3f1329a 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -329,7 +329,7 @@ struct ospf *ospf_lookup_instance(unsigned short instance)
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;
@@ -379,7 +379,7 @@ struct ospf *ospf_get(unsigned short instance, const char *name, bool *created)
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);
@@ -398,7 +398,7 @@ struct ospf *ospf_get_instance(unsigned short instance, bool *created)
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);
@@ -938,7 +938,8 @@ static void add_ospf_interface(struct connected *co, struct ospf_area *area)
* 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);
}
@@ -1267,7 +1268,7 @@ static void ospf_network_run(struct prefix *p, struct ospf_area *area)
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. */