diff options
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_abr.c | 101 | ||||
| -rw-r--r-- | ospf6d/ospf6_area.c | 5 | ||||
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 100 | ||||
| -rw-r--r-- | ospf6d/ospf6_bfd.c | 9 | ||||
| -rw-r--r-- | ospf6d/ospf6_interface.c | 13 | ||||
| -rw-r--r-- | ospf6d/ospf6_intra.c | 29 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsa.h | 20 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsdb.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6_route.c | 8 | ||||
| -rw-r--r-- | ospf6d/ospf6_spf.c | 9 | ||||
| -rw-r--r-- | ospf6d/ospf6_top.c | 10 | ||||
| -rw-r--r-- | ospf6d/ospf6_zebra.c | 21 |
12 files changed, 116 insertions, 215 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 6fe3a289ce..cbb80b668d 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -153,7 +153,6 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, struct ospf6_inter_router_lsa *router_lsa; struct ospf6_route_table *summary_table = NULL; uint16_t type; - char buf[PREFIX2STR_BUFFER]; int is_debug = 0; /* Only destination type network, range or ASBR are considered */ @@ -196,12 +195,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (route->type == OSPF6_DEST_TYPE_ROUTER) { if (ADV_ROUTER_IN_PREFIX(&route->prefix) == area->ospf6->router_id) { - inet_ntop(AF_INET, - &(ADV_ROUTER_IN_PREFIX(&route->prefix)), buf, - sizeof(buf)); zlog_debug( - "%s: Skipping ASBR announcement for ABR (%s)", - __func__, buf); + "%s: Skipping ASBR announcement for ABR (%pFX)", + __func__, + &ADV_ROUTER_IN_PREFIX(&route->prefix)); return 0; } } @@ -210,11 +207,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (IS_OSPF6_DEBUG_ABR || IS_OSPF6_DEBUG_ORIGINATE(INTER_ROUTER)) { is_debug++; - inet_ntop(AF_INET, - &(ADV_ROUTER_IN_PREFIX(&route->prefix)), buf, - sizeof(buf)); - zlog_debug("Originating summary in area %s for ASBR %s", - area->name, buf); + zlog_debug( + "Originating summary in area %s for ASBR %pFX", + area->name, + &ADV_ROUTER_IN_PREFIX(&route->prefix)); } summary_table = area->summary_router; } else { @@ -226,16 +222,13 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, route->path.origin.type == htons(OSPF6_LSTYPE_INTER_PREFIX)) { if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) { - if (is_debug) { - inet_ntop(AF_INET, - &(ADV_ROUTER_IN_PREFIX( - &route->prefix)), buf, - sizeof(buf)); + if (is_debug) zlog_debug( - "%s: route %s with cost %u is not best, ignore.", - __func__, buf, + "%s: route %pFX with cost %u is not best, ignore.", + __func__, + &ADV_ROUTER_IN_PREFIX( + &route->prefix), route->path.cost); - } return 0; } } @@ -243,23 +236,19 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (route->path.origin.type == htons(OSPF6_LSTYPE_INTRA_PREFIX)) { if (!CHECK_FLAG(route->flag, OSPF6_ROUTE_BEST)) { - if (is_debug) { - prefix2str(&route->prefix, buf, - sizeof(buf)); + if (is_debug) zlog_debug( - "%s: intra-prefix route %s with cost %u is not best, ignore.", - __func__, buf, + "%s: intra-prefix route %pFX with cost %u is not best, ignore.", + __func__, &route->prefix, route->path.cost); - } return 0; } } - if (is_debug) { - prefix2str(&route->prefix, buf, sizeof(buf)); - zlog_debug("Originating summary in area %s for %s cost %u", - area->name, buf, route->path.cost); - } + if (is_debug) + zlog_debug( + "Originating summary in area %s for %pFX cost %u", + area->name, &route->prefix, route->path.cost); summary_table = area->summary_prefix; } @@ -369,11 +358,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (range && !CHECK_FLAG(range->flag, OSPF6_ROUTE_REMOVE) && (route->path.area_id != OSPF_AREA_BACKBONE || !IS_AREA_TRANSIT(area))) { - if (is_debug) { - prefix2str(&range->prefix, buf, sizeof(buf)); - zlog_debug("Suppressed by range %s of area %s", - buf, route_area->name); - } + if (is_debug) + zlog_debug( + "Suppressed by range %pFX of area %s", + &range->prefix, route_area->name); ospf6_abr_delete_route(route, summary, summary_table, old); return 0; @@ -411,15 +399,11 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (EXPORT_LIST(area)) if (access_list_apply(EXPORT_LIST(area), &route->prefix) == FILTER_DENY) { - if (is_debug) { - inet_ntop(AF_INET, - &(ADV_ROUTER_IN_PREFIX( - &route->prefix)), - buf, sizeof(buf)); + if (is_debug) zlog_debug( - "prefix %s was denied by export list", - buf); - } + "prefix %pFX was denied by export list", + &ADV_ROUTER_IN_PREFIX( + &route->prefix)); return 0; } } @@ -428,15 +412,10 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (PREFIX_LIST_OUT(area)) if (prefix_list_apply(PREFIX_LIST_OUT(area), &route->prefix) != PREFIX_PERMIT) { - if (is_debug) { - inet_ntop( - AF_INET, - &(ADV_ROUTER_IN_PREFIX(&route->prefix)), - buf, sizeof(buf)); + if (is_debug) zlog_debug( - "prefix %s was denied by filter-list out", - buf); - } + "prefix %pFX was denied by filter-list out", + &ADV_ROUTER_IN_PREFIX(&route->prefix)); return 0; } @@ -798,7 +777,6 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, struct ospf6_path *o_path; struct ospf6_nexthop *nh, *rnh; bool nh_updated = false; - char buf[PREFIX2STR_BUFFER]; for (ALL_LIST_ELEMENTS(old->paths, anode, anext, o_path)) { if (o_path->origin.adv_router != lsa->header->adv_router @@ -820,16 +798,13 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, if (nh_updated) { if (listcount(old->paths)) { - if (IS_OSPF6_DEBUG_ABR || - IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX)) { - prefix2str(&old->prefix, buf, - sizeof(buf)); - zlog_debug("%s: old %s updated nh %u", - __func__, buf, + if (IS_OSPF6_DEBUG_ABR + || IS_OSPF6_DEBUG_EXAMIN(INTER_PREFIX)) + zlog_debug("%s: old %pFX updated nh %u", + __func__, &old->prefix, old->nh_list ? listcount( old->nh_list) : 0); - } if (table->hook_add) (*table->hook_add)(old); @@ -1140,13 +1115,11 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) continue; if ((ospf6_route_cmp(route, old_route) != 0)) { - if (is_debug) { - prefix2str(&prefix, buf, sizeof(buf)); + if (is_debug) zlog_debug( - "%s: old %p %s cost %u new route cost %u are not same", - __func__, (void *)old_route, buf, + "%s: old %p %pFX cost %u new route cost %u are not same", + __func__, (void *)old_route, &prefix, old_route->path.cost, route->path.cost); - } /* Check new route's adv. router is same in one of * the paths with differed cost, if so remove the diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 713ce26ecb..866bc7e189 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -505,13 +505,12 @@ void ospf6_area_config_write(struct vty *vty) struct listnode *node; struct ospf6_area *oa; struct ospf6_route *range; - char buf[PREFIX2STR_BUFFER]; for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) { for (range = ospf6_route_head(oa->range_table); range; range = ospf6_route_next(range)) { - prefix2str(&range->prefix, buf, sizeof(buf)); - vty_out(vty, " area %s range %s", oa->name, buf); + vty_out(vty, " area %s range %pFX", oa->name, + &range->prefix); if (CHECK_FLAG(range->flag, OSPF6_ROUTE_DO_NOT_ADVERTISE)) { diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 10a92414b9..80a3c1005d 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -63,13 +63,11 @@ static void ospf6_as_external_lsa_originate(struct ospf6_route *route) struct ospf6_external_info *info = route->route_option; struct ospf6_as_external_lsa *as_external_lsa; - char buf[PREFIX2STR_BUFFER]; caddr_t p; - if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL)) { - prefix2str(&route->prefix, buf, sizeof(buf)); - zlog_debug("Originate AS-External-LSA for %s", buf); - } + if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL)) + zlog_debug("Originate AS-External-LSA for %pFX", + &route->prefix); /* prepare buffer */ memset(buffer, 0, sizeof(buffer)); @@ -211,7 +209,6 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, struct listnode *anode, *anext; struct listnode *nnode, *rnode, *rnext; struct ospf6_nexthop *nh, *rnh; - char buf[PREFIX2STR_BUFFER]; bool route_found = false; /* check for old entry match with new route origin, @@ -371,11 +368,9 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, listnode_add_sort(old_route->paths, ecmp_path); if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { - prefix2str(&route->prefix, buf, - sizeof(buf)); zlog_debug( - "%s: route %s another path added with nh %u, effective paths %u nh %u", - __func__, buf, + "%s: route %pFX another path added with nh %u, effective paths %u nh %u", + __func__, &route->prefix, listcount(ecmp_path->nh_list), old_route->paths ? listcount( old_route->paths) @@ -401,32 +396,27 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, &o_path->ls_prefix, ospf6->brouter_table); if (asbr_entry == NULL) { - if (IS_OSPF6_DEBUG_EXAMIN( - AS_EXTERNAL)) { - prefix2str(&old_route->prefix, - buf, sizeof(buf)); + if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) zlog_debug( - "%s: ls_prfix %s asbr_entry not found.", - __func__, buf); - } + "%s: ls_prfix %pFX asbr_entry not found.", + __func__, + &old_route->prefix); continue; } ospf6_route_merge_nexthops(old_route, asbr_entry); } - if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { - prefix2str(&route->prefix, buf, sizeof(buf)); + if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) zlog_debug( - "%s: route %s with effective paths %u nh %u", - __func__, buf, + "%s: route %pFX with effective paths %u nh %u", + __func__, &route->prefix, old_route->paths ? listcount(old_route->paths) : 0, old_route->nh_list ? listcount(old_route->nh_list) : 0); - } /* Update RIB/FIB */ if (ospf6->route_table->hook_add) @@ -453,7 +443,6 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa) struct prefix asbr_id; struct ospf6_route *asbr_entry, *route, *old; struct ospf6_path *path; - char buf[PREFIX2STR_BUFFER]; external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END( lsa->header); @@ -484,10 +473,8 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa) asbr_entry = ospf6_route_lookup(&asbr_id, ospf6->brouter_table); if (asbr_entry == NULL || !CHECK_FLAG(asbr_entry->path.router_bits, OSPF6_ROUTER_BIT_E)) { - if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { - prefix2str(&asbr_id, buf, sizeof(buf)); - zlog_debug("ASBR entry not found: %s", buf); - } + if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) + zlog_debug("ASBR entry not found: %pFX", &asbr_id); return; } @@ -527,15 +514,13 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa) listnode_add_sort(route->paths, path); - if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) { - prefix2str(&route->prefix, buf, sizeof(buf)); - zlog_debug("%s: AS-External %u route add %s cost %u(%u) nh %u", - __func__, - (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1 - : 2, - buf, route->path.cost, route->path.u.cost_e2, - listcount(route->nh_list)); - } + if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) + zlog_debug( + "%s: AS-External %u route add %pFX cost %u(%u) nh %u", + __func__, + (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1 : 2, + &route->prefix, route->path.cost, route->path.u.cost_e2, + listcount(route->nh_list)); old = ospf6_route_lookup(&route->prefix, ospf6->route_table); if (!old) { @@ -1029,7 +1014,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, struct ospf6_external_info *info; struct prefix prefix_id; struct route_node *node; - char pbuf[PREFIX2STR_BUFFER], ibuf[16]; + char ibuf[16]; struct listnode *lnode, *lnnode; struct ospf6_area *oa; @@ -1039,10 +1024,8 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, memset(&troute, 0, sizeof(troute)); memset(&tinfo, 0, sizeof(tinfo)); - if (IS_OSPF6_DEBUG_ASBR) { - prefix2str(prefix, pbuf, sizeof(pbuf)); - zlog_debug("Redistribute %s (%s)", pbuf, ZROUTE_NAME(type)); - } + if (IS_OSPF6_DEBUG_ASBR) + zlog_debug("Redistribute %pFX (%s)", prefix, ZROUTE_NAME(type)); /* if route-map was specified but not found, do not advertise */ if (ospf6->rmap[type].name) { @@ -1109,10 +1092,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, if (IS_OSPF6_DEBUG_ASBR) { inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf)); - prefix2str(prefix, pbuf, sizeof(pbuf)); zlog_debug( - "Advertise as AS-External Id:%s prefix %s metric %u", - ibuf, pbuf, match->path.metric_type); + "Advertise as AS-External Id:%s prefix %pFX metric %u", + ibuf, prefix, match->path.metric_type); } match->path.origin.id = htonl(info->id); @@ -1163,9 +1145,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, if (IS_OSPF6_DEBUG_ASBR) { inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf)); - prefix2str(prefix, pbuf, sizeof(pbuf)); - zlog_debug("Advertise as AS-External Id:%s prefix %s metric %u", - ibuf, pbuf, route->path.metric_type); + zlog_debug( + "Advertise as AS-External Id:%s prefix %pFX metric %u", + ibuf, prefix, route->path.metric_type); } route->path.origin.id = htonl(info->id); @@ -1184,16 +1166,14 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex, struct route_node *node; struct ospf6_lsa *lsa; struct prefix prefix_id; - char pbuf[PREFIX2STR_BUFFER], ibuf[16]; + char ibuf[16]; struct listnode *lnode, *lnnode; struct ospf6_area *oa; match = ospf6_route_lookup(prefix, ospf6->external_table); if (match == NULL) { - if (IS_OSPF6_DEBUG_ASBR) { - prefix2str(prefix, pbuf, sizeof(pbuf)); - zlog_debug("No such route %s to withdraw", pbuf); - } + if (IS_OSPF6_DEBUG_ASBR) + zlog_debug("No such route %pFX to withdraw", prefix); return; } @@ -1201,17 +1181,14 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex, assert(info); if (info->type != type) { - if (IS_OSPF6_DEBUG_ASBR) { - prefix2str(prefix, pbuf, sizeof(pbuf)); - zlog_debug("Original protocol mismatch: %s", pbuf); - } + if (IS_OSPF6_DEBUG_ASBR) + zlog_debug("Original protocol mismatch: %pFX", prefix); return; } if (IS_OSPF6_DEBUG_ASBR) { - prefix2str(prefix, pbuf, sizeof(pbuf)); inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf)); - zlog_debug("Withdraw %s (AS-External Id:%s)", pbuf, ibuf); + zlog_debug("Withdraw %pFX (AS-External Id:%s)", prefix, ibuf); } lsa = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL), @@ -1823,10 +1800,9 @@ static void ospf6_asbr_external_route_show(struct vty *vty, struct ospf6_route *route) { struct ospf6_external_info *info = route->route_option; - char prefix[PREFIX2STR_BUFFER], id[16], forwarding[64]; + char id[16], forwarding[64]; uint32_t tmp_id; - prefix2str(&route->prefix, prefix, sizeof(prefix)); tmp_id = ntohl(info->id); inet_ntop(AF_INET, &tmp_id, id, sizeof(id)); if (!IN6_IS_ADDR_UNSPECIFIED(&info->forwarding)) @@ -1836,8 +1812,8 @@ static void ospf6_asbr_external_route_show(struct vty *vty, snprintf(forwarding, sizeof(forwarding), ":: (ifindex %d)", ospf6_route_get_first_nh_index(route)); - vty_out(vty, "%c %-32s %-15s type-%d %5lu %s\n", - zebra_route_char(info->type), prefix, id, + vty_out(vty, "%c %-32pFX %-15s type-%d %5lu %s\n", + zebra_route_char(info->type), &route->prefix, id, route->path.metric_type, (unsigned long)(route->path.metric_type == 2 ? route->path.u.cost_e2 diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 1b58cd14f6..4e50ab5244 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -204,12 +204,9 @@ static int ospf6_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS) if ((ifp == NULL) || (dp.family != AF_INET6)) return 0; - if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { - char buf[PREFIX2STR_BUFFER]; - prefix2str(&dp, buf, sizeof(buf)); - zlog_debug("Zebra: interface %s bfd destination %s %s", - ifp->name, buf, bfd_get_status_str(status)); - } + if (IS_OSPF6_DEBUG_ZEBRA(RECV)) + zlog_debug("Zebra: interface %s bfd destination %pFX %s", + ifp->name, &dp, bfd_get_status_str(status)); oi = (struct ospf6_interface *)ifp->info; diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 72e40676a0..a724157737 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -436,16 +436,14 @@ void ospf6_interface_connected_route_update(struct interface *ifp) if (oi->plist_name) { struct prefix_list *plist; enum prefix_list_type ret; - char buf[PREFIX2STR_BUFFER]; - prefix2str(c->address, buf, sizeof(buf)); plist = prefix_list_lookup(AFI_IP6, oi->plist_name); ret = prefix_list_apply(plist, (void *)c->address); if (ret == PREFIX_DENY) { if (IS_OSPF6_DEBUG_INTERFACE) zlog_debug( - "%s on %s filtered by prefix-list %s ", - buf, oi->interface->name, + "%pFX on %s filtered by prefix-list %s ", + c->address, oi->interface->name, oi->plist_name); continue; } @@ -929,16 +927,15 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp) for (ALL_LIST_ELEMENTS_RO(ifp->connected, i, c)) { p = c->address; - prefix2str(p, strbuf, sizeof(strbuf)); switch (p->family) { case AF_INET: - vty_out(vty, " inet : %s\n", strbuf); + vty_out(vty, " inet : %pFX\n", p); break; case AF_INET6: - vty_out(vty, " inet6: %s\n", strbuf); + vty_out(vty, " inet6: %pFX\n", p); break; default: - vty_out(vty, " ??? : %s\n", strbuf); + vty_out(vty, " ??? : %pFX\n", p); break; } } diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 6eda9f750c..733b9cffb1 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -907,7 +907,6 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) struct listnode *i, *j; int full_count = 0; unsigned short prefix_num = 0; - char buf[PREFIX2STR_BUFFER]; struct ospf6_route_table *route_advertise; int ls_id = 0; @@ -985,10 +984,8 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread) /* connected prefix to advertise */ for (route = ospf6_route_head(oi->route_connected); route; route = ospf6_route_best_next(route)) { - if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) { - prefix2str(&route->prefix, buf, sizeof(buf)); - zlog_debug(" include %s", buf); - } + if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) + zlog_debug(" include %pFX", &route->prefix); ospf6_route_add(ospf6_route_copy(route), route_advertise); } @@ -1144,7 +1141,6 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) struct ospf6_link_lsa *link_lsa; char *start, *end, *current; uint16_t type; - char buf[PREFIX2STR_BUFFER]; oi = (struct ospf6_interface *)THREAD_ARG(thread); oi->thread_intra_prefix_lsa = NULL; @@ -1255,10 +1251,8 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread) route->path.area_id = oi->area->area_id; route->path.type = OSPF6_PATH_TYPE_INTRA; - if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) { - prefix2str(&route->prefix, buf, sizeof(buf)); - zlog_debug(" include %s", buf); - } + if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX)) + zlog_debug(" include %pFX", &route->prefix); ospf6_route_add(route, route_advertise); prefix_num--; @@ -1554,11 +1548,9 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, ospf6_linkstate_prefix( o_path->origin.adv_router, o_path->origin.id, &adv_prefix); - prefix2str(&adv_prefix, buf, - sizeof(buf)); zlog_debug( - "%s: adv_router %s lsa not found", - __func__, buf); + "%s: adv_router %pFX lsa not found", + __func__, &adv_prefix); } continue; } @@ -1582,16 +1574,15 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa, } } - if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) { - prefix2str(&route->prefix, buf, sizeof(buf)); + if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX)) zlog_debug( - "%s: route %s %p with final effective paths %u nh%u", - __func__, buf, (void *)old_route, + "%s: route %pFX %p with final effective paths %u nh%u", + __func__, &route->prefix, + (void *)old_route, old_route->paths ? listcount(old_route->paths) : 0, listcount(old_route->nh_list)); - } /* used in intra_route_calculation() to add to * global ospf6 route table. diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index cd873e2f00..f8f0780baa 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -156,46 +156,36 @@ extern vector ospf6_lsa_handler_vector; /* addr is (struct prefix *) */ #define CONTINUE_IF_ADDRESS_LINKLOCAL(debug, addr) \ if (IN6_IS_ADDR_LINKLOCAL(&(addr)->u.prefix6)) { \ - char buf[PREFIX2STR_BUFFER]; \ - prefix2str(addr, buf, sizeof(buf)); \ if (debug) \ - zlog_debug("Filter out Linklocal: %s", buf); \ + zlog_debug("Filter out Linklocal: %pFX", addr); \ continue; \ } #define CONTINUE_IF_ADDRESS_UNSPECIFIED(debug, addr) \ if (IN6_IS_ADDR_UNSPECIFIED(&(addr)->u.prefix6)) { \ - char buf[PREFIX2STR_BUFFER]; \ - prefix2str(addr, buf, sizeof(buf)); \ if (debug) \ - zlog_debug("Filter out Unspecified: %s", buf); \ + zlog_debug("Filter out Unspecified: %pFX", addr); \ continue; \ } #define CONTINUE_IF_ADDRESS_LOOPBACK(debug, addr) \ if (IN6_IS_ADDR_LOOPBACK(&(addr)->u.prefix6)) { \ - char buf[PREFIX2STR_BUFFER]; \ - prefix2str(addr, buf, sizeof(buf)); \ if (debug) \ - zlog_debug("Filter out Loopback: %s", buf); \ + zlog_debug("Filter out Loopback: %pFX", addr); \ continue; \ } #define CONTINUE_IF_ADDRESS_V4COMPAT(debug, addr) \ if (IN6_IS_ADDR_V4COMPAT(&(addr)->u.prefix6)) { \ - char buf[PREFIX2STR_BUFFER]; \ - prefix2str(addr, buf, sizeof(buf)); \ if (debug) \ - zlog_debug("Filter out V4Compat: %s", buf); \ + zlog_debug("Filter out V4Compat: %pFX", addr); \ continue; \ } #define CONTINUE_IF_ADDRESS_V4MAPPED(debug, addr) \ if (IN6_IS_ADDR_V4MAPPED(&(addr)->u.prefix6)) { \ - char buf[PREFIX2STR_BUFFER]; \ - prefix2str(addr, buf, sizeof(buf)); \ if (debug) \ - zlog_debug("Filter out V4Mapped: %s", buf); \ + zlog_debug("Filter out V4Mapped: %pFX", addr); \ continue; \ } diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index db6f9a7801..0892863cf1 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -207,11 +207,7 @@ struct ospf6_lsa *ospf6_lsdb_lookup_next(uint16_t type, uint32_t id, ospf6_lsdb_set_key(&key, &adv_router, sizeof(adv_router)); ospf6_lsdb_set_key(&key, &id, sizeof(id)); - { - char buf[PREFIX2STR_BUFFER]; - prefix2str(&key, buf, sizeof(buf)); - zlog_debug("lsdb_lookup_next: key: %s", buf); - } + zlog_debug("lsdb_lookup_next: key: %pFX", &key); node = route_table_get_next(lsdb->table, &key); diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 4044cdc549..1cd6b8cff4 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -550,7 +550,6 @@ ospf6_route_lookup_bestmatch(struct prefix *prefix, static void route_table_assert(struct ospf6_route_table *table) { struct ospf6_route *prev, *r, *next; - char buf[PREFIX2STR_BUFFER]; unsigned int link_error = 0, num = 0; r = ospf6_route_head(table); @@ -579,10 +578,9 @@ static void route_table_assert(struct ospf6_route_table *table) "Something has gone wrong with ospf6_route_table[%p]", table); zlog_debug("table count = %d, real number = %d", table->count, num); zlog_debug("DUMP START"); - for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) { - prefix2str(&r->prefix, buf, sizeof(buf)); - zlog_info("%p<-[%p]->%p : %s", r->prev, r, r->next, buf); - } + for (r = ospf6_route_head(table); r; r = ospf6_route_next(r)) + zlog_info("%p<-[%p]->%p : %pFX", r->prev, r, r->next, + &r->prefix); zlog_debug("DUMP END"); assert(link_error == 0 && num == table->count); diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index bb6a050976..d3a330c3c7 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -320,7 +320,6 @@ static int ospf6_spf_install(struct ospf6_vertex *v, { struct ospf6_route *route, *parent_route; struct ospf6_vertex *prev; - char pbuf[PREFIX2STR_BUFFER]; if (IS_OSPF6_DEBUG_SPF(PROCESS)) zlog_debug("SPF install %s (lsa %s) hops %d cost %d", v->name, @@ -335,12 +334,10 @@ static int ospf6_spf_install(struct ospf6_vertex *v, ospf6_vertex_delete(v); return -1; } else if (route && route->path.cost == v->cost) { - if (IS_OSPF6_DEBUG_SPF(PROCESS)) { - prefix2str(&route->prefix, pbuf, sizeof(pbuf)); + if (IS_OSPF6_DEBUG_SPF(PROCESS)) zlog_debug( - " another path found to route %s lsa %s, merge", - pbuf, v->lsa->name); - } + " another path found to route %pFX lsa %s, merge", + &route->prefix, v->lsa->name); ospf6_spf_merge_nexthops_to_route(route, v); prev = (struct ospf6_vertex *)route->route_option; diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 49b7e4f142..1f906cadd1 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -1059,15 +1059,11 @@ static int ospf6_distance_config_write(struct vty *vty) } for (rn = route_top(ospf6->distance_table); rn; rn = route_next(rn)) - if ((odistance = rn->info) != NULL) { - char buf[PREFIX_STRLEN]; - - vty_out(vty, " distance %u %s %s\n", - odistance->distance, - prefix2str(&rn->p, buf, sizeof(buf)), + if ((odistance = rn->info) != NULL) + vty_out(vty, " distance %u %pFX %s\n", + odistance->distance, &rn->p, odistance->access_list ? odistance->access_list : ""); - } return 0; } diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index d37235d192..c5c8ca27b9 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -163,19 +163,13 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) ifindex = api.nexthops[0].ifindex; nexthop = &api.nexthops[0].gate.ipv6; - if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { - char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128]; - - prefix2str(&api.prefix, prefixstr, sizeof(prefixstr)); - inet_ntop(AF_INET6, nexthop, nexthopstr, sizeof(nexthopstr)); - + if (IS_OSPF6_DEBUG_ZEBRA(RECV)) zlog_debug( - "Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %" ROUTE_TAG_PRI, + "Zebra Receive route %s: %s %pFX nexthop %pI6 ifindex %ld tag %" ROUTE_TAG_PRI, (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD ? "add" : "delete"), - zebra_route_string(api.type), prefixstr, nexthopstr, + zebra_route_string(api.type), &api.prefix, nexthop, ifindex, api.tag); - } if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) ospf6_asbr_redistribute_add(api.type, ifindex, &api.prefix, @@ -219,16 +213,13 @@ DEFUN (show_zebra, static void ospf6_zebra_route_update(int type, struct ospf6_route *request) { struct zapi_route api; - char buf[PREFIX2STR_BUFFER]; int nhcount; int ret = 0; struct prefix *dest; - if (IS_OSPF6_DEBUG_ZEBRA(SEND)) { - prefix2str(&request->prefix, buf, sizeof(buf)); - zlog_debug("Send %s route: %s", - (type == REM ? "remove" : "add"), buf); - } + if (IS_OSPF6_DEBUG_ZEBRA(SEND)) + zlog_debug("Send %s route: %pFX", + (type == REM ? "remove" : "add"), &request->prefix); if (zclient->sock < 0) { if (IS_OSPF6_DEBUG_ZEBRA(SEND)) |
