diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/agentx.c | 7 | ||||
| -rw-r--r-- | lib/filter.c | 33 | ||||
| -rw-r--r-- | lib/frr_zmq.c | 22 | ||||
| -rw-r--r-- | lib/if.c | 7 | ||||
| -rw-r--r-- | lib/ldp_sync.c | 2 | ||||
| -rw-r--r-- | lib/nexthop.c | 8 | ||||
| -rw-r--r-- | lib/nexthop_group.c | 20 | ||||
| -rw-r--r-- | lib/northbound_cli.c | 8 | ||||
| -rw-r--r-- | lib/routemap.c | 24 | ||||
| -rw-r--r-- | lib/sockunion.c | 12 | ||||
| -rw-r--r-- | lib/spf_backoff.c | 9 | ||||
| -rw-r--r-- | lib/thread.c | 16 | ||||
| -rw-r--r-- | lib/thread.h | 19 | ||||
| -rw-r--r-- | lib/workqueue.c | 4 | ||||
| -rw-r--r-- | lib/zclient.c | 50 |
15 files changed, 105 insertions, 136 deletions
diff --git a/lib/agentx.c b/lib/agentx.c index 7c4bdcbe27..603d8d6172 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -107,7 +107,7 @@ static void agentx_events_update(void) struct thread *thr; int fd, thr_fd; - THREAD_OFF(timeout_thr); + thread_cancel(&timeout_thr); FD_ZERO(&fds); snmp_select_info(&maxfd, &fds, &timeout, &block); @@ -130,7 +130,7 @@ static void agentx_events_update(void) if (thr_fd == fd) { struct listnode *nextln = listnextnode(ln); if (!FD_ISSET(fd, &fds)) { - thread_cancel(thr); + thread_cancel(&thr); list_delete_node(events, ln); } ln = nextln; @@ -151,7 +151,8 @@ static void agentx_events_update(void) */ while (ln) { struct listnode *nextln = listnextnode(ln); - thread_cancel(listgetdata(ln)); + thr = listgetdata(ln); + thread_cancel(&thr); list_delete_node(events, ln); ln = nextln; } diff --git a/lib/filter.c b/lib/filter.c index e6add0462b..f5ae9ee2b7 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -576,14 +576,12 @@ static int filter_show(struct vty *vty, const char *name, afi_t afi) if (filter->addr_mask.s_addr == 0xffffffff) vty_out(vty, " any\n"); else { - vty_out(vty, " %s", - inet_ntoa(filter->addr)); + vty_out(vty, " %pI4", &filter->addr); if (filter->addr_mask.s_addr != INADDR_ANY) vty_out(vty, - ", wildcard bits %s", - inet_ntoa( - filter->addr_mask)); + ", wildcard bits %pI4", + &filter->addr_mask); vty_out(vty, "\n"); } } @@ -625,14 +623,12 @@ static int filter_show(struct vty *vty, const char *name, afi_t afi) if (filter->addr_mask.s_addr == 0xffffffff) vty_out(vty, " any\n"); else { - vty_out(vty, " %s", - inet_ntoa(filter->addr)); + vty_out(vty, " %pI4", &filter->addr); if (filter->addr_mask.s_addr != INADDR_ANY) vty_out(vty, - ", wildcard bits %s", - inet_ntoa( - filter->addr_mask)); + ", wildcard bits %pI4", + &filter->addr_mask); vty_out(vty, "\n"); } } @@ -722,29 +718,28 @@ static void config_write_access_cisco(struct vty *vty, struct filter *mfilter) if (filter->addr_mask.s_addr == 0xffffffff) vty_out(vty, " any"); else if (filter->addr_mask.s_addr == INADDR_ANY) - vty_out(vty, " host %s", inet_ntoa(filter->addr)); + vty_out(vty, " host %pI4", &filter->addr); else { - vty_out(vty, " %s", inet_ntoa(filter->addr)); - vty_out(vty, " %s", inet_ntoa(filter->addr_mask)); + vty_out(vty, " %pI4", &filter->addr); + vty_out(vty, " %pI4", &filter->addr_mask); } if (filter->mask_mask.s_addr == 0xffffffff) vty_out(vty, " any"); else if (filter->mask_mask.s_addr == INADDR_ANY) - vty_out(vty, " host %s", inet_ntoa(filter->mask)); + vty_out(vty, " host %pI4", &filter->mask); else { - vty_out(vty, " %s", inet_ntoa(filter->mask)); - vty_out(vty, " %s", inet_ntoa(filter->mask_mask)); + vty_out(vty, " %pI4", &filter->mask); + vty_out(vty, " %pI4", &filter->mask_mask); } vty_out(vty, "\n"); } else { if (filter->addr_mask.s_addr == 0xffffffff) vty_out(vty, " any\n"); else { - vty_out(vty, " %s", inet_ntoa(filter->addr)); + vty_out(vty, " %pI4", &filter->addr); if (filter->addr_mask.s_addr != INADDR_ANY) - vty_out(vty, " %s", - inet_ntoa(filter->addr_mask)); + vty_out(vty, " %pI4", &filter->addr_mask); vty_out(vty, "\n"); } } diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c index 565936a410..cc11d76700 100644 --- a/lib/frr_zmq.c +++ b/lib/frr_zmq.c @@ -190,10 +190,8 @@ int funcname_frrzmq_thread_add_read(struct thread_master *master, cb->read.cancelled = false; if (events & ZMQ_POLLIN) { - if (cb->read.thread) { - thread_cancel(cb->read.thread); - cb->read.thread = NULL; - } + thread_cancel(&cb->read.thread); + funcname_thread_add_event(master, frrzmq_read_msg, cbp, fd, &cb->read.thread, funcname, schedfrom, fromln); @@ -298,10 +296,8 @@ int funcname_frrzmq_thread_add_write(struct thread_master *master, cb->write.cancelled = false; if (events & ZMQ_POLLOUT) { - if (cb->write.thread) { - thread_cancel(cb->write.thread); - cb->write.thread = NULL; - } + thread_cancel(&cb->write.thread); + funcname_thread_add_event(master, frrzmq_write_msg, cbp, fd, &cb->write.thread, funcname, schedfrom, fromln); @@ -317,10 +313,8 @@ void frrzmq_thread_cancel(struct frrzmq_cb **cb, struct cb_core *core) if (!cb || !*cb) return; core->cancelled = true; - if (core->thread) { - thread_cancel(core->thread); - core->thread = NULL; - } + thread_cancel(&core->thread); + if ((*cb)->read.cancelled && !(*cb)->read.thread && (*cb)->write.cancelled && (*cb)->write.thread) XFREE(MTYPE_ZEROMQ_CB, *cb); @@ -344,8 +338,8 @@ void frrzmq_check_events(struct frrzmq_cb **cbp, struct cb_core *core, return; if (events & event && core->thread && !core->cancelled) { struct thread_master *tm = core->thread->master; - thread_cancel(core->thread); - core->thread = NULL; + thread_cancel(&core->thread); + thread_add_event(tm, (event == ZMQ_POLLIN ? frrzmq_read_msg : frrzmq_write_msg), cbp, cb->fd, &core->thread); @@ -1106,8 +1106,8 @@ ifaddr_ipv4_add (struct in_addr *ifaddr, struct interface *ifp) if (rn) { route_unlock_node (rn); - zlog_info ("ifaddr_ipv4_add(): address %s is already added", - inet_ntoa (*ifaddr)); + zlog_info("ifaddr_ipv4_add(): address %pI4 is already added", + ifaddr); return; } rn->info = ifp; @@ -1126,8 +1126,7 @@ ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp) rn = route_node_lookup (ifaddr_ipv4_table, (struct prefix *) &p); if (! rn) { - zlog_info ("ifaddr_ipv4_delete(): can't find address %s", - inet_ntoa (*ifaddr)); + zlog_info("%s: can't find address %pI4", __func__, ifaddr); return; } rn->info = NULL; diff --git a/lib/ldp_sync.c b/lib/ldp_sync.c index 9657f0b1df..c9d7eb37cf 100644 --- a/lib/ldp_sync.c +++ b/lib/ldp_sync.c @@ -79,7 +79,7 @@ bool ldp_sync_if_down(struct ldp_sync_info *ldp_sync_info) * update state */ if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED) { - THREAD_TIMER_OFF(ldp_sync_info->t_holddown); + THREAD_OFF(ldp_sync_info->t_holddown); if (ldp_sync_info->state == LDP_IGP_SYNC_STATE_REQUIRED_UP) ldp_sync_info->state = diff --git a/lib/nexthop.c b/lib/nexthop.c index f1575649b1..b2fa945690 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -431,13 +431,13 @@ const char *nexthop2str(const struct nexthop *nexthop, char *str, int size) break; case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4_IFINDEX: - snprintf(str, size, "%s if %u", inet_ntoa(nexthop->gate.ipv4), - nexthop->ifindex); + snprintfrr(str, size, "%pI4 if %u", &nexthop->gate.ipv4, + nexthop->ifindex); break; case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6_IFINDEX: - snprintf(str, size, "%s if %u", inet6_ntoa(nexthop->gate.ipv6), - nexthop->ifindex); + snprintfrr(str, size, "%pI6 if %u", &nexthop->gate.ipv6, + nexthop->ifindex); break; case NEXTHOP_TYPE_BLACKHOLE: snprintf(str, size, "blackhole"); diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index 4afb1d642a..dee98ad8d7 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -975,7 +975,6 @@ void nexthop_group_write_nexthop_simple(struct vty *vty, const struct nexthop *nh, char *altifname) { - char buf[100]; char *ifname; vty_out(vty, "nexthop "); @@ -990,19 +989,16 @@ void nexthop_group_write_nexthop_simple(struct vty *vty, vty_out(vty, "%s", ifname); break; case NEXTHOP_TYPE_IPV4: - vty_out(vty, "%s", inet_ntoa(nh->gate.ipv4)); + vty_out(vty, "%pI4", &nh->gate.ipv4); break; case NEXTHOP_TYPE_IPV4_IFINDEX: - vty_out(vty, "%s %s", inet_ntoa(nh->gate.ipv4), ifname); + vty_out(vty, "%pI4 %s", &nh->gate.ipv4, ifname); break; case NEXTHOP_TYPE_IPV6: - vty_out(vty, "%s", - inet_ntop(AF_INET6, &nh->gate.ipv6, buf, sizeof(buf))); + vty_out(vty, "%pI6", &nh->gate.ipv6); break; case NEXTHOP_TYPE_IPV6_IFINDEX: - vty_out(vty, "%s %s", - inet_ntop(AF_INET6, &nh->gate.ipv6, buf, sizeof(buf)), - ifname); + vty_out(vty, "%pI6 %s", &nh->gate.ipv6, ifname); break; case NEXTHOP_TYPE_BLACKHOLE: break; @@ -1056,10 +1052,14 @@ void nexthop_group_json_nexthop(json_object *j, const struct nexthop *nh) ifindex2ifname(nh->ifindex, nh->vrf_id)); break; case NEXTHOP_TYPE_IPV4: - json_object_string_add(j, "nexthop", inet_ntoa(nh->gate.ipv4)); + json_object_string_add( + j, "nexthop", + inet_ntop(AF_INET, &nh->gate.ipv4, buf, sizeof(buf))); break; case NEXTHOP_TYPE_IPV4_IFINDEX: - json_object_string_add(j, "nexthop", inet_ntoa(nh->gate.ipv4)); + json_object_string_add( + j, "nexthop", + inet_ntop(AF_INET, &nh->gate.ipv4, buf, sizeof(buf))); json_object_string_add(j, "vrfId", ifindex2ifname(nh->ifindex, nh->vrf_id)); break; diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index a7f3a1b305..7048df99fb 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -89,7 +89,7 @@ static int nb_cli_classic_commit(struct vty *vty) static void nb_cli_pending_commit_clear(struct vty *vty) { - THREAD_TIMER_OFF(vty->t_pending_commit); + THREAD_OFF(vty->t_pending_commit); vty->backoff_cmd_count = 0; XFREE(MTYPE_TMP, vty->pending_cmds_buf); vty->pending_cmds_buflen = 0; @@ -154,7 +154,7 @@ static int nb_cli_schedule_command(struct vty *vty) vty->pending_cmds_buflen); /* Schedule the commit operation. */ - THREAD_TIMER_OFF(vty->t_pending_commit); + THREAD_OFF(vty->t_pending_commit); thread_add_timer_msec(master, nb_cli_pending_commit_cb, vty, 100, &vty->t_pending_commit); @@ -312,7 +312,7 @@ int nb_cli_rpc(struct vty *vty, const char *xpath, struct list *input, void nb_cli_confirmed_commit_clean(struct vty *vty) { - THREAD_TIMER_OFF(vty->t_confirmed_commit_timeout); + thread_cancel(&vty->t_confirmed_commit_timeout); nb_config_free(vty->confirmed_commit_rollback); vty->confirmed_commit_rollback = NULL; } @@ -377,7 +377,7 @@ static int nb_cli_commit(struct vty *vty, bool force, "%% Resetting confirmed-commit timeout to %u minute(s)\n\n", confirmed_timeout); - THREAD_TIMER_OFF(vty->t_confirmed_commit_timeout); + thread_cancel(&vty->t_confirmed_commit_timeout); thread_add_timer(master, nb_cli_confirmed_commit_timeout, vty, confirmed_timeout * 60, diff --git a/lib/routemap.c b/lib/routemap.c index 1352bae58f..0eb54a4794 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -2377,7 +2377,6 @@ route_map_result_t route_map_apply(struct route_map *map, route_map_result_t ret = RMAP_PERMITMATCH; struct route_map_index *index = NULL; struct route_map_rule *set = NULL; - char buf[PREFIX_STRLEN]; bool skip_match_clause = false; if (recursion > RMAP_RECURSION_LIMIT) { @@ -2403,16 +2402,14 @@ route_map_result_t route_map_apply(struct route_map *map, if (index) { if (rmap_debug) zlog_debug( - "Best match route-map: %s, sequence: %d for pfx: %s, result: %s", - map->name, index->pref, - prefix2str(prefix, buf, sizeof(buf)), + "Best match route-map: %s, sequence: %d for pfx: %pFX, result: %s", + map->name, index->pref, prefix, route_map_cmd_result_str(match_ret)); } else { if (rmap_debug) zlog_debug( - "No best match sequence for pfx: %s in route-map: %s, result: %s", - prefix2str(prefix, buf, sizeof(buf)), - map->name, + "No best match sequence for pfx: %pFX in route-map: %s, result: %s", + prefix, map->name, route_map_cmd_result_str(match_ret)); /* * No index matches this prefix. Return deny unless, @@ -2437,9 +2434,8 @@ route_map_result_t route_map_apply(struct route_map *map, prefix, type, object); if (rmap_debug) { zlog_debug( - "Route-map: %s, sequence: %d, prefix: %s, result: %s", - map->name, index->pref, - prefix2str(prefix, buf, sizeof(buf)), + "Route-map: %s, sequence: %d, prefix: %pFX, result: %s", + map->name, index->pref, prefix, route_map_cmd_result_str(match_ret)); } } else @@ -2549,12 +2545,10 @@ route_map_result_t route_map_apply(struct route_map *map, } route_map_apply_end: - if (rmap_debug) { - zlog_debug("Route-map: %s, prefix: %s, result: %s", - (map ? map->name : "null"), - prefix2str(prefix, buf, sizeof(buf)), + if (rmap_debug) + zlog_debug("Route-map: %s, prefix: %pFX, result: %s", + (map ? map->name : "null"), prefix, route_map_result_str(ret)); - } return (ret); } diff --git a/lib/sockunion.c b/lib/sockunion.c index d77229797c..c999845659 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -587,15 +587,11 @@ static void __attribute__((unused)) sockunion_print(const union sockunion *su) switch (su->sa.sa_family) { case AF_INET: - printf("%s\n", inet_ntoa(su->sin.sin_addr)); + printf("%pI4\n", &su->sin.sin_addr); + break; + case AF_INET6: + printf("%pI6\n", &su->sin6.sin6_addr); break; - case AF_INET6: { - char buf[SU_ADDRSTRLEN]; - - printf("%s\n", inet_ntop(AF_INET6, &(su->sin6.sin6_addr), buf, - sizeof(buf))); - } break; - #ifdef AF_LINK case AF_LINK: { struct sockaddr_dl *sdl; diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c index acb208e5e7..ac6dd29f06 100644 --- a/lib/spf_backoff.c +++ b/lib/spf_backoff.c @@ -110,8 +110,8 @@ void spf_backoff_free(struct spf_backoff *backoff) if (!backoff) return; - THREAD_TIMER_OFF(backoff->t_holddown); - THREAD_TIMER_OFF(backoff->t_timetolearn); + thread_cancel(&backoff->t_holddown); + thread_cancel(&backoff->t_timetolearn); XFREE(MTYPE_SPF_BACKOFF_NAME, backoff->name); XFREE(MTYPE_SPF_BACKOFF, backoff); @@ -121,7 +121,6 @@ static int spf_backoff_timetolearn_elapsed(struct thread *thread) { struct spf_backoff *backoff = THREAD_ARG(thread); - backoff->t_timetolearn = NULL; backoff->state = SPF_BACKOFF_LONG_WAIT; backoff_debug("SPF Back-off(%s) TIMETOLEARN elapsed, move to state %s", backoff->name, spf_backoff_state2str(backoff->state)); @@ -132,7 +131,7 @@ static int spf_backoff_holddown_elapsed(struct thread *thread) { struct spf_backoff *backoff = THREAD_ARG(thread); - THREAD_TIMER_OFF(backoff->t_timetolearn); + THREAD_OFF(backoff->t_timetolearn); timerclear(&backoff->first_event_time); backoff->state = SPF_BACKOFF_QUIET; backoff_debug("SPF Back-off(%s) HOLDDOWN elapsed, move to state %s", @@ -166,7 +165,7 @@ long spf_backoff_schedule(struct spf_backoff *backoff) break; case SPF_BACKOFF_SHORT_WAIT: case SPF_BACKOFF_LONG_WAIT: - THREAD_TIMER_OFF(backoff->t_holddown); + thread_cancel(&backoff->t_holddown); thread_add_timer_msec(backoff->m, spf_backoff_holddown_elapsed, backoff, backoff->holddown, &backoff->t_holddown); diff --git a/lib/thread.c b/lib/thread.c index 9a5453b185..1765de9573 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1177,9 +1177,14 @@ void thread_cancel_event(struct thread_master *master, void *arg) * * @param thread task to cancel */ -void thread_cancel(struct thread *thread) +void thread_cancel(struct thread **thread) { - struct thread_master *master = thread->master; + struct thread_master *master; + + if (thread == NULL || *thread == NULL) + return; + + master = (*thread)->master; frrtrace(9, frr_libfrr, thread_cancel, master, thread->funcname, thread->schedfrom, thread->schedfrom_line, NULL, thread->u.fd, @@ -1190,10 +1195,12 @@ void thread_cancel(struct thread *thread) frr_with_mutex(&master->mtx) { struct cancel_req *cr = XCALLOC(MTYPE_TMP, sizeof(struct cancel_req)); - cr->thread = thread; + cr->thread = *thread; listnode_add(master->cancel_req, cr); do_thread_cancel(master); } + + *thread = NULL; } /** @@ -1256,6 +1263,9 @@ void thread_cancel_async(struct thread_master *master, struct thread **thread, while (!master->canceled) pthread_cond_wait(&master->cancel_cond, &master->mtx); } + + if (thread) + *thread = NULL; } /* ------------------------------------------------------------------------- */ diff --git a/lib/thread.h b/lib/thread.h index c22b2105cd..e2b7763c51 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -147,18 +147,15 @@ struct cpu_thread_history { #define THREAD_FD(X) ((X)->u.fd) #define THREAD_VAL(X) ((X)->u.val) -#define THREAD_OFF(thread) \ - do { \ - if (thread) { \ - thread_cancel(thread); \ - thread = NULL; \ - } \ +/* + * Please consider this macro deprecated, and do not use it in new code. + */ +#define THREAD_OFF(thread) \ + do { \ + if ((thread)) \ + thread_cancel(&(thread)); \ } while (0) -#define THREAD_READ_OFF(thread) THREAD_OFF(thread) -#define THREAD_WRITE_OFF(thread) THREAD_OFF(thread) -#define THREAD_TIMER_OFF(thread) THREAD_OFF(thread) - #define debugargdef const char *funcname, const char *schedfrom, int fromln #define thread_add_read(m,f,a,v,t) funcname_thread_add_read_write(THREAD_READ,m,f,a,v,t,#f,__FILE__,__LINE__) @@ -207,7 +204,7 @@ extern void funcname_thread_execute(struct thread_master *, debugargdef); #undef debugargdef -extern void thread_cancel(struct thread *); +extern void thread_cancel(struct thread **event); extern void thread_cancel_async(struct thread_master *, struct thread **, void *); extern void thread_cancel_event(struct thread_master *, void *); diff --git a/lib/workqueue.c b/lib/workqueue.c index 54090d0d0f..f8e4677220 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -104,7 +104,7 @@ void work_queue_free_and_null(struct work_queue **wqp) struct work_queue *wq = *wqp; if (wq->thread != NULL) - thread_cancel(wq->thread); + thread_cancel(&(wq->thread)); while (!work_queue_empty(wq)) { struct work_queue_item *item = work_queue_last_item(wq); @@ -215,7 +215,7 @@ void workqueue_cmd_init(void) void work_queue_plug(struct work_queue *wq) { if (wq->thread) - thread_cancel(wq->thread); + thread_cancel(&(wq->thread)); wq->thread = NULL; diff --git a/lib/zclient.c b/lib/zclient.c index 914b02749e..d0144279e5 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1116,13 +1116,11 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) { /* limit the number of nexthops if necessary */ if (api->nexthop_num > MULTIPATH_NUM) { - char buf[PREFIX2STR_BUFFER]; - - prefix2str(&api->prefix, buf, sizeof(buf)); flog_err( EC_LIB_ZAPI_ENCODE, - "%s: prefix %s: can't encode %u nexthops (maximum is %u)", - __func__, buf, api->nexthop_num, MULTIPATH_NUM); + "%s: prefix %pFX: can't encode %u nexthops (maximum is %u)", + __func__, &api->prefix, api->nexthop_num, + MULTIPATH_NUM); return -1; } @@ -1139,15 +1137,11 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) /* MPLS labels for BGP-LU or Segment Routing */ if (api_nh->label_num > MPLS_MAX_LABELS) { - char buf[PREFIX2STR_BUFFER]; - - prefix2str(&api->prefix, buf, sizeof(buf)); - - flog_err(EC_LIB_ZAPI_ENCODE, - "%s: prefix %s: can't encode %u labels (maximum is %u)", - __func__, buf, - api_nh->label_num, - MPLS_MAX_LABELS); + flog_err( + EC_LIB_ZAPI_ENCODE, + "%s: prefix %pFX: can't encode %u labels (maximum is %u)", + __func__, &api->prefix, + api_nh->label_num, MPLS_MAX_LABELS); return -1; } @@ -1162,13 +1156,10 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) if (CHECK_FLAG(api->message, ZAPI_MESSAGE_BACKUP_NEXTHOPS)) { /* limit the number of nexthops if necessary */ if (api->backup_nexthop_num > MULTIPATH_NUM) { - char buf[PREFIX2STR_BUFFER]; - - prefix2str(&api->prefix, buf, sizeof(buf)); flog_err( EC_LIB_ZAPI_ENCODE, - "%s: prefix %s: can't encode %u backup nexthops (maximum is %u)", - __func__, buf, api->backup_nexthop_num, + "%s: prefix %pFX: can't encode %u backup nexthops (maximum is %u)", + __func__, &api->prefix, api->backup_nexthop_num, MULTIPATH_NUM); return -1; } @@ -1185,15 +1176,11 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) /* MPLS labels for BGP-LU or Segment Routing */ if (api_nh->label_num > MPLS_MAX_LABELS) { - char buf[PREFIX2STR_BUFFER]; - - prefix2str(&api->prefix, buf, sizeof(buf)); - - flog_err(EC_LIB_ZAPI_ENCODE, - "%s: prefix %s: backup: can't encode %u labels (maximum is %u)", - __func__, buf, - api_nh->label_num, - MPLS_MAX_LABELS); + flog_err( + EC_LIB_ZAPI_ENCODE, + "%s: prefix %pFX: backup: can't encode %u labels (maximum is %u)", + __func__, &api->prefix, + api_nh->label_num, MPLS_MAX_LABELS); return -1; } @@ -2319,13 +2306,10 @@ struct connected *zebra_interface_address_read(int type, struct stream *s, else if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) { /* carp interfaces on OpenBSD with 0.0.0.0/0 as * "peer" */ - char buf[PREFIX_STRLEN]; flog_err( EC_LIB_ZAPI_ENCODE, - "warning: interface %s address %s with peer flag set, but no peer address!", - ifp->name, - prefix2str(ifc->address, buf, - sizeof(buf))); + "warning: interface %s address %pFX with peer flag set, but no peer address!", + ifp->name, ifc->address); UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER); } } |
