summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2020-12-14 20:01:31 +0100
committerDonatas Abraitis <donatas.abraitis@gmail.com>2020-12-14 20:03:38 +0100
commit3a6290bdd1003f53ad73aaaa2f6bc4b08e262352 (patch)
tree140586732e3a6a1b6d24ce775cebfb6d77b165d0 /ospfd
parentMerge pull request #7726 from chiragshah6/mdev (diff)
downloadfrr-3a6290bdd1003f53ad73aaaa2f6bc4b08e262352.tar.xz
frr-3a6290bdd1003f53ad73aaaa2f6bc4b08e262352.zip
*: Replace s_addr check agains 0 with INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_ase.c4
-rw-r--r--ospfd/ospf_lsa.c10
-rw-r--r--ospfd/ospf_route.c2
-rw-r--r--ospfd/ospf_snmp.c11
-rw-r--r--ospfd/ospf_spf.c2
-rw-r--r--ospfd/ospf_vty.c10
-rw-r--r--ospfd/ospfd.c4
7 files changed, 24 insertions, 19 deletions
diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c
index 3606efc76..e99653f91 100644
--- a/ospfd/ospf_ase.c
+++ b/ospfd/ospf_ase.c
@@ -136,7 +136,7 @@ static void ospf_ase_complete_direct_routes(struct ospf_route *ro,
struct ospf_path *op;
for (ALL_LIST_ELEMENTS_RO(ro->paths, node, op))
- if (op->nexthop.s_addr == 0)
+ if (op->nexthop.s_addr == INADDR_ANY)
op->nexthop.s_addr = nexthop.s_addr;
}
@@ -191,7 +191,7 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf,
return NULL;
}
- if (al->e[0].fwd_addr.s_addr != 0)
+ if (al->e[0].fwd_addr.s_addr != INADDR_ANY)
{
if (IS_DEBUG_OSPF (lsa, LSA))
zlog_debug ("ospf_ase_calculate(): Forwarding address is not 0.0.0.0.");
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 42fc3288c..3680229e5 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -1480,17 +1480,17 @@ struct in_addr ospf_get_nssa_ip(struct ospf_area *area)
if (oi->area->external_routing == OSPF_AREA_NSSA)
if (oi->address
&& oi->address->family == AF_INET) {
- if (best_default.s_addr == 0)
+ if (best_default.s_addr == INADDR_ANY)
best_default =
oi->address->u.prefix4;
if (oi->area == area)
return oi->address->u.prefix4;
}
}
- if (best_default.s_addr != 0)
+ if (best_default.s_addr != INADDR_ANY)
return best_default;
- if (best_default.s_addr != 0)
+ if (best_default.s_addr != INADDR_ANY)
return best_default;
return fwd;
@@ -1708,11 +1708,11 @@ static void ospf_install_flood_nssa(struct ospf *ospf, struct ospf_lsa *lsa,
/* kevinm: not updating lsa anymore, just new */
extlsa = (struct as_external_lsa *)(new->data);
- if (extlsa->e[0].fwd_addr.s_addr == 0)
+ if (extlsa->e[0].fwd_addr.s_addr == INADDR_ANY)
extlsa->e[0].fwd_addr = ospf_get_nssa_ip(
area); /* this NSSA area in ifp */
- if (extlsa->e[0].fwd_addr.s_addr == 0) {
+ if (extlsa->e[0].fwd_addr.s_addr == INADDR_ANY) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
"LSA[Type-7]: Could not build FWD-ADDR");
diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c
index bcf563a5b..590122e22 100644
--- a/ospfd/ospf_route.c
+++ b/ospfd/ospf_route.c
@@ -681,7 +681,7 @@ void ospf_route_table_print(struct vty *vty, struct route_table *rt)
or->cost);
for (ALL_LIST_ELEMENTS_RO(or->paths, pnode,
path))
- if (path->nexthop.s_addr != 0)
+ if (path->nexthop.s_addr != INADDR_ANY)
vty_out(vty, " -> %pI4\n",
&path->nexthop);
else
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index 033046da0..66dd9c7ca 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -1405,7 +1405,8 @@ static int ospf_snmp_if_update(struct interface *ifp)
} else {
/* Unnumbered interfaces --> Sort them based on
* interface indexes */
- if (osif->addr.s_addr != 0 || osif->ifindex > ifindex)
+ if (osif->addr.s_addr != INADDR_ANY
+ || osif->ifindex > ifindex)
break;
}
pn = node;
@@ -2003,11 +2004,12 @@ static struct ospf_neighbor *ospf_snmp_nbr_lookup(struct ospf *ospf,
for (ALL_LIST_ELEMENTS(ospf->oiflist, node, nnode, oi)) {
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn))
- if ((nbr = rn->info) != NULL && nbr != oi->nbr_self
+ if ((nbr = rn->info) != NULL
+ && nbr != oi->nbr_self
/* If EXACT match is needed, provide ALL entry found
&& nbr->state != NSM_Down
*/
- && nbr->src.s_addr != 0) {
+ && nbr->src.s_addr != INADDR_ANY) {
if (IPV4_ADDR_SAME(&nbr->src, nbr_addr)) {
route_unlock_node(rn);
return nbr;
@@ -2033,7 +2035,8 @@ static struct ospf_neighbor *ospf_snmp_nbr_lookup_next(struct in_addr *nbr_addr,
for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, nn, oi)) {
for (rn = route_top(oi->nbrs); rn; rn = route_next(rn))
if ((nbr = rn->info) != NULL && nbr != oi->nbr_self
- && nbr->state != NSM_Down && nbr->src.s_addr != 0) {
+ && nbr->state != NSM_Down
+ && nbr->src.s_addr != INADDR_ANY) {
if (first) {
if (!min)
min = nbr;
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index ad9e6f547..4665f53ed 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -1238,7 +1238,7 @@ ospf_rtrs_print (struct route_table *rtrs)
for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path))
{
- if (path->nexthop.s_addr == 0)
+ if (path->nexthop.s_addr == INADDR_ANY)
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug (" directly attached to %s\r",
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 91a29f7d6..aaa64e80c 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -10450,7 +10450,8 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf,
if (if_lookup_by_index(path->ifindex,
ospf->vrf_id)) {
- if (path->nexthop.s_addr == 0) {
+ if (path->nexthop.s_addr
+ == INADDR_ANY) {
if (json) {
json_object_string_add(
json_nexthop,
@@ -10595,7 +10596,8 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf,
}
if (if_lookup_by_index(path->ifindex,
ospf->vrf_id)) {
- if (path->nexthop.s_addr == 0) {
+ if (path->nexthop.s_addr
+ == INADDR_ANY) {
if (json) {
json_object_string_add(
json_nexthop,
@@ -10723,7 +10725,7 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf,
}
if (if_lookup_by_index(path->ifindex, ospf->vrf_id)) {
- if (path->nexthop.s_addr == 0) {
+ if (path->nexthop.s_addr == INADDR_ANY) {
if (json) {
json_object_string_add(
json_nexthop, "ip",
@@ -12092,7 +12094,7 @@ static int ospf_config_write_one(struct vty *vty, struct ospf *ospf)
}
/* Router ID print. */
- if (ospf->router_id_static.s_addr != 0)
+ if (ospf->router_id_static.s_addr != INADDR_ANY)
vty_out(vty, " ospf router-id %pI4\n",
&ospf->router_id_static);
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 6fe94f3a4..0adf8a7b4 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -115,9 +115,9 @@ void ospf_router_id_update(struct ospf *ospf)
disruptive.
3. Last choice: just go with whatever the zebra daemon recommends.
*/
- if (ospf->router_id_static.s_addr != 0)
+ if (ospf->router_id_static.s_addr != INADDR_ANY)
router_id = ospf->router_id_static;
- else if (ospf->router_id.s_addr != 0)
+ else if (ospf->router_id.s_addr != INADDR_ANY)
router_id = ospf->router_id;
else
router_id = ospf->router_id_zebra;