diff --git a/babeld/babeld.c b/babeld/babeld.c index 895ede7040..a907daf6c2 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -265,8 +265,7 @@ babel_get_myid(void) return; } - flog_err(EC_BABEL_CONFIG, - "Warning: couldn't find router id -- using random value."); + flog_err(EC_BABEL_CONFIG, "Couldn't find router id -- using random value."); rc = read_random_bytes(myid, 8); if(rc < 0) { diff --git a/babeld/message.c b/babeld/message.c index edb9806011..5c2e29d8b3 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -746,10 +746,9 @@ flushbuf(struct interface *ifp) if(rc < 0) flog_err(EC_BABEL_PACKET, "send: %s", safe_strerror(errno)); } else { - flog_err(EC_BABEL_PACKET, - "Warning: bucket full, dropping packet to %s.", - ifp->name); - } + flog_err(EC_BABEL_PACKET, "Bucket full, dropping packet to %s.", + ifp->name); + } } VALGRIND_MAKE_MEM_UNDEFINED(babel_ifp->sendbuf, babel_ifp->bufsize); babel_ifp->buffered = 0; @@ -1009,10 +1008,10 @@ flush_unicast(int dofree) flog_err(EC_BABEL_PACKET, "send(unicast): %s", safe_strerror(errno)); } else { - flog_err(EC_BABEL_PACKET, - "Warning: bucket full, dropping unicast packet to %s if %s.", - format_address(unicast_neighbour->address), - unicast_neighbour->ifp->name); + flog_err(EC_BABEL_PACKET, + "Bucket full, dropping unicast packet to %s if %s.", + format_address(unicast_neighbour->address), + unicast_neighbour->ifp->name); } done: diff --git a/babeld/route.c b/babeld/route.c index 0f6f6486f2..dfd0bfab89 100644 --- a/babeld/route.c +++ b/babeld/route.c @@ -399,15 +399,17 @@ install_route(struct babel_route *route) return; if(!route_feasible(route)) - flog_err(EC_BABEL_ROUTE, "WARNING: installing unfeasible route (this shouldn't happen)."); + flog_err(EC_BABEL_ROUTE, + "Installing unfeasible route (this shouldn't happen)."); i = find_route_slot(route->src->prefix, route->src->plen, NULL); assert(i >= 0 && i < route_slots); if(routes[i] != route && routes[i]->installed) { - flog_err(EC_BABEL_ROUTE, - "WARNING: attempting to install duplicate route (this shouldn't happen)."); - return; + flog_err( + EC_BABEL_ROUTE, + "Attempting to install duplicate route (this shouldn't happen)."); + return; } rc = kernel_route(ROUTE_ADD, route->src->prefix, route->src->plen, @@ -463,7 +465,8 @@ switch_routes(struct babel_route *old, struct babel_route *new) return; if(!route_feasible(new)) - flog_err(EC_BABEL_ROUTE, "WARNING: switching to unfeasible route (this shouldn't happen)."); + flog_err(EC_BABEL_ROUTE, + "Switching to unfeasible route (this shouldn't happen)."); rc = kernel_route(ROUTE_MODIFY, old->src->prefix, old->src->plen, old->nexthop, old->neigh->ifp->ifindex, diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index 252cd647a2..7eee254627 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -572,17 +572,11 @@ int eigrp_read(struct thread *thread) /* If incoming interface is passive one, ignore it. */ if (eigrp_if_is_passive(ei)) { - char buf[3][INET_ADDRSTRLEN]; - if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) zlog_debug( - "ignoring packet from router %s sent to %s, received on a passive interface, %s", - inet_ntop(AF_INET, &eigrph->vrid, buf[0], - sizeof(buf[0])), - inet_ntop(AF_INET, &iph->ip_dst, buf[1], - sizeof(buf[1])), - inet_ntop(AF_INET, &ei->address.u.prefix4, - buf[2], sizeof(buf[2]))); + "ignoring packet from router %u sent to %pI4, received on a passive interface, %pI4", + ntohs(eigrph->vrid), &iph->ip_dst, + &ei->address.u.prefix4); if (iph->ip_dst.s_addr == htonl(EIGRP_MULTICAST_ADDRESS)) { eigrp_if_set_multicast(ei); diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index e79123e6b4..7c765248c6 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -231,9 +231,7 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p, api.nexthop_num = count; if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) { - char buf[PREFIX_STRLEN]; - zlog_debug("Zebra: Route add %pFX nexthop %s", p, - inet_ntop(AF_INET, 0, buf, PREFIX_STRLEN)); + zlog_debug("Zebra: Route add %pFX", p); } zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); diff --git a/lib/vty.c b/lib/vty.c index df518422f0..4cefb5e80c 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -1783,7 +1783,6 @@ static int vty_accept(struct thread *thread) int accept_sock; struct prefix p; struct access_list *acl = NULL; - char buf[SU_ADDRSTRLEN]; accept_sock = THREAD_FD(thread); @@ -1804,8 +1803,8 @@ static int vty_accept(struct thread *thread) if (!sockunion2hostprefix(&su, &p)) { close(vty_sock); - zlog_info("Vty unable to convert prefix from sockunion %s", - sockunion2str(&su, buf, SU_ADDRSTRLEN)); + zlog_info("Vty unable to convert prefix from sockunion %pSU", + &su); return -1; } @@ -1813,8 +1812,7 @@ static int vty_accept(struct thread *thread) if (p.family == AF_INET && vty_accesslist_name) { if ((acl = access_list_lookup(AFI_IP, vty_accesslist_name)) && (access_list_apply(acl, &p) == FILTER_DENY)) { - zlog_info("Vty connection refused from %s", - sockunion2str(&su, buf, SU_ADDRSTRLEN)); + zlog_info("Vty connection refused from %pSU", &su); close(vty_sock); /* continue accepting connections */ @@ -1829,8 +1827,7 @@ static int vty_accept(struct thread *thread) if ((acl = access_list_lookup(AFI_IP6, vty_ipv6_accesslist_name)) && (access_list_apply(acl, &p) == FILTER_DENY)) { - zlog_info("Vty connection refused from %s", - sockunion2str(&su, buf, SU_ADDRSTRLEN)); + zlog_info("Vty connection refused from %pSU", &su); close(vty_sock); /* continue accepting connections */ @@ -1847,8 +1844,7 @@ static int vty_accept(struct thread *thread) zlog_info("can't set sockopt to vty_sock : %s", safe_strerror(errno)); - zlog_info("Vty connection from %s", - sockunion2str(&su, buf, SU_ADDRSTRLEN)); + zlog_info("Vty connection from %pSU", &su); vty_create(vty_sock, &su); @@ -2325,7 +2321,7 @@ static void vty_read_file(struct nb_config *config, FILE *confp) nl = strchr(ve->error_buf, '\n'); if (nl) *nl = '\0'; - flog_err(EC_LIB_VTY, "ERROR: %s on config line %u: %s", + flog_err(EC_LIB_VTY, "%s on config line %u: %s", message, ve->line_num, ve->error_buf); } } @@ -2444,9 +2440,8 @@ bool vty_read_config(struct nb_config *config, const char *config_file, confp = vty_use_backup_config(fullpath); if (confp) - flog_warn( - EC_LIB_BACKUP_CONFIG, - "WARNING: using backup configuration file!"); + flog_warn(EC_LIB_BACKUP_CONFIG, + "using backup configuration file!"); else { flog_err( EC_LIB_VTY, @@ -2495,9 +2490,8 @@ bool vty_read_config(struct nb_config *config, const char *config_file, confp = vty_use_backup_config(config_default_dir); if (confp) { - flog_warn( - EC_LIB_BACKUP_CONFIG, - "WARNING: using backup configuration file!"); + flog_warn(EC_LIB_BACKUP_CONFIG, + "using backup configuration file!"); fullpath = config_default_dir; } else { flog_err(EC_LIB_VTY, @@ -2625,7 +2619,7 @@ int vty_config_node_exit(struct vty *vty) /* Check if there's a pending confirmed commit. */ if (vty->t_confirmed_commit_timeout) { vty_out(vty, - "WARNING: exiting with a pending confirmed commit. Rolling back to previous configuration.\n\n"); + "exiting with a pending confirmed commit. Rolling back to previous configuration.\n\n"); nb_cli_confirmed_commit_rollback(vty); nb_cli_confirmed_commit_clean(vty); } diff --git a/lib/zclient.c b/lib/zclient.c index 6ce2113b91..c5e844933c 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2340,7 +2340,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s, * "peer" */ flog_err( EC_LIB_ZAPI_ENCODE, - "warning: interface %s address %pFX with peer flag set, but no peer address!", + "interface %s address %pFX with peer flag set, but no peer address!", ifp->name, ifc->address); UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER); } diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 349dc50b8c..160f012d78 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -86,13 +86,9 @@ const uint16_t ospf6_lsa_minlen[OSPF6_LSTYPE_SIZE] = { static void ospf6_header_print(struct ospf6_header *oh) { - char router_id[16], area_id[16]; - inet_ntop(AF_INET, &oh->router_id, router_id, sizeof(router_id)); - inet_ntop(AF_INET, &oh->area_id, area_id, sizeof(area_id)); - - zlog_debug(" OSPFv%d Type:%d Len:%hu Router-ID:%s", oh->version, - oh->type, ntohs(oh->length), router_id); - zlog_debug(" Area-ID:%s Cksum:%hx Instance-ID:%d", area_id, + zlog_debug(" OSPFv%d Type:%d Len:%hu Router-ID:%pI4", oh->version, + oh->type, ntohs(oh->length), &oh->router_id); + zlog_debug(" Area-ID:%pI4 Cksum:%hx Instance-ID:%d", &oh->area_id, ntohs(oh->checksum), oh->instance_id); } @@ -100,7 +96,6 @@ void ospf6_hello_print(struct ospf6_header *oh) { struct ospf6_hello *hello; char options[16]; - char drouter[16], bdrouter[16], neighbor[16]; char *p; ospf6_header_print(oh); @@ -109,8 +104,6 @@ void ospf6_hello_print(struct ospf6_header *oh) hello = (struct ospf6_hello *)((caddr_t)oh + sizeof(struct ospf6_header)); - inet_ntop(AF_INET, &hello->drouter, drouter, sizeof(drouter)); - inet_ntop(AF_INET, &hello->bdrouter, bdrouter, sizeof(bdrouter)); ospf6_options_printbuf(hello->options, options, sizeof(options)); zlog_debug(" I/F-Id:%ld Priority:%d Option:%s", @@ -118,14 +111,12 @@ void ospf6_hello_print(struct ospf6_header *oh) options); zlog_debug(" HelloInterval:%hu DeadInterval:%hu", ntohs(hello->hello_interval), ntohs(hello->dead_interval)); - zlog_debug(" DR:%s BDR:%s", drouter, bdrouter); + zlog_debug(" DR:%pI4 BDR:%pI4", &hello->drouter, &hello->bdrouter); for (p = (char *)((caddr_t)hello + sizeof(struct ospf6_hello)); p + sizeof(uint32_t) <= OSPF6_MESSAGE_END(oh); - p += sizeof(uint32_t)) { - inet_ntop(AF_INET, (void *)p, neighbor, sizeof(neighbor)); - zlog_debug(" Neighbor: %s", neighbor); - } + p += sizeof(uint32_t)) + zlog_debug(" Neighbor: %pI4", (in_addr_t *)p); assert(p == OSPF6_MESSAGE_END(oh)); } @@ -162,7 +153,6 @@ void ospf6_dbdesc_print(struct ospf6_header *oh) void ospf6_lsreq_print(struct ospf6_header *oh) { - char id[16], adv_router[16]; char *p; ospf6_header_print(oh); @@ -172,11 +162,9 @@ void ospf6_lsreq_print(struct ospf6_header *oh) p + sizeof(struct ospf6_lsreq_entry) <= OSPF6_MESSAGE_END(oh); p += sizeof(struct ospf6_lsreq_entry)) { struct ospf6_lsreq_entry *e = (struct ospf6_lsreq_entry *)p; - inet_ntop(AF_INET, &e->adv_router, adv_router, - sizeof(adv_router)); - inet_ntop(AF_INET, &e->id, id, sizeof(id)); - zlog_debug(" [%s Id:%s Adv:%s]", ospf6_lstype_name(e->type), - id, adv_router); + + zlog_debug(" [%s Id:%pI4 Adv:%pI4]", + ospf6_lstype_name(e->type), &e->id, &e->adv_router); } assert(p == OSPF6_MESSAGE_END(oh)); @@ -856,15 +844,11 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst, /* Find database copy */ lsa = ospf6_lsdb_lookup(e->type, e->id, e->adv_router, lsdb); if (lsa == NULL) { - char id[16], adv_router[16]; if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) { - inet_ntop(AF_INET, &e->id, id, sizeof(id)); - inet_ntop(AF_INET, &e->adv_router, adv_router, - sizeof(adv_router)); zlog_debug( - "Can't find requested [%s Id:%s Adv:%s]", - ospf6_lstype_name(e->type), id, - adv_router); + "Can't find requested [%s Id:%pI4 Adv:%pI4]", + ospf6_lstype_name(e->type), &e->id, + &e->adv_router); } thread_add_event(master, bad_lsreq, on, 0, NULL); return; @@ -1321,7 +1305,6 @@ static int ospf6_rxpacket_examin(struct ospf6_interface *oi, struct ospf6_header *oh, const unsigned bytesonwire) { - char buf[2][INET_ADDRSTRLEN]; if (MSG_OK != ospf6_packet_examin(oh, bytesonwire)) return MSG_NG; @@ -1335,13 +1318,10 @@ static int ospf6_rxpacket_examin(struct ospf6_interface *oi, oi->interface->name); else zlog_warn( - "VRF %s: I/F %s Area-ID mismatch (my %s, rcvd %s)", + "VRF %s: I/F %s Area-ID mismatch (my %pI4, rcvd %pI4)", vrf_id_to_name(oi->interface->vrf_id), - oi->interface->name, - inet_ntop(AF_INET, &oi->area->area_id, buf[0], - INET_ADDRSTRLEN), - inet_ntop(AF_INET, &oh->area_id, buf[1], - INET_ADDRSTRLEN)); + oi->interface->name, &oi->area->area_id, + &oh->area_id); return MSG_NG; } @@ -1356,11 +1336,9 @@ static int ospf6_rxpacket_examin(struct ospf6_interface *oi, /* Router-ID check */ if (oh->router_id == oi->area->ospf6->router_id) { - zlog_warn("VRF %s: I/F %s Duplicate Router-ID (%s)", + zlog_warn("VRF %s: I/F %s Duplicate Router-ID (%pI4)", vrf_id_to_name(oi->interface->vrf_id), - oi->interface->name, - inet_ntop(AF_INET, &oh->router_id, buf[0], - INET_ADDRSTRLEN)); + oi->interface->name, &oh->router_id); return MSG_NG; } return MSG_OK; @@ -1541,7 +1519,6 @@ int ospf6_receive(struct thread *thread) { int sockfd; unsigned int len; - char srcname[64], dstname[64]; struct in6_addr src, dst; ifindex_t ifindex; struct iovec iovector[2]; @@ -1598,13 +1575,11 @@ int ospf6_receive(struct thread *thread) /* Log */ if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) { - inet_ntop(AF_INET6, &src, srcname, sizeof(srcname)); - inet_ntop(AF_INET6, &dst, dstname, sizeof(dstname)); zlog_debug("%s received on %s", lookup_msg(ospf6_message_type_str, oh->type, NULL), oi->interface->name); - zlog_debug(" src: %s", srcname); - zlog_debug(" dst: %s", dstname); + zlog_debug(" src: %pI6", &src); + zlog_debug(" dst: %pI6", &dst); switch (oh->type) { case OSPF6_MESSAGE_TYPE_HELLO: @@ -1659,7 +1634,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst, struct ospf6_interface *oi, struct ospf6_header *oh) { unsigned int len; - char srcname[64], dstname[64]; + char srcname[64]; struct iovec iovector[2]; /* initialize */ @@ -1680,7 +1655,6 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst, /* Log */ if (IS_OSPF6_DEBUG_MESSAGE(oh->type, SEND)) { - inet_ntop(AF_INET6, dst, dstname, sizeof(dstname)); if (src) inet_ntop(AF_INET6, src, srcname, sizeof(srcname)); else @@ -1689,7 +1663,7 @@ static void ospf6_send(struct in6_addr *src, struct in6_addr *dst, lookup_msg(ospf6_message_type_str, oh->type, NULL), oi->interface->name); zlog_debug(" src: %s", srcname); - zlog_debug(" dst: %s", dstname); + zlog_debug(" dst: %pI6", dst); switch (oh->type) { case OSPF6_MESSAGE_TYPE_HELLO: diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 2b7072d34f..9b9453ce24 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -96,13 +96,9 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS) return 0; o->router_id_zebra = router_id.u.prefix4; - if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { - char buf[INET_ADDRSTRLEN]; - - zlog_debug("%s: zebra router-id %s update", __func__, - inet_ntop(AF_INET, &router_id.u.prefix4, buf, - INET_ADDRSTRLEN)); - } + if (IS_OSPF6_DEBUG_ZEBRA(RECV)) + zlog_debug("%s: zebra router-id %pI4 update", __func__, + &router_id.u.prefix4); ospf6_router_id_update(o); diff --git a/pimd/pim_igmp_mtrace.c b/pimd/pim_igmp_mtrace.c index 941d067619..5223fcf311 100644 --- a/pimd/pim_igmp_mtrace.c +++ b/pimd/pim_igmp_mtrace.c @@ -66,7 +66,6 @@ static bool mtrace_fwd_info_weak(struct pim_instance *pim, struct pim_nexthop nexthop; struct interface *ifp_in; struct in_addr nh_addr; - char nexthop_str[INET_ADDRSTRLEN]; nh_addr.s_addr = INADDR_ANY; @@ -82,10 +81,8 @@ static bool mtrace_fwd_info_weak(struct pim_instance *pim, zlog_debug("mtrace pim_nexthop_lookup OK"); if (PIM_DEBUG_MTRACE) - zlog_debug("mtrace next_hop=%s", - inet_ntop(nexthop.mrib_nexthop_addr.family, - &nexthop.mrib_nexthop_addr.u.prefix, - nexthop_str, sizeof(nexthop_str))); + zlog_debug("mtrace next_hop=%pI4", + &nexthop.mrib_nexthop_addr.u.prefix4); if (nexthop.mrib_nexthop_addr.family == AF_INET) nh_addr = nexthop.mrib_nexthop_addr.u.prefix4; @@ -114,7 +111,6 @@ static bool mtrace_fwd_info(struct pim_instance *pim, struct interface *ifp_in; struct in_addr nh_addr; uint32_t total; - char up_str[INET_ADDRSTRLEN]; memset(&sg, 0, sizeof(struct prefix_sg)); sg.src = mtracep->src_addr; @@ -142,9 +138,7 @@ static bool mtrace_fwd_info(struct pim_instance *pim, total = htonl(MTRACE_UNKNOWN_COUNT); if (PIM_DEBUG_MTRACE) - zlog_debug("fwd_info: upstream next hop=%s", - inet_ntop(AF_INET, &(nh_addr), up_str, - sizeof(up_str))); + zlog_debug("fwd_info: upstream next hop=%pI4", &nh_addr); if (up->channel_oil) total = up->channel_oil->cc.pktcnt; @@ -198,31 +192,16 @@ static void mtrace_rsp_init(struct igmp_mtrace_rsp *mtrace_rspp) static void mtrace_rsp_debug(uint32_t qry_id, int rsp, struct igmp_mtrace_rsp *mrspp) { - char inc_str[INET_ADDRSTRLEN]; - char out_str[INET_ADDRSTRLEN]; - char prv_str[INET_ADDRSTRLEN]; - zlog_debug( - "Rx mt(%d) qid=%ud arr=%x in=%s out=%s prev=%s proto=%d fwd=%d", - rsp, ntohl(qry_id), mrspp->arrival, - inet_ntop(AF_INET, &(mrspp->incoming), inc_str, - sizeof(inc_str)), - inet_ntop(AF_INET, &(mrspp->outgoing), out_str, - sizeof(out_str)), - inet_ntop(AF_INET, &(mrspp->prev_hop), prv_str, - sizeof(prv_str)), - mrspp->rtg_proto, mrspp->fwd_code); + "Rx mt(%d) qid=%ud arr=%x in=%pI4 out=%pI4 prev=%pI4 proto=%d fwd=%d", + rsp, ntohl(qry_id), mrspp->arrival, &mrspp->incoming, + &mrspp->outgoing, &mrspp->prev_hop, mrspp->rtg_proto, + mrspp->fwd_code); } static void mtrace_debug(struct pim_interface *pim_ifp, struct igmp_mtrace *mtracep, int mtrace_len) { - char inc_str[INET_ADDRSTRLEN]; - char grp_str[INET_ADDRSTRLEN]; - char src_str[INET_ADDRSTRLEN]; - char dst_str[INET_ADDRSTRLEN]; - char rsp_str[INET_ADDRSTRLEN]; - struct in_addr ga, sa, da, ra; ga = mtracep->grp_addr; @@ -231,19 +210,10 @@ static void mtrace_debug(struct pim_interface *pim_ifp, ra = mtracep->rsp_addr; zlog_debug( - "Rx mtrace packet incoming on %s: hops=%d type=%d size=%d, grp=%s, src=%s, dst=%s rsp=%s ttl=%d qid=%ud", - inet_ntop(AF_INET, &(pim_ifp->primary_address), inc_str, - sizeof(inc_str)), - mtracep->hops, mtracep->type, mtrace_len, - inet_ntop(AF_INET, &ga, grp_str, - sizeof(grp_str)), - inet_ntop(AF_INET, &sa, src_str, - sizeof(src_str)), - inet_ntop(AF_INET, &da, dst_str, - sizeof(dst_str)), - inet_ntop(AF_INET, &ra, rsp_str, - sizeof(rsp_str)), - mtracep->rsp_ttl, ntohl(mtracep->qry_id)); + "Rx mtrace packet incoming on %pI4: hops=%d type=%d size=%d, grp=%pI4, src=%pI4, dst=%pI4 rsp=%pI4 ttl=%d qid=%ud", + &pim_ifp->primary_address, mtracep->hops, mtracep->type, + mtrace_len, &ga, &sa, &da, &ra, mtracep->rsp_ttl, + ntohl(mtracep->qry_id)); if (mtrace_len > (int)sizeof(struct igmp_mtrace)) { int i; @@ -290,8 +260,6 @@ static int mtrace_send_packet(struct interface *ifp, ssize_t sent; int ret; int fd; - char if_str[INET_ADDRSTRLEN]; - char rsp_str[INET_ADDRSTRLEN]; uint8_t ttl; memset(&to, 0, sizeof(to)); @@ -303,11 +271,8 @@ static int mtrace_send_packet(struct interface *ifp, struct in_addr if_addr; if_addr = mtrace_primary_address(ifp); - zlog_debug( - "Sending mtrace packet to %s on %s", - inet_ntop(AF_INET, &mtracep->rsp_addr, rsp_str, - sizeof(rsp_str)), - inet_ntop(AF_INET, &if_addr, if_str, sizeof(if_str))); + zlog_debug("Sending mtrace packet to %pI4 on %pI4", + &mtracep->rsp_addr, &if_addr); } fd = pim_socket_raw(IPPROTO_IGMP); @@ -514,7 +479,6 @@ static int mtrace_send_mc_response(struct pim_instance *pim, struct listnode *chnextnode; struct pim_ifchannel *ch = NULL; int ret = -1; - char buf[PREFIX_STRLEN]; memset(&sg, 0, sizeof(struct prefix_sg)); sg.grp = mtracep->rsp_addr; @@ -524,10 +488,8 @@ static int mtrace_send_mc_response(struct pim_instance *pim, if (c_oil == NULL) { if (PIM_DEBUG_MTRACE) { zlog_debug( - "Dropping mtrace multicast response packet len=%u to %s", - (unsigned int)mtrace_len, - inet_ntop(AF_INET, &mtracep->rsp_addr, - buf, sizeof(buf))); + "Dropping mtrace multicast response packet len=%u to %pI4", + (unsigned int)mtrace_len, &mtracep->rsp_addr); } return -1; } @@ -562,7 +524,6 @@ static int mtrace_send_response(struct pim_instance *pim, if (IPV4_CLASS_DE(ntohl(mtracep->rsp_addr.s_addr))) { struct pim_rpf *p_rpf; - char grp_str[INET_ADDRSTRLEN]; if (pim_rp_i_am_rp(pim, mtracep->rsp_addr)) return mtrace_send_mc_response(pim, mtracep, @@ -572,10 +533,8 @@ static int mtrace_send_response(struct pim_instance *pim, if (p_rpf == NULL) { if (PIM_DEBUG_MTRACE) - zlog_debug("mtrace no RP for %s", - inet_ntop(AF_INET, - &(mtracep->rsp_addr), - grp_str, sizeof(grp_str))); + zlog_debug("mtrace no RP for %pI4", + &mtracep->rsp_addr); return -1; } nexthop = p_rpf->source_nexthop; diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index ddd8dc6bf9..b613937f59 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -67,7 +67,6 @@ static int pim_msdp_sock_accept(struct thread *thread) int accept_sock; int msdp_sock; struct pim_msdp_peer *mp; - char buf[SU_ADDRSTRLEN]; sockunion_init(&su); @@ -96,8 +95,7 @@ static int pim_msdp_sock_accept(struct thread *thread) ++pim->msdp.rejected_accepts; if (PIM_DEBUG_MSDP_EVENTS) { flog_err(EC_PIM_MSDP_PACKET, - "msdp peer connection refused from %s", - sockunion2str(&su, buf, SU_ADDRSTRLEN)); + "msdp peer connection refused from %pSU", &su); } close(msdp_sock); return -1; @@ -113,8 +111,8 @@ static int pim_msdp_sock_accept(struct thread *thread) if (mp->fd >= 0) { if (PIM_DEBUG_MSDP_EVENTS) { zlog_notice( - "msdp peer new connection from %s stop old connection", - sockunion2str(&su, buf, SU_ADDRSTRLEN)); + "msdp peer new connection from %pSU stop old connection", + &su); } pim_msdp_peer_stop_tcp_conn(mp, true /* chg_state */); } diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index fed732b843..0095aed547 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -638,7 +638,6 @@ void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import, static int sharp_debug_nexthops(struct zapi_route *api) { int i; - char buf[PREFIX_STRLEN]; if (api->nexthop_num == 0) { zlog_debug( @@ -653,20 +652,16 @@ static int sharp_debug_nexthops(struct zapi_route *api) case NEXTHOP_TYPE_IPV4_IFINDEX: case NEXTHOP_TYPE_IPV4: zlog_debug( - " Nexthop %s, type: %d, ifindex: %d, vrf: %d, label_num: %d", - inet_ntop(AF_INET, &znh->gate.ipv4.s_addr, buf, - sizeof(buf)), - znh->type, znh->ifindex, znh->vrf_id, - znh->label_num); + " Nexthop %pI4, type: %d, ifindex: %d, vrf: %d, label_num: %d", + &znh->gate.ipv4.s_addr, znh->type, znh->ifindex, + znh->vrf_id, znh->label_num); break; case NEXTHOP_TYPE_IPV6_IFINDEX: case NEXTHOP_TYPE_IPV6: zlog_debug( - " Nexthop %s, type: %d, ifindex: %d, vrf: %d, label_num: %d", - inet_ntop(AF_INET6, &znh->gate.ipv6, buf, - sizeof(buf)), - znh->type, znh->ifindex, znh->vrf_id, - znh->label_num); + " Nexthop %pI6, type: %d, ifindex: %d, vrf: %d, label_num: %d", + &znh->gate.ipv6, znh->type, znh->ifindex, + znh->vrf_id, znh->label_num); break; case NEXTHOP_TYPE_IFINDEX: zlog_debug(" Nexthop IFINDEX: %d, ifindex: %d", diff --git a/zebra/connected.c b/zebra/connected.c index c885c533e6..dd8fab5e4e 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -321,11 +321,11 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr, if (IPV4_ADDR_SAME(addr, dest)) flog_warn( EC_ZEBRA_IFACE_SAME_LOCAL_AS_PEER, - "warning: interface %s has same local and peer address %pI4, routing protocols may malfunction", + "interface %s has same local and peer address %pI4, routing protocols may malfunction", ifp->name, addr); } else { zlog_debug( - "warning: %s called for interface %s with peer flag set, but no peer address supplied", + "%s called for interface %s with peer flag set, but no peer address supplied", __func__, ifp->name); UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER); } @@ -335,7 +335,7 @@ void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr, if (!dest && (prefixlen == IPV4_MAX_PREFIXLEN) && if_is_pointopoint(ifp)) zlog_debug( - "warning: PtP interface %s with addr %pI4/%d needs a peer address", + "PtP interface %s with addr %pI4/%d needs a peer address", ifp->name, addr, prefixlen); /* Label of this address. */ @@ -503,7 +503,7 @@ void connected_add_ipv6(struct interface *ifp, int flags, struct in6_addr *addr, } else { if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) { zlog_debug( - "warning: %s called for interface %s with peer flag set, but no peer address supplied", + "%s called for interface %s with peer flag set, but no peer address supplied", __func__, ifp->name); UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER); } diff --git a/zebra/redistribute.c b/zebra/redistribute.c index b0f124ed55..ac60d09ecc 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -542,7 +542,7 @@ void zebra_interface_address_add_update(struct interface *ifp, if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) flog_warn( EC_ZEBRA_ADVERTISING_UNUSABLE_ADDR, - "WARNING: advertising address to clients that is not yet usable."); + "advertising address to clients that is not yet usable."); zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 1); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 93961686fd..fdeef2c88c 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -2839,7 +2839,6 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) vlanid_t vid = 0; struct in_addr vtep_ip; int vid_present = 0, dst_present = 0; - char buf[ETHER_ADDR_STRLEN]; char vid_buf[20]; char dst_buf[30]; bool sticky; @@ -2918,11 +2917,10 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id) } if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug("Rx %s AF_BRIDGE IF %u%s st 0x%x fl 0x%x MAC %s%s nhg %d", + zlog_debug("Rx %s AF_BRIDGE IF %u%s st 0x%x fl 0x%x MAC %pEA%s nhg %d", nl_msg_type_to_str(h->nlmsg_type), ndm->ndm_ifindex, vid_present ? vid_buf : "", - ndm->ndm_state, ndm->ndm_flags, - prefix_mac2str(&mac, buf, sizeof(buf)), + ndm->ndm_state, ndm->ndm_flags, &mac, dst_present ? dst_buf : "", nhg_id); /* The interface should exist. */ @@ -3123,7 +3121,6 @@ static int netlink_request_specific_mac_in_bridge(struct zebra_ns *zns, char buf[256]; } req; struct zebra_if *br_zif; - char buf[ETHER_ADDR_STRLEN]; memset(&req, 0, sizeof(req)); req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)); @@ -3142,11 +3139,10 @@ static int netlink_request_specific_mac_in_bridge(struct zebra_ns *zns, if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "%s: Tx family %s IF %s(%u) vrf %s(%u) MAC %s vid %u", + "%s: Tx family %s IF %s(%u) vrf %s(%u) MAC %pEA vid %u", __func__, nl_family_to_str(req.ndm.ndm_family), br_if->name, br_if->ifindex, - vrf_id_to_name(br_if->vrf_id), br_if->vrf_id, - prefix_mac2str(mac, buf, sizeof(buf)), vid); + vrf_id_to_name(br_if->vrf_id), br_if->vrf_id, mac, vid); return netlink_request(&zns->netlink_cmd, &req); } @@ -3231,8 +3227,6 @@ ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, void *data, SET_IPADDR_V4(&vtep_ip); if (IS_ZEBRA_DEBUG_KERNEL) { - char ipbuf[PREFIX_STRLEN]; - char buf[ETHER_ADDR_STRLEN]; char vid_buf[20]; const struct ethaddr *mac = dplane_ctx_mac_get_addr(ctx); @@ -3243,12 +3237,11 @@ ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, void *data, vid_buf[0] = '\0'; zlog_debug( - "Tx %s family %s IF %s(%u)%s %sMAC %s dst %s nhg %u%s%s%s%s%s", + "Tx %s family %s IF %s(%u)%s %sMAC %pEA dst %pIA nhg %u%s%s%s%s%s", nl_msg_type_to_str(cmd), nl_family_to_str(AF_BRIDGE), dplane_ctx_get_ifname(ctx), dplane_ctx_get_ifindex(ctx), vid_buf, dplane_ctx_mac_is_sticky(ctx) ? "sticky " : "", - prefix_mac2str(mac, buf, sizeof(buf)), - ipaddr2str(&vtep_ip, ipbuf, sizeof(ipbuf)), nhg_id, + mac, &vtep_ip, nhg_id, (update_flags & DPLANE_MAC_REMOTE) ? " rem" : "", (update_flags & DPLANE_MAC_WAS_STATIC) ? " clr_sync" : "", @@ -3309,7 +3302,6 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) struct ipaddr ip; struct vrf *vrf; char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; int mac_present = 0; bool is_ext; bool is_router; @@ -3415,11 +3407,11 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "Rx %s family %s IF %s(%u) vrf %s(%u) IP %s MAC %s state 0x%x flags 0x%x ext_flags 0x%x", + "Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA MAC %s state 0x%x flags 0x%x ext_flags 0x%x", nl_msg_type_to_str(h->nlmsg_type), nl_family_to_str(ndm->ndm_family), ifp->name, ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id, - ipaddr2str(&ip, buf2, sizeof(buf2)), + &ip, mac_present ? prefix_mac2str(&mac, buf, sizeof(buf)) : "", @@ -3451,11 +3443,11 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) } if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug("Rx %s family %s IF %s(%u) vrf %s(%u) IP %s", + zlog_debug("Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA", nl_msg_type_to_str(h->nlmsg_type), nl_family_to_str(ndm->ndm_family), ifp->name, ndm->ndm_ifindex, VRF_LOGNAME(vrf), ifp->vrf_id, - ipaddr2str(&ip, buf2, sizeof(buf2))); + &ip); /* Process the delete - it may result in re-adding the neighbor if it is * a valid "remote" neighbor. @@ -3582,14 +3574,11 @@ static int netlink_request_specific_neigh_in_vlan(struct zebra_ns *zns, nl_attr_put(&req.n, sizeof(req), NDA_DST, &ip->ip.addr, ipa_len); - if (IS_ZEBRA_DEBUG_KERNEL) { - char buf[INET6_ADDRSTRLEN]; - - zlog_debug("%s: Tx %s family %s IF %u IP %s flags 0x%x", + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: Tx %s family %s IF %u IP %pIA flags 0x%x", __func__, nl_msg_type_to_str(type), - nl_family_to_str(req.ndm.ndm_family), ifindex, - ipaddr2str(ip, buf, sizeof(buf)), req.n.nlmsg_flags); - } + nl_family_to_str(req.ndm.ndm_family), ifindex, ip, + req.n.nlmsg_flags); return netlink_request(&zns->netlink_cmd, &req); } @@ -3600,7 +3589,6 @@ int netlink_neigh_read_specific_ip(struct ipaddr *ip, int ret = 0; struct zebra_ns *zns; struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(vlan_if->vrf_id); - char buf[INET6_ADDRSTRLEN]; struct zebra_dplane_info dp_info; zns = zvrf->zns; @@ -3608,9 +3596,8 @@ int netlink_neigh_read_specific_ip(struct ipaddr *ip, zebra_dplane_info_from_zns(&dp_info, zns, true /*is_cmd*/); if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug("%s: neigh request IF %s(%u) IP %s vrf %s(%u)", - __func__, vlan_if->name, vlan_if->ifindex, - ipaddr2str(ip, buf, sizeof(buf)), + zlog_debug("%s: neigh request IF %s(%u) IP %pIA vrf %s(%u)", + __func__, vlan_if->name, vlan_if->ifindex, ip, vrf_id_to_name(vlan_if->vrf_id), vlan_if->vrf_id); ret = netlink_request_specific_neigh_in_vlan(zns, RTM_GETNEIGH, ip, @@ -3702,18 +3689,12 @@ static ssize_t netlink_neigh_update_ctx(const struct zebra_dplane_ctx *ctx, if (update_flags & DPLANE_NEIGH_SET_STATIC) ext_flags |= NTF_E_MH_PEER_SYNC; } - if (IS_ZEBRA_DEBUG_KERNEL) { - char buf[INET6_ADDRSTRLEN]; - char buf2[ETHER_ADDR_STRLEN]; - + if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug( - "Tx %s family %s IF %s(%u) Neigh %s MAC %s flags 0x%x state 0x%x %sext_flags 0x%x", + "Tx %s family %s IF %s(%u) Neigh %pIA MAC %pEA flags 0x%x state 0x%x %sext_flags 0x%x", nl_msg_type_to_str(cmd), nl_family_to_str(family), dplane_ctx_get_ifname(ctx), dplane_ctx_get_ifindex(ctx), - ipaddr2str(ip, buf, sizeof(buf)), - mac ? prefix_mac2str(mac, buf2, sizeof(buf2)) : "null", - flags, state, ext ? "ext " : "", ext_flags); - } + ip, mac, flags, state, ext ? "ext " : "", ext_flags); return netlink_neigh_update_msg_encode( ctx, cmd, mac, ip, true, family, RTN_UNICAST, flags, state, diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 82546ce188..4e63d08aca 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -3539,15 +3539,9 @@ mac_update_common(enum dplane_op_e op, int ret; struct zebra_dplane_ctx *ctx = NULL; - if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) { - char buf1[ETHER_ADDR_STRLEN], buf2[PREFIX_STRLEN]; - - zlog_debug("init mac ctx %s: mac %s, ifp %s, vtep %s", - dplane_op2str(op), - prefix_mac2str(mac, buf1, sizeof(buf1)), - ifp->name, - inet_ntop(AF_INET, &vtep_ip, buf2, sizeof(buf2))); - } + if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) + zlog_debug("init mac ctx %s: mac %pEA, ifp %s, vtep %pI4", + dplane_op2str(op), mac, ifp->name, &vtep_ip); ctx = dplane_ctx_alloc(); ctx->zd_op = op; @@ -3725,14 +3719,9 @@ neigh_update_internal(enum dplane_op_e op, struct zebra_dplane_ctx *ctx = NULL; struct zebra_ns *zns; - if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) { - char buf1[ETHER_ADDR_STRLEN], buf2[PREFIX_STRLEN]; - - zlog_debug("init neigh ctx %s: ifp %s, mac %s, ip %s", - dplane_op2str(op), ifp->name, - prefix_mac2str(mac, buf1, sizeof(buf1)), - ipaddr2str(ip, buf2, sizeof(buf2))); - } + if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) + zlog_debug("init neigh ctx %s: ifp %s, mac %pEA, ip %pIA", + dplane_op2str(op), ifp->name, mac, ip); ctx = dplane_ctx_alloc(); diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index d7076ccce6..27a5a07e48 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -447,8 +447,6 @@ int zebra_evpn_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, int zebra_evpn_gw_macip_del(struct interface *ifp, zebra_evpn_t *zevpn, struct ipaddr *ip) { - char buf1[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; zebra_neigh_t *n = NULL; zebra_mac_t *mac = NULL; @@ -461,11 +459,8 @@ int zebra_evpn_gw_macip_del(struct interface *ifp, zebra_evpn_t *zevpn, mac = zebra_evpn_mac_lookup(zevpn, &n->emac); if (!mac) { if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("MAC %s doesn't exist for neigh %s on VNI %u", - prefix_mac2str(&n->emac, - buf1, sizeof(buf1)), - ipaddr2str(ip, buf2, sizeof(buf2)), - zevpn->vni); + zlog_debug("MAC %pEA doesn't exist for neigh %pIA on VNI %u", + &n->emac, ip, zevpn->vni); return -1; } @@ -476,10 +471,9 @@ int zebra_evpn_gw_macip_del(struct interface *ifp, zebra_evpn_t *zevpn, /* only need to delete the entry from bgp if we sent it before */ if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP", + "%u:SVI %s(%u) VNI %u, sending GW MAC %pEA IP %pIA del to BGP", ifp->vrf_id, ifp->name, ifp->ifindex, zevpn->vni, - prefix_mac2str(&(n->emac), buf1, sizeof(buf1)), - ipaddr2str(ip, buf2, sizeof(buf2))); + &n->emac, ip); /* Remove neighbor from BGP. */ zebra_evpn_neigh_send_del_to_client(zevpn->vni, &n->ip, &n->emac, @@ -1321,7 +1315,6 @@ zebra_evpn_process_sync_macip_add(zebra_evpn_t *zevpn, struct ethaddr *macaddr, uint8_t flags, uint32_t seq, esi_t *esi) { struct sync_mac_ip_ctx ctx; - char macbuf[ETHER_ADDR_STRLEN]; char ipbuf[INET6_ADDRSTRLEN]; bool sticky; bool remote_gw; @@ -1334,9 +1327,9 @@ zebra_evpn_process_sync_macip_add(zebra_evpn_t *zevpn, struct ethaddr *macaddr, if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_NEIGH || IS_ZEBRA_DEBUG_EVPN_MH_MAC) zlog_debug( - "Ignore sync-macip vni %u mac %s%s%s%s%s", + "Ignore sync-macip vni %u mac %pEA%s%s%s%s", zevpn->vni, - prefix_mac2str(macaddr, macbuf, sizeof(macbuf)), + macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, ipbuf, sizeof(ipbuf)) @@ -1455,7 +1448,6 @@ void process_remote_macip_del(vni_t vni, struct ethaddr *macaddr, struct zebra_ns *zns; struct zebra_l2info_vxlan *vxl; struct zebra_vrf *zvrf; - char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; /* Locate EVPN hash entry - expected to exist. */ @@ -1485,9 +1477,8 @@ void process_remote_macip_del(vni_t vni, struct ethaddr *macaddr, if (n && !mac) { zlog_warn( - "Failed to locate MAC %s for neigh %s VNI %u upon remote MACIP DEL", - prefix_mac2str(macaddr, buf, sizeof(buf)), - ipaddr2str(ipaddr, buf1, sizeof(buf1)), vni); + "Failed to locate MAC %pEA for neigh %pIA VNI %u upon remote MACIP DEL", + macaddr, ipaddr, vni); return; } @@ -1503,8 +1494,8 @@ void process_remote_macip_del(vni_t vni, struct ethaddr *macaddr, if (CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL) && CHECK_FLAG(mac->flags, ZEBRA_MAC_DEF_GW)) { zlog_warn( - "Ignore remote MACIP DEL VNI %u MAC %s%s%s as MAC is already configured as gateway MAC", - vni, prefix_mac2str(macaddr, buf, sizeof(buf)), + "Ignore remote MACIP DEL VNI %u MAC %pEA%s%s as MAC is already configured as gateway MAC", + vni, macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, buf1, sizeof(buf1)) : ""); return; @@ -1525,11 +1516,8 @@ void process_remote_macip_del(vni_t vni, struct ethaddr *macaddr, && CHECK_FLAG(mac->flags, ZEBRA_MAC_REMOTE)) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: MAC %s (flags 0x%x) is remote and duplicate, read kernel for local entry", - __func__, - prefix_mac2str(macaddr, buf, - sizeof(buf)), - mac->flags); + "%s: MAC %pEA (flags 0x%x) is remote and duplicate, read kernel for local entry", + __func__, macaddr, mac->flags); macfdb_read_specific_mac(zns, zif->brslave_info.br_if, macaddr, vxl->access_vlan); } diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index 142a199bd7..b36e8034b7 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -384,7 +384,6 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) zebra_evpn_t *zevpn = NULL; struct listnode *node = NULL; zebra_neigh_t *nbr = NULL; - char buf[ETHER_ADDR_STRLEN]; mac = THREAD_ARG(t); @@ -405,9 +404,8 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: duplicate addr mac %s flags %slearn count %u host count %u auto recovery expired", - __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "%s: duplicate addr mac %pEA flags %slearn count %u host count %u auto recovery expired", + __func__, &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), mac->dad_count, listcount(mac->neigh_list)); @@ -466,8 +464,6 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, zebra_neigh_t *nbr; struct listnode *node = NULL; struct timeval elapsed = {0, 0}; - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; bool reset_params = false; if (!(zebra_evpn_do_dup_addr_detect(zvrf) && do_dad)) @@ -482,9 +478,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: duplicate addr MAC %s flags %sskip update to client, learn count %u recover time %u", - __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "%s: duplicate addr MAC %pEA flags %sskip update to client, learn count %u recover time %u", + __func__, &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), mac->dad_count, zvrf->dad_freeze_time); @@ -520,9 +515,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: duplicate addr MAC %s flags %sdetection time passed, reset learn count %u", - __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "%s: duplicate addr MAC %pEA flags %sdetection time passed, reset learn count %u", + __func__, &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), mac->dad_count); @@ -552,9 +546,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, if (mac->dad_count >= zvrf->dad_max_moves) { flog_warn(EC_ZEBRA_DUP_MAC_DETECTED, - "VNI %u: MAC %s detected as duplicate during %s VTEP %pI4", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "VNI %u: MAC %pEA detected as duplicate during %s VTEP %pI4", + mac->zevpn->vni, &mac->macaddr, is_local ? "local update, last" : "remote update, from", &vtep_ip); @@ -577,11 +570,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, nbr->dad_dup_detect_time = monotime(NULL); flog_warn(EC_ZEBRA_DUP_IP_INHERIT_DETECTED, - "VNI %u: MAC %s IP %s detected as duplicate during %s update, inherit duplicate from MAC", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, - buf, sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), + "VNI %u: MAC %pEA IP %pIA detected as duplicate during %s update, inherit duplicate from MAC", + mac->zevpn->vni, &mac->macaddr, &nbr->ip, is_local ? "local" : "remote"); } @@ -592,10 +582,8 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: duplicate addr MAC %s flags %sauto recovery time %u start", - __func__, - prefix_mac2str(&mac->macaddr, buf, - sizeof(buf)), + "%s: duplicate addr MAC %pEA flags %sauto recovery time %u start", + __func__, &mac->macaddr, zebra_evpn_zebra_mac_flag_dump( mac, mac_buf, sizeof(mac_buf)), zvrf->dad_freeze_time); @@ -1004,8 +992,6 @@ int zebra_evpn_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr, uint32_t seq, int state, struct zebra_evpn_es *es, uint16_t cmd) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; int ipa_len; struct zserv *client = NULL; struct stream *s = NULL; @@ -1050,12 +1036,11 @@ int zebra_evpn_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr, char flag_buf[MACIP_BUF_SIZE]; zlog_debug( - "Send MACIP %s f %s MAC %s IP %s seq %u L2-VNI %u ESI %s to %s", + "Send MACIP %s f %s MAC %pEA IP %pIA seq %u L2-VNI %u ESI %s to %s", (cmd == ZEBRA_MACIP_ADD) ? "Add" : "Del", zclient_evpn_dump_macip_flags(flags, flag_buf, sizeof(flag_buf)), - prefix_mac2str(macaddr, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), seq, vni, + macaddr, ip, seq, vni, es ? es->esi_str : "-", zebra_route_string(client->proto)); } @@ -1129,11 +1114,10 @@ zebra_mac_t *zebra_evpn_mac_add(zebra_evpn_t *zevpn, struct ethaddr *macaddr) mac->uptime = monotime(NULL); if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) { - char buf[ETHER_ADDR_STRLEN]; char mac_buf[MAC_BUF_SIZE]; - zlog_debug("%s: MAC %s flags %s", __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + zlog_debug("%s: MAC %pEA flags %s", __func__, + &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); } @@ -1148,11 +1132,10 @@ int zebra_evpn_mac_del(zebra_evpn_t *zevpn, zebra_mac_t *mac) zebra_mac_t *tmp_mac; if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) { - char buf[ETHER_ADDR_STRLEN]; char mac_buf[MAC_BUF_SIZE]; - zlog_debug("%s: MAC %s flags %s", __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + zlog_debug("%s: MAC %pEA flags %s", __func__, + &mac->macaddr, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); } @@ -1201,12 +1184,11 @@ static bool zebra_evpn_check_mac_del_from_db(struct mac_walk_ctx *wctx, else if ((wctx->flags & DEL_LOCAL_MAC) && (mac->flags & ZEBRA_MAC_AUTO) && !listcount(mac->neigh_list)) { if (IS_ZEBRA_DEBUG_VXLAN) { - char buf[ETHER_ADDR_STRLEN]; char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s: Del MAC %s flags %s", __func__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "%s: Del MAC %pEA flags %s", __func__, + &mac->macaddr, zebra_evpn_zebra_mac_flag_dump( mac, mac_buf, sizeof(mac_buf))); } @@ -1471,7 +1453,6 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) bool new_bgp_ready; bool old_static; bool new_static; - char macbuf[ETHER_ADDR_STRLEN]; mac = THREAD_ARG(t); /* the purpose of the hold timer is to age out the peer-active @@ -1490,9 +1471,8 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac vni %u mac %s es %s %shold expired", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)), + "sync-mac vni %u mac %pEA es %s %shold expired", + mac->zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); @@ -1516,8 +1496,6 @@ static int zebra_evpn_mac_hold_exp_cb(struct thread *t) static inline void zebra_evpn_mac_start_hold_timer(zebra_mac_t *mac) { - char macbuf[ETHER_ADDR_STRLEN]; - if (mac->hold_timer) return; @@ -1525,9 +1503,8 @@ static inline void zebra_evpn_mac_start_hold_timer(zebra_mac_t *mac) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac vni %u mac %s es %s %shold started", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)), + "sync-mac vni %u mac %pEA es %s %shold started", + mac->zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); @@ -1538,8 +1515,6 @@ static inline void zebra_evpn_mac_start_hold_timer(zebra_mac_t *mac) void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac) { - char macbuf[ETHER_ADDR_STRLEN]; - if (!mac->hold_timer) return; @@ -1547,9 +1522,8 @@ void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac vni %u mac %s es %s %shold stopped", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)), + "sync-mac vni %u mac %pEA es %s %shold stopped", + mac->zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); @@ -1560,7 +1534,6 @@ void zebra_evpn_mac_stop_hold_timer(zebra_mac_t *mac) void zebra_evpn_sync_mac_del(zebra_mac_t *mac) { - char macbuf[ETHER_ADDR_STRLEN]; bool old_static; bool new_static; @@ -1568,9 +1541,8 @@ void zebra_evpn_sync_mac_del(zebra_mac_t *mac) char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac del vni %u mac %s es %s seq %d f %s", - mac->zevpn->vni, - prefix_mac2str(&mac->macaddr, macbuf, sizeof(macbuf)), + "sync-mac del vni %u mac %pEA es %s seq %d f %s", + mac->zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); @@ -1595,7 +1567,6 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(zebra_evpn_t *zevpn, struct ipaddr *ipaddr, bool sync) { - char macbuf[ETHER_ADDR_STRLEN]; char ipbuf[INET6_ADDRSTRLEN]; uint32_t tmp_seq; const char *n_type; @@ -1620,11 +1591,10 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(zebra_evpn_t *zevpn, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s-macip accept vni %u %s-mac %s%s%s lower seq %u f %s", + "%s-macip accept vni %u %s-mac %pEA%s%s lower seq %u f %s", sync ? "sync" : "rem", zevpn->vni, n_type, - prefix_mac2str(&mac->macaddr, macbuf, - sizeof(macbuf)), + &mac->macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, ipbuf, sizeof(ipbuf)) @@ -1641,10 +1611,9 @@ static inline bool zebra_evpn_mac_is_bgp_seq_ok(zebra_evpn_t *zevpn, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "%s-macip ignore vni %u %s-mac %s%s%s as existing has higher seq %u f %s", + "%s-macip ignore vni %u %s-mac %pEA%s%s as existing has higher seq %u f %s", sync ? "sync" : "rem", zevpn->vni, n_type, - prefix_mac2str(&mac->macaddr, macbuf, - sizeof(macbuf)), + &mac->macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, ipbuf, sizeof(ipbuf)) @@ -1671,7 +1640,6 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr, bool seq_change = false; bool es_change = false; uint32_t tmp_seq; - char macbuf[ETHER_ADDR_STRLEN]; char ipbuf[INET6_ADDRSTRLEN]; bool old_local = false; bool old_bgp_ready; @@ -1719,10 +1687,8 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr, if (sticky || remote_gw) { if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "Ignore sync-macip vni %u mac %s%s%s%s%s", - zevpn->vni, - prefix_mac2str(macaddr, macbuf, - sizeof(macbuf)), + "Ignore sync-macip vni %u mac %pEA%s%s%s%s", + zevpn->vni, macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, ipbuf, sizeof(ipbuf)) @@ -1789,9 +1755,8 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr, omac.flags = old_flags; zlog_debug( - "sync-mac vni %u mac %s old_f %snew_f %s", - zevpn->vni, - prefix_mac2str(macaddr, macbuf, sizeof(macbuf)), + "sync-mac vni %u mac %pEA old_f %snew_f %s", + zevpn->vni, macaddr, zebra_evpn_zebra_mac_flag_dump( &omac, omac_buf, sizeof(omac_buf)), zebra_evpn_zebra_mac_flag_dump( @@ -1834,9 +1799,9 @@ zebra_evpn_proc_sync_mac_update(zebra_evpn_t *zevpn, struct ethaddr *macaddr, if (IS_ZEBRA_DEBUG_EVPN_MH_MAC) { char mac_buf[MAC_BUF_SIZE]; - zlog_debug("sync-mac %s vni %u mac %s es %s seq %d f %s%s%s", - ctx->mac_created ? "created" : "updated", zevpn->vni, - prefix_mac2str(macaddr, macbuf, sizeof(macbuf)), + zlog_debug("sync-mac %s vni %u mac %pEA es %s seq %d f %s%s%s", + ctx->mac_created ? "created" : "updated", + zevpn->vni, macaddr, mac->es ? mac->es->esi_str : "-", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), @@ -2000,7 +1965,6 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, struct in_addr vtep_ip, uint8_t flags, uint32_t seq, esi_t *esi) { - char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; bool sticky; bool remote_gw; @@ -2023,9 +1987,8 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, && CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW)) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Ignore remote MACIP ADD VNI %u MAC %s%s%s as MAC is already configured as gateway MAC", - zevpn->vni, - prefix_mac2str(macaddr, buf, sizeof(buf)), + "Ignore remote MACIP ADD VNI %u MAC %pEA%s%s as MAC is already configured as gateway MAC", + zevpn->vni, macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(ipaddr, buf1, sizeof(buf1)) : ""); @@ -2050,10 +2013,8 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, mac = zebra_evpn_mac_add(zevpn, macaddr); if (!mac) { zlog_warn( - "Failed to add MAC %s VNI %u Remote VTEP %pI4", - prefix_mac2str(macaddr, buf, - sizeof(buf)), - zevpn->vni, &vtep_ip); + "Failed to add MAC %pEA VNI %u Remote VTEP %pI4", + macaddr, zevpn->vni, &vtep_ip); return -1; } @@ -2112,10 +2073,8 @@ int process_mac_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "sync-mac->remote vni %u mac %s es %s seq %d f %s", - zevpn->vni, - prefix_mac2str(macaddr, buf, - sizeof(buf)), + "sync-mac->remote vni %u mac %pEA es %s seq %d f %s", + zevpn->vni, macaddr, mac->es ? mac->es->esi_str : "-", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump( @@ -2173,7 +2132,6 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, bool sticky, bool local_inactive, bool dp_static, zebra_mac_t *mac) { - char buf[ETHER_ADDR_STRLEN]; bool mac_sticky = false; bool inform_client = false; bool upd_neigh = false; @@ -2194,9 +2152,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, if (!mac) { if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_MAC) zlog_debug( - "ADD %sMAC %s intf %s(%u) VID %u -> VNI %u%s", - sticky ? "sticky " : "", - prefix_mac2str(macaddr, buf, sizeof(buf)), + "ADD %sMAC %pEA intf %s(%u) VID %u -> VNI %u%s", + sticky ? "sticky " : "", macaddr, ifp->name, ifp->ifindex, vid, zevpn->vni, local_inactive ? " local-inactive" : ""); @@ -2204,9 +2161,9 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, if (!mac) { flog_err( EC_ZEBRA_MAC_ADD_FAILED, - "Failed to add MAC %s intf %s(%u) VID %u VNI %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), - ifp->name, ifp->ifindex, vid, zevpn->vni); + "Failed to add MAC %pEA intf %s(%u) VID %u VNI %u", + macaddr, ifp->name, ifp->ifindex, vid, + zevpn->vni); return -1; } SET_FLAG(mac->flags, ZEBRA_MAC_LOCAL); @@ -2219,9 +2176,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "UPD %sMAC %s intf %s(%u) VID %u -> VNI %u %scurFlags %s", - sticky ? "sticky " : "", - prefix_mac2str(macaddr, buf, sizeof(buf)), + "UPD %sMAC %pEA intf %s(%u) VID %u -> VNI %u %scurFlags %s", + sticky ? "sticky " : "", macaddr, ifp->name, ifp->ifindex, vid, zevpn->vni, local_inactive ? "local-inactive " : "", zebra_evpn_zebra_mac_flag_dump( @@ -2254,13 +2210,11 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, && dp_static == old_static && !es_change) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - " Add/Update %sMAC %s intf %s(%u) VID %u -> VNI %u%s, " + " Add/Update %sMAC %pEA intf %s(%u) VID %u -> VNI %u%s, " "entry exists and has not changed ", - sticky ? "sticky " : "", - prefix_mac2str(macaddr, buf, - sizeof(buf)), - ifp->name, ifp->ifindex, vid, - zevpn->vni, + sticky ? "sticky " : "", + macaddr, ifp->name, + ifp->ifindex, vid, zevpn->vni, local_inactive ? " local_inactive" : ""); @@ -2315,9 +2269,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, if (CHECK_FLAG(mac->flags, ZEBRA_MAC_STICKY)) { flog_warn( EC_ZEBRA_STICKY_MAC_ALREADY_LEARNT, - "MAC %s already learnt as remote sticky MAC behind VTEP %pI4 VNI %u", - prefix_mac2str(macaddr, buf, - sizeof(buf)), + "MAC %pEA already learnt as remote sticky MAC behind VTEP %pI4 VNI %u", + macaddr, &mac->fwd_info.r_vtep_ip, zevpn->vni); return 0; @@ -2382,9 +2335,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "local mac vni %u mac %s es %s seq %d f %s%s", - zevpn->vni, - prefix_mac2str(macaddr, buf, sizeof(buf)), + "local mac vni %u mac %pEA es %s seq %d f %s%s", + zevpn->vni, macaddr, mac->es ? mac->es->esi_str : "", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf)), @@ -2422,14 +2374,12 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, int zebra_evpn_del_local_mac(zebra_evpn_t *zevpn, zebra_mac_t *mac, bool clear_static) { - char buf[ETHER_ADDR_STRLEN]; bool old_bgp_ready; bool new_bgp_ready; if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("DEL MAC %s VNI %u seq %u flags 0x%x nbr count %u", - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - zevpn->vni, mac->loc_seq, mac->flags, + zlog_debug("DEL MAC %pEA VNI %u seq %u flags 0x%x nbr count %u", + &mac->macaddr, zevpn->vni, mac->loc_seq, mac->flags, listcount(mac->neigh_list)); old_bgp_ready = zebra_evpn_mac_is_ready_for_bgp(mac->flags); @@ -2443,9 +2393,8 @@ int zebra_evpn_del_local_mac(zebra_evpn_t *zevpn, zebra_mac_t *mac, char mac_buf[MAC_BUF_SIZE]; zlog_debug( - "re-add sync-mac vni %u mac %s es %s seq %d f %s", - zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "re-add sync-mac vni %u mac %pEA es %s seq %d f %s", + zevpn->vni, &mac->macaddr, mac->es ? mac->es->esi_str : "-", mac->loc_seq, zebra_evpn_zebra_mac_flag_dump( mac, mac_buf, sizeof(mac_buf))); @@ -2503,7 +2452,6 @@ int zebra_evpn_mac_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, struct ethaddr *macaddr, vlanid_t vlan_id, bool def_gw) { - char buf[ETHER_ADDR_STRLEN]; zebra_mac_t *mac; ns_id_t local_ns_id = NS_DEFAULT; struct zebra_vrf *zvrf; @@ -2517,9 +2465,8 @@ int zebra_evpn_mac_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, mac = zebra_evpn_mac_add(zevpn, macaddr); if (!mac) { flog_err(EC_ZEBRA_MAC_ADD_FAILED, - "Failed to add MAC %s intf %s(%u) VID %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), - ifp->name, ifp->ifindex, vlan_id); + "Failed to add MAC %pEA intf %s(%u) VID %u", + macaddr, ifp->name, ifp->ifindex, vlan_id); return -1; } } diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index dea0fea975..0e31617c4f 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -209,8 +209,6 @@ static void zebra_evpn_local_neigh_ref_mac(zebra_neigh_t *n, zebra_mac_t *mac, bool send_mac_update) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; bool old_static; bool new_static; @@ -228,11 +226,8 @@ static void zebra_evpn_local_neigh_ref_mac(zebra_neigh_t *n, new_static = zebra_evpn_mac_is_static(mac); if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync-neigh ref mac vni %u ip %s mac %s ref %d", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), + "sync-neigh ref mac vni %u ip %pIA mac %pEA ref %d", + n->zevpn->vni, &n->ip, &n->emac, mac->sync_neigh_cnt); if ((old_static != new_static) && send_mac_update) /* program the local mac in the kernel */ @@ -248,8 +243,6 @@ static void zebra_evpn_sync_neigh_dp_install(zebra_neigh_t *n, bool force_clear_static, const char *caller) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; struct zebra_ns *zns; struct interface *ifp; bool set_static; @@ -260,11 +253,8 @@ static void zebra_evpn_sync_neigh_dp_install(zebra_neigh_t *n, if (!ifp) { if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "%s: dp-install sync-neigh vni %u ip %s mac %s if %d f 0x%x skipped", - caller, n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), + "%s: dp-install sync-neigh vni %u ip %pIA mac %pEA if %d f 0x%x skipped", + caller, n->zevpn->vni, &n->ip, &n->emac, n->ifindex, n->flags); return; } @@ -282,10 +272,8 @@ static void zebra_evpn_sync_neigh_dp_install(zebra_neigh_t *n, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "%s: dp-install sync-neigh vni %u ip %s mac %s if %s(%d) f 0x%x%s%s%s", - caller, n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), + "%s: dp-install sync-neigh vni %u ip %pIA mac %pEA if %s(%d) f 0x%x%s%s%s", + caller, n->zevpn->vni, &n->ip, &n->emac, ifp->name, n->ifindex, n->flags, set_router ? " router" : "", set_static ? " static" : "", @@ -375,8 +363,6 @@ void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, zebra_mac_t *mac = n->mac; bool old_mac_static; bool new_mac_static; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; if (old_n_static == new_n_static) return; @@ -411,10 +397,9 @@ void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync-neigh ref-chg vni %u ip %s mac %s f 0x%x %d%s%s%s%s by %s", - n->zevpn->vni, ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags, mac->sync_neigh_cnt, + "sync-neigh ref-chg vni %u ip %pIA mac %pEA f 0x%x %d%s%s%s%s by %s", + n->zevpn->vni, &n->ip, &n->emac, n->flags, + mac->sync_neigh_cnt, old_n_static ? " old_n_static" : "", new_n_static ? " new_n_static" : "", old_mac_static ? " old_mac_static" : "", @@ -434,8 +419,6 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) bool new_bgp_ready; bool old_n_static; bool new_n_static; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; n = THREAD_ARG(t); /* the purpose of the hold timer is to age out the peer-active @@ -451,11 +434,8 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) new_n_static = zebra_evpn_neigh_is_static(n); if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh vni %u ip %s mac %s 0x%x hold expired", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x hold expired", + n->zevpn->vni, &n->ip, &n->emac, n->flags); /* re-program the local neigh in the dataplane if the neigh is no * longer static @@ -475,18 +455,12 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) static inline void zebra_evpn_neigh_start_hold_timer(zebra_neigh_t *n) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; - if (n->hold_timer) return; if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh vni %u ip %s mac %s 0x%x hold start", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x hold start", + n->zevpn->vni, &n->ip, &n->emac, n->flags); thread_add_timer(zrouter.master, zebra_evpn_neigh_hold_exp_cb, n, zmh_info->neigh_hold_time, &n->hold_timer); } @@ -496,8 +470,6 @@ static void zebra_evpn_local_neigh_deref_mac(zebra_neigh_t *n, { zebra_mac_t *mac = n->mac; zebra_evpn_t *zevpn = n->zevpn; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; bool old_static; bool new_static; @@ -511,11 +483,8 @@ static void zebra_evpn_local_neigh_deref_mac(zebra_neigh_t *n, new_static = zebra_evpn_mac_is_static(mac); if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync-neigh deref mac vni %u ip %s mac %s ref %d", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), + "sync-neigh deref mac vni %u ip %pIA mac %pEA ref %d", + n->zevpn->vni, &n->ip, &n->emac, mac->sync_neigh_cnt); if ((old_static != new_static) && send_mac_update) /* program the local mac in the kernel */ @@ -532,8 +501,6 @@ bool zebra_evpn_neigh_is_bgp_seq_ok(zebra_evpn_t *zevpn, zebra_neigh_t *n, struct ethaddr *macaddr, uint32_t seq, bool sync) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; uint32_t tmp_seq; const char *n_type; @@ -555,24 +522,18 @@ bool zebra_evpn_neigh_is_bgp_seq_ok(zebra_evpn_t *zevpn, zebra_neigh_t *n, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH || IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s-macip accept vni %u %s mac %s IP %s lower seq %u f 0x%x", + "%s-macip accept vni %u %s mac %pEA IP %pIA lower seq %u f 0x%x", sync ? "sync" : "remote", zevpn->vni, - n_type, - prefix_mac2str(macaddr, macbuf, - sizeof(macbuf)), - ipaddr2str(&n->ip, ipbuf, - sizeof(ipbuf)), + n_type, macaddr, &n->ip, tmp_seq, n->flags); return true; } if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH || IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s-macip ignore vni %u %s mac %s IP %s as existing has higher seq %u f 0x%x", + "%s-macip ignore vni %u %s mac %pEA IP %pIA as existing has higher seq %u f 0x%x", sync ? "sync" : "remote", zevpn->vni, n_type, - prefix_mac2str(macaddr, macbuf, sizeof(macbuf)), - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - tmp_seq, n->flags); + macaddr, &n->ip, tmp_seq, n->flags); return false; } @@ -636,15 +597,10 @@ void zebra_evpn_sync_neigh_del(zebra_neigh_t *n) { bool old_n_static; bool new_n_static; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh del vni %u ip %s mac %s f 0x%x", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh del vni %u ip %pIA mac %pEA f 0x%x", + n->zevpn->vni, &n->ip, &n->emac, n->flags); old_n_static = zebra_evpn_neigh_is_static(n); UNSET_FLAG(n->flags, ZEBRA_NEIGH_ES_PEER_PROXY); @@ -676,8 +632,6 @@ zebra_evpn_proc_sync_neigh_update(zebra_evpn_t *zevpn, zebra_neigh_t *n, bool old_mac_static; bool new_mac_static; bool set_dp_inactive = false; - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; bool created; ifindex_t ifindex = 0; @@ -778,11 +732,8 @@ zebra_evpn_proc_sync_neigh_update(zebra_evpn_t *zevpn, zebra_neigh_t *n, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH && (old_flags != n->flags)) zlog_debug( - "sync-neigh vni %u ip %s mac %s old_f 0x%x new_f 0x%x", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), + "sync-neigh vni %u ip %pIA mac %pEA old_f 0x%x new_f 0x%x", + n->zevpn->vni, &n->ip, &n->emac, old_flags, n->flags); new_n_static = zebra_evpn_neigh_is_static(n); @@ -844,10 +795,9 @@ zebra_evpn_proc_sync_neigh_update(zebra_evpn_t *zevpn, zebra_neigh_t *n, if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync-neigh %s vni %u ip %s mac %s if %s(%d) seq %d f 0x%x%s%s", + "sync-neigh %s vni %u ip %pIA mac %pEA if %s(%d) seq %d f 0x%x%s%s", created ? "created" : "updated", n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), + &n->ip, &n->emac, ifp ? ifp->name : "", ifindex, n->loc_seq, n->flags, inform_bgp ? " inform_bgp" : "", inform_dataplane ? " inform_dp" : ""); @@ -970,14 +920,13 @@ void zebra_evpn_process_neigh_on_local_mac_change(zebra_evpn_t *zevpn, zebra_neigh_t *n = NULL; struct listnode *node = NULL; struct zebra_vrf *zvrf = NULL; - char buf[ETHER_ADDR_STRLEN]; zvrf = vrf_info_lookup(zevpn->vxlan_if->vrf_id); if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Processing neighbors on local MAC %s %s, VNI %u", - prefix_mac2str(&zmac->macaddr, buf, sizeof(buf)), - seq_change ? "CHANGE" : "ADD", zevpn->vni); + zlog_debug("Processing neighbors on local MAC %pEA %s, VNI %u", + &zmac->macaddr, seq_change ? "CHANGE" : "ADD", + zevpn->vni); /* Walk all neighbors and mark any inactive local neighbors as * active and/or update sequence number upon a move, and inform BGP. @@ -1012,12 +961,10 @@ void zebra_evpn_process_neigh_on_local_mac_del(zebra_evpn_t *zevpn, { zebra_neigh_t *n = NULL; struct listnode *node = NULL; - char buf[ETHER_ADDR_STRLEN]; if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Processing neighbors on local MAC %s DEL, VNI %u", - prefix_mac2str(&zmac->macaddr, buf, sizeof(buf)), - zevpn->vni); + zlog_debug("Processing neighbors on local MAC %pEA DEL, VNI %u", + &zmac->macaddr, zevpn->vni); /* Walk all local neighbors and mark as inactive and inform * BGP, if needed. @@ -1047,12 +994,10 @@ void zebra_evpn_process_neigh_on_remote_mac_add(zebra_evpn_t *zevpn, { zebra_neigh_t *n = NULL; struct listnode *node = NULL; - char buf[ETHER_ADDR_STRLEN]; if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Processing neighbors on remote MAC %s ADD, VNI %u", - prefix_mac2str(&zmac->macaddr, buf, sizeof(buf)), - zevpn->vni); + zlog_debug("Processing neighbors on remote MAC %pEA ADD, VNI %u", + &zmac->macaddr, zevpn->vni); /* Walk all local neighbors and mark as inactive and inform * BGP, if needed. @@ -1085,15 +1030,11 @@ static inline void zebra_evpn_local_neigh_update_log( bool old_bgp_ready, bool new_bgp_ready, bool inform_dataplane, bool inform_bgp, const char *sfx) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; - if (!IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) return; - zlog_debug("%s neigh vni %u ip %s mac %s f 0x%x%s%s%s%s%s%s %s", pfx, - n->zevpn->vni, ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), n->flags, + zlog_debug("%s neigh vni %u ip %pIA mac %pEA f 0x%x%s%s%s%s%s%s %s", pfx, + n->zevpn->vni, &n->ip, &n->emac, n->flags, is_router ? " router" : "", local_inactive ? " local-inactive" : "", old_bgp_ready ? " old_bgp_ready" : "", @@ -1154,8 +1095,6 @@ static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) struct zebra_vrf *zvrf = NULL; zebra_neigh_t *nbr = NULL; zebra_evpn_t *zevpn = NULL; - char buf1[INET6_ADDRSTRLEN]; - char buf2[ETHER_ADDR_STRLEN]; nbr = THREAD_ARG(t); @@ -1174,10 +1113,8 @@ static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate addr MAC %s IP %s flags 0x%x learn count %u vni %u auto recovery expired", - __func__, - prefix_mac2str(&nbr->emac, buf2, sizeof(buf2)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), nbr->flags, + "%s: duplicate addr MAC %pEA IP %pIA flags 0x%x learn count %u vni %u auto recovery expired", + __func__, &nbr->emac, &nbr->ip, nbr->flags, nbr->dad_count, zevpn->vni); UNSET_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE); @@ -1207,8 +1144,6 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, { struct timeval elapsed = {0, 0}; - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; bool reset_params = false; if (!zebra_evpn_do_dup_addr_detect(zvrf)) @@ -1221,10 +1156,8 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE)) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate addr MAC %s IP %s flags 0x%x skip installing, learn count %u recover time %u", - __func__, - prefix_mac2str(&nbr->emac, buf, sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), + "%s: duplicate addr MAC %pEA IP %pIA flags 0x%x skip installing, learn count %u recover time %u", + __func__, &nbr->emac, &nbr->ip, nbr->flags, nbr->dad_count, zvrf->dad_freeze_time); @@ -1261,10 +1194,8 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, if (reset_params) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate addr MAC %s IP %s flags 0x%x detection time passed, reset learn count %u", - __func__, - prefix_mac2str(&nbr->emac, buf, sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), + "%s: duplicate addr MAC %pEA IP %pIA flags 0x%x detection time passed, reset learn count %u", + __func__, &nbr->emac, &nbr->ip, nbr->flags, nbr->dad_count); /* Reset learn count but do not start detection * during REMOTE learn event. @@ -1294,10 +1225,8 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, if (nbr->dad_count >= zvrf->dad_max_moves) { flog_warn( EC_ZEBRA_DUP_IP_DETECTED, - "VNI %u: MAC %s IP %s detected as duplicate during %s VTEP %pI4", - nbr->zevpn->vni, - prefix_mac2str(&nbr->emac, buf, sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, sizeof(buf1)), + "VNI %u: MAC %pEA IP %pIA detected as duplicate during %s VTEP %pI4", + nbr->zevpn->vni, &nbr->emac, &nbr->ip, is_local ? "local update, last" : "remote update, from", &vtep_ip); @@ -1311,12 +1240,8 @@ zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, if (zvrf->dad_freeze && zvrf->dad_freeze_time) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate addr MAC %s IP %s flags 0x%x auto recovery time %u start", - __func__, - prefix_mac2str(&nbr->emac, buf, - sizeof(buf)), - ipaddr2str(&nbr->ip, buf1, - sizeof(buf1)), + "%s: duplicate addr MAC %pEA IP %pIA flags 0x%x auto recovery time %u start", + __func__, &nbr->emac, &nbr->ip, nbr->flags, zvrf->dad_freeze_time); thread_add_timer(zrouter.master, @@ -1334,8 +1259,6 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, bool is_router, bool local_inactive, bool dp_static) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; struct zebra_vrf *zvrf; zebra_neigh_t *n = NULL; zebra_mac_t *zmac = NULL, *old_zmac = NULL; @@ -1357,15 +1280,12 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, if (!zmac) { /* create a dummy MAC if the MAC is not already present */ if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("AUTO MAC %s created for neigh %s on VNI %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), - zevpn->vni); + zlog_debug("AUTO MAC %pEA created for neigh %pIA on VNI %u", + macaddr, ip, zevpn->vni); zmac = zebra_evpn_mac_add(zevpn, macaddr); if (!zmac) { - zlog_debug("Failed to add MAC %s VNI %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), + zlog_debug("Failed to add MAC %pEA VNI %u", macaddr, zevpn->vni); return -1; } @@ -1402,10 +1322,9 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, if (!n) { flog_err( EC_ZEBRA_MAC_ADD_FAILED, - "Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u", - ipaddr2str(ip, buf2, sizeof(buf2)), - prefix_mac2str(macaddr, buf, sizeof(buf)), - ifp->name, ifp->ifindex, zevpn->vni); + "Failed to add neighbor %pIA MAC %pEA intf %s(%u) -> VNI %u", + ip, macaddr, ifp->name, ifp->ifindex, + zevpn->vni); return -1; } /* Set "local" forwarding info. */ @@ -1606,9 +1525,8 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, if (zebra_evpn_ip_inherit_dad_from_mac(zvrf, old_zmac, zmac, n)) { flog_warn( EC_ZEBRA_DUP_IP_INHERIT_DETECTED, - "VNI %u: MAC %s IP %s detected as duplicate during local update, inherit duplicate from MAC", - zevpn->vni, prefix_mac2str(macaddr, buf, sizeof(buf)), - ipaddr2str(&n->ip, buf2, sizeof(buf2))); + "VNI %u: MAC %pEA IP %pIA detected as duplicate during local update, inherit duplicate from MAC", + zevpn->vni, macaddr, &n->ip); } /* For IP Duplicate Address Detection (DAD) is trigger, @@ -1651,9 +1569,9 @@ int zebra_evpn_local_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, if (upd_mac_seq && zmac->loc_seq != mac_new_seq) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Seq changed for MAC %s VNI %u - old %u new %u", - prefix_mac2str(macaddr, buf, sizeof(buf)), - zevpn->vni, zmac->loc_seq, mac_new_seq); + "Seq changed for MAC %pEA VNI %u - old %u new %u", + macaddr, zevpn->vni, + zmac->loc_seq, mac_new_seq); zmac->loc_seq = mac_new_seq; if (zebra_evpn_mac_send_add_to_client(zevpn->vni, macaddr, zmac->flags, @@ -1682,8 +1600,6 @@ int zebra_evpn_remote_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, struct ipaddr *ip, struct ethaddr *macaddr, uint16_t state) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; zebra_neigh_t *n = NULL; zebra_mac_t *zmac = NULL; @@ -1708,10 +1624,8 @@ int zebra_evpn_remote_neigh_update(zebra_evpn_t *zevpn, struct interface *ifp, zmac = zebra_evpn_mac_lookup(zevpn, macaddr); if (!zmac || !CHECK_FLAG(zmac->flags, ZEBRA_MAC_REMOTE)) { zlog_debug( - "Ignore remote neigh %s (MAC %s) on L2-VNI %u - MAC unknown or local", - ipaddr2str(&n->ip, buf2, sizeof(buf2)), - prefix_mac2str(macaddr, buf, sizeof(buf)), - zevpn->vni); + "Ignore remote neigh %pIA (MAC %pEA) on L2-VNI %u - MAC unknown or local", + &n->ip, macaddr, zevpn->vni); return -1; } @@ -2140,8 +2054,6 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, { zebra_neigh_t *n; int update_neigh = 0; - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; zebra_mac_t *old_mac = NULL; bool old_static = false; bool do_dad = false; @@ -2167,11 +2079,9 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, mac, 0); if (!n) { zlog_warn( - "Failed to add Neigh %s MAC %s VNI %u Remote VTEP %pI4", - ipaddr2str(ipaddr, buf1, sizeof(buf1)), - prefix_mac2str(&mac->macaddr, buf, - sizeof(buf)), - zevpn->vni, &vtep_ip); + "Failed to add Neigh %pIA MAC %pEA VNI %u Remote VTEP %pI4", + ipaddr, &mac->macaddr, zevpn->vni, + &vtep_ip); return; } @@ -2192,12 +2102,8 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, old_static = zebra_evpn_neigh_is_static(n); if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "sync->remote neigh vni %u ip %s mac %s seq %d f0x%x", - n->zevpn->vni, - ipaddr2str(&n->ip, buf1, - sizeof(buf1)), - prefix_mac2str(&n->emac, buf, - sizeof(buf)), + "sync->remote neigh vni %u ip %pIA mac %pEA seq %d f0x%x", + n->zevpn->vni, &n->ip, &n->emac, seq, n->flags); zebra_evpn_neigh_clear_sync_info(n); if (IS_ZEBRA_NEIGH_ACTIVE(n)) @@ -2258,10 +2164,8 @@ void process_neigh_remote_macip_add(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, if (zebra_evpn_ip_inherit_dad_from_mac(zvrf, old_mac, mac, n)) { flog_warn( EC_ZEBRA_DUP_IP_INHERIT_DETECTED, - "VNI %u: MAC %s IP %s detected as duplicate during remote update, inherit duplicate from MAC", - zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - ipaddr2str(&n->ip, buf1, sizeof(buf1))); + "VNI %u: MAC %pEA IP %pIA detected as duplicate during remote update, inherit duplicate from MAC", + zevpn->vni, &mac->macaddr, &n->ip); } /* Check duplicate address detection for IP */ @@ -2280,8 +2184,6 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, struct ipaddr *ip, zebra_mac_t *mac) { zebra_neigh_t *n; - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; assert(mac); @@ -2291,9 +2193,8 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, if (!n) { flog_err( EC_ZEBRA_MAC_ADD_FAILED, - "Failed to add neighbor %s MAC %s intf %s(%u) -> VNI %u", - ipaddr2str(ip, buf2, sizeof(buf2)), - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), + "Failed to add neighbor %pIA MAC %pEA intf %s(%u) -> VNI %u", + ip, &mac->macaddr, ifp->name, ifp->ifindex, zevpn->vni); return -1; } @@ -2316,10 +2217,9 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "SVI %s(%u) L2-VNI %u, sending GW MAC %s IP %s add to BGP with flags 0x%x", + "SVI %s(%u) L2-VNI %u, sending GW MAC %pEA IP %pIA add to BGP with flags 0x%x", ifp->name, ifp->ifindex, zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), n->flags); + &mac->macaddr, ip, n->flags); zebra_evpn_neigh_send_add_to_client( zevpn->vni, ip, &n->emac, n->mac, n->flags, n->loc_seq); @@ -2328,10 +2228,9 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, zebra_evpn_t *zevpn, SET_FLAG(n->flags, ZEBRA_NEIGH_SVI_IP); if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "SVI %s(%u) L2-VNI %u, sending SVI MAC %s IP %s add to BGP with flags 0x%x", + "SVI %s(%u) L2-VNI %u, sending SVI MAC %pEA IP %pIA add to BGP with flags 0x%x", ifp->name, ifp->ifindex, zevpn->vni, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - ipaddr2str(ip, buf2, sizeof(buf2)), n->flags); + &mac->macaddr, ip, n->flags); zebra_evpn_neigh_send_add_to_client( zevpn->vni, ip, &n->emac, n->mac, n->flags, n->loc_seq); @@ -2344,8 +2243,6 @@ void zebra_evpn_neigh_remote_uninstall(zebra_evpn_t *zevpn, struct zebra_vrf *zvrf, zebra_neigh_t *n, zebra_mac_t *mac, struct ipaddr *ipaddr) { - char buf1[INET6_ADDRSTRLEN]; - if (zvrf->dad_freeze && CHECK_FLAG(n->flags, ZEBRA_NEIGH_DUPLICATE) && CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE) && (memcmp(n->emac.octet, mac->macaddr.octet, ETH_ALEN) == 0)) { @@ -2354,10 +2251,9 @@ void zebra_evpn_neigh_remote_uninstall(zebra_evpn_t *zevpn, vlan_if = zevpn_map_to_svi(zevpn); if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: IP %s (flags 0x%x intf %s) is remote and duplicate, read kernel for local entry", - __func__, - ipaddr2str(ipaddr, buf1, sizeof(buf1)), - n->flags, vlan_if ? vlan_if->name : "Unknown"); + "%s: IP %pIA (flags 0x%x intf %s) is remote and duplicate, read kernel for local entry", + __func__, ipaddr, n->flags, + vlan_if ? vlan_if->name : "Unknown"); if (vlan_if) neigh_read_specific_ip(ipaddr, vlan_if); } @@ -2384,8 +2280,6 @@ int zebra_evpn_neigh_del_ip(zebra_evpn_t *zevpn, struct ipaddr *ip) zebra_mac_t *zmac; bool old_bgp_ready; bool new_bgp_ready; - char buf[INET6_ADDRSTRLEN]; - char buf2[ETHER_ADDR_STRLEN]; struct zebra_vrf *zvrf; /* If entry doesn't exist, nothing to do. */ @@ -2397,9 +2291,8 @@ int zebra_evpn_neigh_del_ip(zebra_evpn_t *zevpn, struct ipaddr *ip) if (!zmac) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Trying to del a neigh %s without a mac %s on VNI %u", - ipaddr2str(ip, buf, sizeof(buf)), - prefix_mac2str(&n->emac, buf2, sizeof(buf2)), + "Trying to del a neigh %pIA without a mac %pEA on VNI %u", + ip, &n->emac, zevpn->vni); return 0; @@ -2419,10 +2312,8 @@ int zebra_evpn_neigh_del_ip(zebra_evpn_t *zevpn, struct ipaddr *ip) old_bgp_ready = zebra_evpn_neigh_is_ready_for_bgp(n); if (zebra_evpn_neigh_is_static(n)) { if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("re-add sync neigh vni %u ip %s mac %s 0x%x", - n->zevpn->vni, - ipaddr2str(&n->ip, buf, sizeof(buf)), - prefix_mac2str(&n->emac, buf2, sizeof(buf2)), + zlog_debug("re-add sync neigh vni %u ip %pIA mac %pEA 0x%x", + n->zevpn->vni, &n->ip, &n->emac, n->flags); if (!CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL_INACTIVE)) diff --git a/zebra/zebra_evpn_neigh.h b/zebra/zebra_evpn_neigh.h index eac17a09b4..05156c1255 100644 --- a/zebra/zebra_evpn_neigh.h +++ b/zebra/zebra_evpn_neigh.h @@ -167,18 +167,12 @@ static inline bool zebra_evpn_neigh_is_ready_for_bgp(zebra_neigh_t *n) static inline void zebra_evpn_neigh_stop_hold_timer(zebra_neigh_t *n) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; - if (!n->hold_timer) return; if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh vni %u ip %s mac %s 0x%x hold stop", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x hold stop", + n->zevpn->vni, &n->ip, &n->emac, n->flags); THREAD_OFF(n->hold_timer); } @@ -188,19 +182,13 @@ void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, static inline bool zebra_evpn_neigh_clear_sync_info(zebra_neigh_t *n) { - char macbuf[ETHER_ADDR_STRLEN]; - char ipbuf[INET6_ADDRSTRLEN]; bool old_n_static = false; bool new_n_static = false; if (n->flags & ZEBRA_NEIGH_ALL_PEER_FLAGS) { if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) - zlog_debug("sync-neigh vni %u ip %s mac %s 0x%x clear", - n->zevpn->vni, - ipaddr2str(&n->ip, ipbuf, sizeof(ipbuf)), - prefix_mac2str(&n->emac, macbuf, - sizeof(macbuf)), - n->flags); + zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x clear", + n->zevpn->vni, &n->ip, &n->emac, n->flags); old_n_static = zebra_evpn_neigh_is_static(n); UNSET_FLAG(n->flags, ZEBRA_NEIGH_ALL_PEER_FLAGS); diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 73534c4332..099ac1434b 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -1555,7 +1555,6 @@ static void zfpm_mac_info_del(struct fpm_mac_info_t *fpm_mac) static int zfpm_trigger_rmac_update(zebra_mac_t *rmac, zebra_l3vni_t *zl3vni, bool delete, const char *reason) { - char buf[ETHER_ADDR_STRLEN]; struct fpm_mac_info_t *fpm_mac, key; struct interface *vxlan_if, *svi_if; bool mac_found = false; @@ -1568,9 +1567,8 @@ static int zfpm_trigger_rmac_update(zebra_mac_t *rmac, zebra_l3vni_t *zl3vni, return 0; if (reason) { - zfpm_debug("triggering update to FPM - Reason: %s - %s", - reason, - prefix_mac2str(&rmac->macaddr, buf, sizeof(buf))); + zfpm_debug("triggering update to FPM - Reason: %s - %pEA", + reason, &rmac->macaddr); } vxlan_if = zl3vni_map_to_vxlan_if(zl3vni); diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index f7c5da5dec..cebd576365 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -500,9 +500,8 @@ static void zfpm_log_route_info(struct netlink_route_info *ri, unsigned int i; char buf[PREFIX_STRLEN]; - zfpm_debug("%s : %s %s, Proto: %s, Metric: %u", label, - nl_msg_type_to_str(ri->nlmsg_type), - prefix2str(ri->prefix, buf, sizeof(buf)), + zfpm_debug("%s : %s %pFX, Proto: %s, Metric: %u", label, + nl_msg_type_to_str(ri->nlmsg_type), ri->prefix, nl_rtproto_to_str(ri->rtm_protocol), ri->metric ? *ri->metric : 0); @@ -557,7 +556,6 @@ int zfpm_netlink_encode_route(int cmd, rib_dest_t *dest, struct route_entry *re, int zfpm_netlink_encode_mac(struct fpm_mac_info_t *mac, char *in_buf, size_t in_buf_len) { - char buf1[ETHER_ADDR_STRLEN]; size_t buf_offset; struct macmsg { @@ -600,11 +598,10 @@ int zfpm_netlink_encode_mac(struct fpm_mac_info_t *mac, char *in_buf, assert(req->hdr.nlmsg_len < in_buf_len); - zfpm_debug("Tx %s family %s ifindex %u MAC %s DEST %pI4", + zfpm_debug("Tx %s family %s ifindex %u MAC %pEA DEST %pI4", nl_msg_type_to_str(req->hdr.nlmsg_type), nl_family_to_str(req->ndm.ndm_family), req->ndm.ndm_ifindex, - prefix_mac2str(&mac->macaddr, buf1, sizeof(buf1)), - &mac->r_vtep_ip); + &mac->macaddr, &mac->r_vtep_ip); return req->hdr.nlmsg_len; } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 128edd9fd3..bc3c68638d 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -2830,8 +2830,10 @@ void _route_entry_dump(const char *func, union prefixconstptr pp, struct vrf *vrf = vrf_lookup_by_id(re->vrf_id); struct nexthop_group *nhg; + prefix2str(pp, straddr, sizeof(straddr)); + zlog_debug("%s: dumping RE entry %p for %s%s%s vrf %s(%u)", func, - (const void *)re, prefix2str(pp, straddr, sizeof(straddr)), + (const void *)re, straddr, is_srcdst ? " from " : "", is_srcdst ? prefix2str(src_pp, srcaddr, sizeof(srcaddr)) : "", diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 6cb8010364..e5efbe0d4a 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1226,7 +1226,6 @@ static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) */ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) { - char buf[ETHER_ADDR_STRLEN]; const struct zebra_if *zif = NULL, *br_zif; const struct zebra_l2info_vxlan *vxl = NULL; const struct interface *br_ifp; @@ -1240,10 +1239,8 @@ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac) if (!zl3vni->vxlan_if) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "RMAC %s on L3-VNI %u hash %p couldn't be uninstalled - no vxlan_if", - prefix_mac2str(&zrmac->macaddr, - buf, sizeof(buf)), - zl3vni->vni, zl3vni); + "RMAC %pEA on L3-VNI %u hash %p couldn't be uninstalled - no vxlan_if", + &zrmac->macaddr, zl3vni->vni, zl3vni); return -1; } @@ -1277,8 +1274,6 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, const struct ipaddr *vtep_ip, const struct prefix *host_prefix) { - char buf[ETHER_ADDR_STRLEN]; - char buf1[INET6_ADDRSTRLEN]; zebra_mac_t *zrmac = NULL; zrmac = zl3vni_rmac_lookup(zl3vni, rmac); @@ -1288,11 +1283,8 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, zrmac = zl3vni_rmac_add(zl3vni, rmac); if (!zrmac) { zlog_debug( - "Failed to add RMAC %s L3VNI %u Remote VTEP %s, prefix %pFX", - prefix_mac2str(rmac, buf, sizeof(buf)), - zl3vni->vni, - ipaddr2str(vtep_ip, buf1, sizeof(buf1)), - host_prefix); + "Failed to add RMAC %pEA L3VNI %u Remote VTEP %pIA, prefix %pFX", + rmac, zl3vni->vni, vtep_ip, host_prefix); return -1; } memset(&zrmac->fwd_info, 0, sizeof(zrmac->fwd_info)); @@ -1308,12 +1300,9 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, &vtep_ip->ipaddr_v4)) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "L3VNI %u Remote VTEP change(%pI4 -> %s) for RMAC %s, prefix %pFX", - zl3vni->vni, - &zrmac->fwd_info.r_vtep_ip, - ipaddr2str(vtep_ip, buf1, sizeof(buf1)), - prefix_mac2str(rmac, buf, sizeof(buf)), - host_prefix); + "L3VNI %u Remote VTEP change(%pI4 -> %pIA) for RMAC %pEA, prefix %pFX", + zl3vni->vni, &zrmac->fwd_info.r_vtep_ip, + vtep_ip, rmac, host_prefix); zrmac->fwd_info.r_vtep_ip = vtep_ip->ipaddr_v4; @@ -1470,9 +1459,6 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, const struct ethaddr *rmac, const struct prefix *host_prefix) { - char buf[ETHER_ADDR_STRLEN]; - char buf1[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; zebra_neigh_t *nh = NULL; /* Create the next hop entry, or update its mac, if necessary. */ @@ -1481,10 +1467,8 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, nh = zl3vni_nh_add(zl3vni, vtep_ip, rmac); if (!nh) { zlog_debug( - "Failed to add NH %s as Neigh (RMAC %s L3-VNI %u prefix %pFX)", - ipaddr2str(vtep_ip, buf1, sizeof(buf2)), - prefix_mac2str(rmac, buf, sizeof(buf)), - zl3vni->vni, host_prefix); + "Failed to add NH %pIA as Neigh (RMAC %pEA L3-VNI %u prefix %pFX)", + vtep_ip, rmac, zl3vni->vni, host_prefix); return -1; } @@ -1493,11 +1477,8 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, } else if (memcmp(&nh->emac, rmac, ETH_ALEN) != 0) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "L3VNI %u RMAC change(%s --> %s) for nexthop %s, prefix %pFX", - zl3vni->vni, - prefix_mac2str(&nh->emac, buf, sizeof(buf)), - prefix_mac2str(rmac, buf1, sizeof(buf1)), - ipaddr2str(vtep_ip, buf2, sizeof(buf2)), + "L3VNI %u RMAC change(%pEA --> %pEA) for nexthop %pIA, prefix %pFX", + zl3vni->vni, &nh->emac, rmac, vtep_ip, host_prefix); memcpy(&nh->emac, rmac, ETH_ALEN); @@ -1878,8 +1859,6 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni) struct zserv *client = NULL; struct ethaddr svi_rmac, vrr_rmac = {.octet = {0} }; struct zebra_vrf *zvrf; - char buf[ETHER_ADDR_STRLEN]; - char buf1[ETHER_ADDR_STRLEN]; bool is_anycast_mac = true; client = zserv_find_client(ZEBRA_ROUTE_BGP, 0); @@ -1920,11 +1899,9 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni) if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Send L3_VNI_ADD %u VRF %s RMAC %s VRR %s local-ip %pI4 filter %s to %s", + "Send L3_VNI_ADD %u VRF %s RMAC %pEA VRR %pEA local-ip %pI4 filter %s to %s", zl3vni->vni, vrf_id_to_name(zl3vni_vrf_id(zl3vni)), - prefix_mac2str(&svi_rmac, buf, sizeof(buf)), - prefix_mac2str(&vrr_rmac, buf1, sizeof(buf1)), - &zl3vni->local_vtep_ip, + &svi_rmac, &vrr_rmac, &zl3vni->local_vtep_ip, CHECK_FLAG(zl3vni->filter, PREFIX_ROUTES_ONLY) ? "prefix-routes-only" : "none", @@ -2138,7 +2115,6 @@ static void zl3vni_del_nh_hash_entry(struct hash_bucket *bucket, void *ctx) static int zebra_vxlan_readd_remote_rmac(zebra_l3vni_t *zl3vni, struct ethaddr *rmac) { - char buf[ETHER_ADDR_STRLEN]; zebra_mac_t *zrmac = NULL; zrmac = zl3vni_rmac_lookup(zl3vni, rmac); @@ -2146,8 +2122,8 @@ static int zebra_vxlan_readd_remote_rmac(zebra_l3vni_t *zl3vni, return 0; if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Del remote RMAC %s L3VNI %u - readd", - prefix_mac2str(rmac, buf, sizeof(buf)), zl3vni->vni); + zlog_debug("Del remote RMAC %pEA L3VNI %u - readd", + rmac, zl3vni->vni); zl3vni_rmac_install(zl3vni, zrmac); return 0; @@ -3667,7 +3643,6 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp, struct interface *link_if, struct ipaddr *ip) { - char buf[INET6_ADDRSTRLEN]; zebra_evpn_t *zevpn = NULL; zebra_l3vni_t *zl3vni = NULL; @@ -3685,9 +3660,8 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp, if (!zevpn) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: Del neighbor %s EVPN is not present for interface %s", - __func__, ipaddr2str(ip, buf, sizeof(buf)), - ifp->name); + "%s: Del neighbor %pIA EVPN is not present for interface %s", + __func__, ip, ifp->name); return 0; } @@ -3699,9 +3673,8 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp, } if (IS_ZEBRA_DEBUG_VXLAN) - zlog_debug("Del neighbor %s intf %s(%u) -> L2-VNI %u", - ipaddr2str(ip, buf, sizeof(buf)), ifp->name, - ifp->ifindex, zevpn->vni); + zlog_debug("Del neighbor %pIA intf %s(%u) -> L2-VNI %u", + ip, ifp->name, ifp->ifindex, zevpn->vni); return zebra_evpn_neigh_del_ip(zevpn, ip); } @@ -3721,8 +3694,6 @@ int zebra_vxlan_handle_kernel_neigh_update(struct interface *ifp, bool is_router, bool local_inactive, bool dp_static) { - char buf[ETHER_ADDR_STRLEN]; - char buf2[INET6_ADDRSTRLEN]; zebra_evpn_t *zevpn = NULL; zebra_l3vni_t *zl3vni = NULL; @@ -3742,9 +3713,8 @@ int zebra_vxlan_handle_kernel_neigh_update(struct interface *ifp, if (IS_ZEBRA_DEBUG_VXLAN || IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug( - "Add/Update neighbor %s MAC %s intf %s(%u) state 0x%x %s%s%s%s-> L2-VNI %u", - ipaddr2str(ip, buf2, sizeof(buf2)), - prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name, + "Add/Update neighbor %pIA MAC %pEA intf %s(%u) state 0x%x %s%s%s%s-> L2-VNI %u", + ip, macaddr, ifp->name, ifp->ifindex, state, is_ext ? "ext-learned " : "", is_router ? "router " : "", local_inactive ? "local_inactive " : "", @@ -3822,7 +3792,6 @@ void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS) struct ipaddr ip; struct in_addr vtep_ip; uint16_t l = 0, ipa_len; - char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; memset(&macaddr, 0, sizeof(struct ethaddr)); @@ -3842,9 +3811,8 @@ void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS) l += res_length; if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Recv MACIP DEL VNI %u MAC %s%s%s Remote VTEP %pI4 from %s", - vni, - prefix_mac2str(&macaddr, buf, sizeof(buf)), + "Recv MACIP DEL VNI %u MAC %pEA%s%s Remote VTEP %pI4 from %s", + vni, &macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(&ip, buf1, sizeof(buf1)) : "", @@ -3872,7 +3840,6 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS) uint16_t l = 0, ipa_len; uint8_t flags = 0; uint32_t seq; - char buf[ETHER_ADDR_STRLEN]; char buf1[INET6_ADDRSTRLEN]; esi_t esi; char esi_buf[ESI_STR_LEN]; @@ -3903,11 +3870,10 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS) else strlcpy(esi_buf, "-", ESI_STR_LEN); zlog_debug( - "Recv %sMACIP ADD VNI %u MAC %s%s%s flags 0x%x seq %u VTEP %pI4 ESI %s from %s", + "Recv %sMACIP ADD VNI %u MAC %pEA%s%s flags 0x%x seq %u VTEP %pI4 ESI %s from %s", (flags & ZEBRA_MACIP_TYPE_SYNC_PATH) ? "sync-" : "", - vni, - prefix_mac2str(&macaddr, buf, sizeof(buf)), + vni, &macaddr, ipa_len ? " IP " : "", ipa_len ? ipaddr2str(&ip, buf1, sizeof(buf1)) : "", @@ -3984,7 +3950,6 @@ static int zebra_vxlan_check_del_local_mac(struct interface *ifp, vni_t vni; zebra_evpn_t *zevpn; zebra_mac_t *mac; - char buf[ETHER_ADDR_STRLEN]; zif = ifp->info; assert(zif); @@ -4011,9 +3976,8 @@ static int zebra_vxlan_check_del_local_mac(struct interface *ifp, if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Add/update remote MAC %s intf %s(%u) VNI %u flags 0x%x - del local", - prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name, - ifp->ifindex, vni, mac->flags); + "Add/update remote MAC %pEA intf %s(%u) VNI %u flags 0x%x - del local", + macaddr, ifp->name, ifp->ifindex, vni, mac->flags); /* Remove MAC from BGP. */ zebra_evpn_mac_send_del_to_client(zevpn->vni, macaddr, mac->flags, @@ -4175,7 +4139,6 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, { zebra_evpn_t *zevpn; struct zebra_vrf *zvrf; - char buf[ETHER_ADDR_STRLEN]; assert(ifp); @@ -4186,9 +4149,8 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, if (!zevpn) { if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - " Add/Update %sMAC %s intf %s(%u) VID %u, could not find EVPN", - sticky ? "sticky " : "", - prefix_mac2str(macaddr, buf, sizeof(buf)), + " Add/Update %sMAC %pEA intf %s(%u) VID %u, could not find EVPN", + sticky ? "sticky " : "", macaddr, ifp->name, ifp->ifindex, vid); return 0; }