summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_abr.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-10-21 19:56:26 +0200
committerMark Stapp <mjs@voltanet.io>2020-10-22 19:37:25 +0200
commit96b663a381c2e90fa663d69fce4e40f0be698e58 (patch)
tree061e8297387581dcb5e730f405bf9a5596a58dc1 /ospfd/ospf_abr.c
parentMerge pull request #7343 from ton31337/fix/prefix2str_to_pFX (diff)
downloadfrr-96b663a381c2e90fa663d69fce4e40f0be698e58.tar.xz
frr-96b663a381c2e90fa663d69fce4e40f0be698e58.zip
ospfd: replace inet_ntoa
Stop using inet_ntoa, use %pI4 etc or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'ospfd/ospf_abr.c')
-rw-r--r--ospfd/ospf_abr.c149
1 files changed, 75 insertions, 74 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c
index 28afee31a..634418ec5 100644
--- a/ospfd/ospf_abr.c
+++ b/ospfd/ospf_abr.c
@@ -331,6 +331,7 @@ static int ospf_abr_nssa_am_elected(struct ospf_area *area)
struct ospf_lsa *lsa;
struct router_lsa *rlsa;
struct in_addr *best = NULL;
+ char buf[PREFIX_STRLEN];
LSDB_LOOP (ROUTER_LSDB(area), rn, lsa) {
/* sanity checks */
@@ -348,8 +349,8 @@ static int ospf_abr_nssa_am_elected(struct ospf_area *area)
if (IS_ROUTER_LSA_NT(rlsa)) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_nssa_am_elected: router %s asserts Nt",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_nssa_am_elected: router %pI4 asserts Nt",
+ &lsa->data->id);
return 0;
}
@@ -363,7 +364,8 @@ static int ospf_abr_nssa_am_elected(struct ospf_area *area)
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
"ospf_abr_nssa_am_elected: best electable ABR is: %s",
- (best) ? inet_ntoa(*best) : "<none>");
+ (best) ? inet_ntop(AF_INET, best, buf, sizeof(buf)) :
+ "<none>");
if (best == NULL)
return 1;
@@ -390,8 +392,8 @@ static void ospf_abr_nssa_check_status(struct ospf *ospf)
if (IS_DEBUG_OSPF(nssa, NSSA))
zlog_debug(
- "ospf_abr_nssa_check_status: checking area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_nssa_check_status: checking area %pI4",
+ &area->area_id);
if (!IS_OSPF_ABR(area->ospf)) {
if (IS_DEBUG_OSPF(nssa, NSSA))
@@ -615,15 +617,15 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
if (!CHECK_FLAG(lsa->data->options, OSPF_OPTION_NP)) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_translate_nssa(): LSA Id %s, P-bit off, NO Translation",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_translate_nssa(): LSA Id %pI4, P-bit off, NO Translation",
+ &lsa->data->id);
return 1;
}
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_translate_nssa(): LSA Id %s, TRANSLATING 7 to 5",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_translate_nssa(): LSA Id %pI4, TRANSLATING 7 to 5",
+ &lsa->data->id);
ext7 = (struct as_external_lsa *)(lsa->data);
p.prefix = lsa->data->id;
@@ -632,8 +634,8 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
if (ext7->e[0].fwd_addr.s_addr == OSPF_DEFAULT_DESTINATION) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_translate_nssa(): LSA Id %s, Forward address is 0, NO Translation",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_translate_nssa(): LSA Id %pI4, Forward address is 0, NO Translation",
+ &lsa->data->id);
return 1;
}
@@ -646,8 +648,8 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
UNSET_FLAG(old->flags, OSPF_LSA_APPROVED);
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_translate_nssa(): remove old translated LSA id %s",
- inet_ntoa(old->data->id));
+ "ospf_abr_translate_nssa(): remove old translated LSA id %pI4",
+ &old->data->id);
}
/* if type-7 is removed and type-5 does not exist, do not
* originate */
@@ -657,16 +659,16 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
if (old && CHECK_FLAG(old->flags, OSPF_LSA_APPROVED)) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_translate_nssa(): found old translated LSA Id %s, refreshing",
- inet_ntoa(old->data->id));
+ "ospf_abr_translate_nssa(): found old translated LSA Id %pI4, refreshing",
+ &old->data->id);
/* refresh */
new = ospf_translated_nssa_refresh(area->ospf, lsa, old);
if (!new) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_translate_nssa(): could not refresh translated LSA Id %s",
- inet_ntoa(old->data->id));
+ "ospf_abr_translate_nssa(): could not refresh translated LSA Id %pI4",
+ &old->data->id);
}
} else {
/* no existing external route for this LSA Id
@@ -676,8 +678,8 @@ static int ospf_abr_translate_nssa(struct ospf_area *area, struct ospf_lsa *lsa)
if (ospf_translated_nssa_originate(area->ospf, lsa) == NULL) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_translate_nssa(): Could not translate Type-7 for %s to Type-5",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_translate_nssa(): Could not translate Type-7 for %pI4 to Type-5",
+ &lsa->data->id);
return 1;
}
}
@@ -741,9 +743,9 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
if (!lsa) {
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not refresh %pFX to %s",
+ "%s: Could not refresh %pFX to %pI4",
__func__, (struct prefix *)p,
- inet_ntoa(area->area_id));
+ &area->area_id);
return;
}
@@ -759,9 +761,9 @@ void ospf_abr_announce_network_to_area(struct prefix_ipv4 *p, uint32_t cost,
if (!lsa) {
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not originate %pFX to %s",
+ "%s: Could not originate %pFX to %pi4",
__func__, (struct prefix *)p,
- inet_ntoa(area->area_id));
+ &area->area_id);
return;
}
@@ -854,8 +856,8 @@ static void ospf_abr_announce_network(struct ospf *ospf, struct prefix_ipv4 *p,
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_network(): looking at area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_announce_network(): looking at area %pI4",
+ &area->area_id);
if (IPV4_ADDR_SAME(& or->u.std.area_id, &area->area_id))
continue;
@@ -883,8 +885,8 @@ static void ospf_abr_announce_network(struct ospf *ospf, struct prefix_ipv4 *p,
&& area->no_summary) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_network(): area %s is stub and no_summary",
- inet_ntoa(area->area_id));
+ "ospf_abr_announce_network(): area %pI4 is stub and no_summary",
+ &area->area_id);
continue;
}
@@ -962,8 +964,8 @@ static void ospf_abr_process_nssa_translates(struct ospf *ospf)
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_process_nssa_translates(): looking at area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_process_nssa_translates(): looking at area %pI4",
+ &area->area_id);
LSDB_LOOP (NSSA_LSDB(area), rn, lsa)
ospf_abr_translate_nssa(area, lsa);
@@ -991,15 +993,15 @@ static void ospf_abr_process_network_rt(struct ospf *ospf,
or->u.std.area_id))) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_process_network_rt(): area %s no longer exists",
- inet_ntoa(or->u.std.area_id));
+ "ospf_abr_process_network_rt(): area %pI4 no longer exists",
+ &or->u.std.area_id);
continue;
}
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_process_network_rt(): this is a route to %s/%d",
- inet_ntoa(rn->p.u.prefix4), rn->p.prefixlen);
+ "ospf_abr_process_network_rt(): this is a route to %pFX",
+ &rn->p);
if (or->path_type >= OSPF_PATH_TYPE1_EXTERNAL) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
@@ -1113,9 +1115,9 @@ static void ospf_abr_announce_rtr_to_area(struct prefix_ipv4 *p, uint32_t cost,
lsa = ospf_summary_asbr_lsa_originate(p, cost, area);
if (!lsa) {
flog_warn(EC_OSPF_LSA_MISSING,
- "%s: Could not refresh/originate %pFX to %s",
+ "%s: Could not refresh/originate %pFX to %pI4",
__func__, (struct prefix *)p,
- inet_ntoa(area->area_id));
+ &area->area_id);
return;
}
@@ -1149,8 +1151,8 @@ static void ospf_abr_announce_rtr(struct ospf *ospf, struct prefix_ipv4 *p,
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_rtr(): looking at area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_announce_rtr(): looking at area %pI4",
+ &area->area_id);
if (IPV4_ADDR_SAME(& or->u.std.area_id, &area->area_id))
continue;
@@ -1162,24 +1164,24 @@ static void ospf_abr_announce_rtr(struct ospf *ospf, struct prefix_ipv4 *p,
if (or->u.std.external_routing == OSPF_AREA_NSSA) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_rtr(): do not generate LSA Type-4 %s from NSSA",
- inet_ntoa(p->prefix));
+ "ospf_abr_announce_rtr(): do not generate LSA Type-4 %pI4 from NSSA",
+ &p->prefix);
continue;
}
if (area->external_routing != OSPF_AREA_DEFAULT) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_rtr(): area %s doesn't support external routing",
- inet_ntoa(area->area_id));
+ "ospf_abr_announce_rtr(): area %pI4 doesn't support external routing",
+ &area->area_id);
continue;
}
if (or->path_type == OSPF_PATH_INTER_AREA) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_rtr(): this is inter-area route to %s",
- inet_ntoa(p->prefix));
+ "ospf_abr_announce_rtr(): this is inter-area route to %pI4",
+ &p->prefix);
if (!OSPF_IS_AREA_BACKBONE(area))
ospf_abr_announce_rtr_to_area(p, or->cost,
area);
@@ -1188,8 +1190,8 @@ static void ospf_abr_announce_rtr(struct ospf *ospf, struct prefix_ipv4 *p,
if (or->path_type == OSPF_PATH_INTRA_AREA) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_rtr(): this is intra-area route to %s",
- inet_ntoa(p->prefix));
+ "ospf_abr_announce_rtr(): this is intra-area route to %pI4",
+ &p->prefix);
ospf_abr_announce_rtr_to_area(p, or->cost, area);
}
}
@@ -1220,16 +1222,16 @@ static void ospf_abr_process_router_rt(struct ospf *ospf,
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_process_router_rt(): this is a route to %s",
- inet_ntoa(rn->p.u.prefix4));
+ "ospf_abr_process_router_rt(): this is a route to %pI4",
+ &rn->p.u.prefix4);
for (ALL_LIST_ELEMENTS(l, node, nnode, or)) {
if (!ospf_area_lookup_by_area_id(ospf,
or->u.std.area_id)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_process_router_rt(): area %s no longer exists",
- inet_ntoa(or->u.std.area_id));
+ "ospf_abr_process_router_rt(): area %pI4 no longer exists",
+ &or->u.std.area_id);
continue;
}
@@ -1310,8 +1312,8 @@ ospf_abr_unapprove_translates(struct ospf *ospf) /* For NSSA Translations */
UNSET_FLAG(lsa->flags, OSPF_LSA_APPROVED);
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_unapprove_translates(): approved unset on link id %s",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_unapprove_translates(): approved unset on link id %pI4",
+ &lsa->data->id);
}
if (IS_DEBUG_OSPF_NSSA)
@@ -1331,14 +1333,14 @@ static void ospf_abr_unapprove_summaries(struct ospf *ospf)
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_unapprove_summaries(): considering area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_unapprove_summaries(): considering area %pI4",
+ &area->area_id);
LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa)
if (ospf_lsa_is_self_originated(ospf, lsa)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_unapprove_summaries(): approved unset on summary link id %s",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_unapprove_summaries(): approved unset on summary link id %pI4",
+ &lsa->data->id);
UNSET_FLAG(lsa->flags, OSPF_LSA_APPROVED);
}
@@ -1346,8 +1348,8 @@ static void ospf_abr_unapprove_summaries(struct ospf *ospf)
if (ospf_lsa_is_self_originated(ospf, lsa)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_unapprove_summaries(): approved unset on asbr-summary link id %s",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_unapprove_summaries(): approved unset on asbr-summary link id %pI4",
+ &lsa->data->id);
UNSET_FLAG(lsa->flags, OSPF_LSA_APPROVED);
}
}
@@ -1392,8 +1394,8 @@ static void ospf_abr_announce_aggregates(struct ospf *ospf)
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_aggregates(): looking at area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_announce_aggregates(): looking at area %pI4",
+ &area->area_id);
for (rn = route_top(area->ranges); rn; rn = route_next(rn))
if ((range = rn->info)) {
@@ -1411,9 +1413,8 @@ static void ospf_abr_announce_aggregates(struct ospf *ospf)
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_aggregates(): this is range: %s/%d",
- inet_ntoa(p.u.prefix4),
- p.prefixlen);
+ "ospf_abr_announce_aggregates(): this is range: %pFX",
+ &p);
if (CHECK_FLAG(range->flags,
OSPF_AREA_RANGE_SUBSTITUTE)) {
@@ -1482,8 +1483,8 @@ ospf_abr_send_nssa_aggregates(struct ospf *ospf) /* temporarily turned off */
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_send_nssa_aggregates(): looking at area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_send_nssa_aggregates(): looking at area %pI4",
+ &area->area_id);
for (rn = route_top(area->ranges); rn; rn = route_next(rn)) {
if (rn->info == NULL)
@@ -1505,8 +1506,8 @@ ospf_abr_send_nssa_aggregates(struct ospf *ospf) /* temporarily turned off */
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_abr_send_nssa_aggregates(): this is range: %s/%d",
- inet_ntoa(p.prefix), p.prefixlen);
+ "ospf_abr_send_nssa_aggregates(): this is range: %pFX",
+ &p);
if (CHECK_FLAG(range->flags,
OSPF_AREA_RANGE_SUBSTITUTE)) {
@@ -1553,8 +1554,8 @@ static void ospf_abr_announce_stub_defaults(struct ospf *ospf)
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_stub_defaults(): looking at area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_announce_stub_defaults(): looking at area %pI4",
+ &area->area_id);
if ((area->external_routing != OSPF_AREA_STUB)
&& (area->external_routing != OSPF_AREA_NSSA))
@@ -1565,8 +1566,8 @@ static void ospf_abr_announce_stub_defaults(struct ospf *ospf)
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_announce_stub_defaults(): announcing 0.0.0.0/0 to area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_announce_stub_defaults(): announcing 0.0.0.0/0 to area %pI4",
+ &area->area_id);
ospf_abr_announce_network_to_area(&p, area->default_cost, area);
}
@@ -1580,8 +1581,8 @@ static int ospf_abr_remove_unapproved_translates_apply(struct ospf *ospf,
if (CHECK_FLAG(lsa->flags, OSPF_LSA_LOCAL_XLT)
&& !CHECK_FLAG(lsa->flags, OSPF_LSA_APPROVED)) {
zlog_info(
- "ospf_abr_remove_unapproved_translates(): removing unapproved translates, ID: %s",
- inet_ntoa(lsa->data->id));
+ "ospf_abr_remove_unapproved_translates(): removing unapproved translates, ID: %pI4",
+ &lsa->data->id);
/* FLUSH THROUGHOUT AS */
ospf_lsa_flush_as(ospf, lsa);
@@ -1621,8 +1622,8 @@ static void ospf_abr_remove_unapproved_summaries(struct ospf *ospf)
for (ALL_LIST_ELEMENTS_RO(ospf->areas, node, area)) {
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "ospf_abr_remove_unapproved_summaries(): looking at area %s",
- inet_ntoa(area->area_id));
+ "ospf_abr_remove_unapproved_summaries(): looking at area %pI4",
+ &area->area_id);
LSDB_LOOP (SUMMARY_LSDB(area), rn, lsa)
if (ospf_lsa_is_self_originated(ospf, lsa))