diff options
Diffstat (limited to 'zebra')
| -rw-r--r-- | zebra/connected.c | 30 | ||||
| -rw-r--r-- | zebra/interface.c | 18 | ||||
| -rw-r--r-- | zebra/irdp_main.c | 10 | ||||
| -rw-r--r-- | zebra/redistribute.c | 60 | ||||
| -rw-r--r-- | zebra/rt_netlink.c | 12 | ||||
| -rw-r--r-- | zebra/rt_socket.c | 22 | ||||
| -rw-r--r-- | zebra/rtadv.c | 4 | ||||
| -rw-r--r-- | zebra/rule_netlink.c | 29 | ||||
| -rw-r--r-- | zebra/zapi_msg.c | 55 | ||||
| -rw-r--r-- | zebra/zebra_dplane.c | 40 | ||||
| -rw-r--r-- | zebra/zebra_evpn.c | 4 | ||||
| -rw-r--r-- | zebra/zebra_fpm.c | 5 | ||||
| -rw-r--r-- | zebra/zebra_gr.c | 10 | ||||
| -rw-r--r-- | zebra/zebra_mpls.c | 39 | ||||
| -rw-r--r-- | zebra/zebra_nb_config.c | 12 | ||||
| -rw-r--r-- | zebra/zebra_rib.c | 43 | ||||
| -rw-r--r-- | zebra/zebra_rnh.c | 5 | ||||
| -rw-r--r-- | zebra/zebra_vxlan.c | 34 | ||||
| -rw-r--r-- | zebra/zserv.c | 8 | 
19 files changed, 160 insertions, 280 deletions
diff --git a/zebra/connected.c b/zebra/connected.c index 8c4ba163bd..cd42b5b250 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -259,14 +259,10 @@ void connected_up(struct interface *ifp, struct connected *ifc)  	/* Schedule LSP forwarding entries for processing, if appropriate. */  	if (zvrf->vrf->vrf_id == VRF_DEFAULT) { -		if (IS_ZEBRA_DEBUG_MPLS) { -			char buf[PREFIX_STRLEN]; - +		if (IS_ZEBRA_DEBUG_MPLS)  			zlog_debug( -				"%u: IF %s IP %s address add/up, scheduling MPLS processing", -				zvrf->vrf->vrf_id, ifp->name, -				prefix2str(&p, buf, sizeof(buf))); -		} +				"%u: IF %s IP %pFX address add/up, scheduling MPLS processing", +				zvrf->vrf->vrf_id, ifp->name, &p);  		mpls_mark_lsps_for_processing(zvrf, &p);  	}  } @@ -400,14 +396,10 @@ void connected_down(struct interface *ifp, struct connected *ifc)  	/* Schedule LSP forwarding entries for processing, if appropriate. */  	if (zvrf->vrf->vrf_id == VRF_DEFAULT) { -		if (IS_ZEBRA_DEBUG_MPLS) { -			char buf[PREFIX_STRLEN]; - +		if (IS_ZEBRA_DEBUG_MPLS)  			zlog_debug( -				"%u: IF %s IP %s address down, scheduling MPLS processing", -				zvrf->vrf->vrf_id, ifp->name, -				prefix2str(&p, buf, sizeof(buf))); -		} +				"%u: IF %s IP %pFX address down, scheduling MPLS processing", +				zvrf->vrf->vrf_id, ifp->name, &p);  		mpls_mark_lsps_for_processing(zvrf, &p);  	}  } @@ -424,14 +416,10 @@ static void connected_delete_helper(struct connected *ifc, struct prefix *p)  	/* Schedule LSP forwarding entries for processing, if appropriate. */  	if (ifp->vrf_id == VRF_DEFAULT) { -		if (IS_ZEBRA_DEBUG_MPLS) { -			char buf[PREFIX_STRLEN]; - +		if (IS_ZEBRA_DEBUG_MPLS)  			zlog_debug( -				"%u: IF %s IP %s address delete, scheduling MPLS processing", -				ifp->vrf_id, ifp->name, -				prefix2str(p, buf, sizeof(buf))); -		} +				"%u: IF %s IP %pFX address delete, scheduling MPLS processing", +				ifp->vrf_id, ifp->name, p);  		mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), p);  	}  } diff --git a/zebra/interface.c b/zebra/interface.c index 3210855801..0652d3a2ba 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1296,8 +1296,6 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)  	bool print_header = true;  	FOR_ALL_INTERFACES (vrf, ifp) { -		char global_pfx[PREFIX_STRLEN] = {0}; -		char buf[PREFIX_STRLEN] = {0};  		bool first_pfx_printed = false;  		if (print_header) { @@ -1329,17 +1327,17 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)  				if (!CHECK_FLAG(connected->flags,  						ZEBRA_IFA_SECONDARY)) {  					p = connected->address; -					prefix2str(p, buf, sizeof(buf));  					if (first_pfx_printed) { -						/* padding to prepare row only for ip addr */ +						/* padding to prepare row only +						 * for ip addr */  						vty_out(vty, "%-40s", "");  						if (list_size > 1)  							vty_out(vty, "+ "); -						vty_out(vty, "%s\n", buf); +						vty_out(vty, "%pFX\n", p);  					} else {  						if (list_size > 1)  							vty_out(vty, "+ "); -						vty_out(vty, "%s\n", buf); +						vty_out(vty, "%pFX\n", p);  					}  					first_pfx_printed = true;  					break; @@ -1361,17 +1359,17 @@ static void ifs_dump_brief_vty(struct vty *vty, struct vrf *vrf)  				p = connected->address;  				/* Don't print link local pfx */  				if (!IN6_IS_ADDR_LINKLOCAL(&p->u.prefix6)) { -					prefix2str(p, global_pfx, PREFIX_STRLEN);  					if (first_pfx_printed) { -						/* padding to prepare row only for ip addr */ +						/* padding to prepare row only +						 * for ip addr */  						vty_out(vty, "%-40s", "");  						if (v6_list_size > 1)  							vty_out(vty, "+ "); -						vty_out(vty, "%s\n", global_pfx); +						vty_out(vty, "%pFX\n", p);  					} else {  						if (v6_list_size > 1)  							vty_out(vty, "+ "); -						vty_out(vty, "%s\n", global_pfx); +						vty_out(vty, "%pFX\n", p);  					}  					first_pfx_printed = true;  					break; diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index b868d23a94..710a32c452 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -175,7 +175,6 @@ static void irdp_send(struct interface *ifp, struct prefix *p, struct stream *s)  {  	struct zebra_if *zi = ifp->info;  	struct irdp_interface *irdp = zi->irdp; -	char buf[PREFIX_STRLEN];  	uint32_t dst;  	uint32_t ttl = 1; @@ -190,10 +189,11 @@ static void irdp_send(struct interface *ifp, struct prefix *p, struct stream *s)  		dst = htonl(INADDR_ALLHOSTS_GROUP);  	if (irdp->flags & IF_DEBUG_MESSAGES) -		zlog_debug("IRDP: TX Advert on %s %s Holdtime=%d Preference=%d", -			   ifp->name, prefix2str(p, buf, sizeof(buf)), -			   irdp->flags & IF_SHUTDOWN ? 0 : irdp->Lifetime, -			   get_pref(irdp, p)); +		zlog_debug( +			"IRDP: TX Advert on %s %pFX Holdtime=%d Preference=%d", +			ifp->name, p, +			irdp->flags & IF_SHUTDOWN ? 0 : irdp->Lifetime, +			get_pref(irdp, p));  	send_packet(ifp, s, dst, p, ttl);  } diff --git a/zebra/redistribute.c b/zebra/redistribute.c index c0f89e6afe..1f075cfb4b 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -119,18 +119,17 @@ static void zebra_redistribute(struct zserv *client, int type,  	for (rn = route_top(table); rn; rn = srcdest_route_next(rn))  		RNODE_FOREACH_RE (rn, newre) {  			const struct prefix *dst_p, *src_p; -			char buf[PREFIX_STRLEN];  			srcdest_rnode_prefixes(rn, &dst_p, &src_p);  			if (IS_ZEBRA_DEBUG_RIB)  				zlog_debug( -					"%s: client %s %s(%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d", +					"%s: client %s %pFX(%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d",  					__func__,  					zebra_route_string(client->proto), -					prefix2str(dst_p, buf, sizeof(buf)), -					vrf_id, CHECK_FLAG(newre->flags, -							   ZEBRA_FLAG_SELECTED), +					dst_p, vrf_id, +					CHECK_FLAG(newre->flags, +						   ZEBRA_FLAG_SELECTED),  					newre->type, newre->distance,  					newre->metric, zebra_check_addr(dst_p)); @@ -196,15 +195,13 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,  	struct listnode *node, *nnode;  	struct zserv *client;  	int afi; -	char buf[PREFIX_STRLEN]; -	if (IS_ZEBRA_DEBUG_RIB) { +	if (IS_ZEBRA_DEBUG_RIB)  		zlog_debug( -			"(%u:%u):%s: Redist update re %p (%s), old %p (%s)", -			re->vrf_id, re->table, prefix2str(p, buf, sizeof(buf)), -			re, zebra_route_string(re->type), prev_re, +			"(%u:%u):%pFX: Redist update re %p (%s), old %p (%s)", +			re->vrf_id, re->table, p, re, +			zebra_route_string(re->type), prev_re,  			prev_re ? zebra_route_string(prev_re->type) : "None"); -	}  	afi = family2afi(p->family);  	if (!afi) { @@ -214,8 +211,7 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,  	}  	if (!zebra_check_addr(p)) {  		if (IS_ZEBRA_DEBUG_RIB) -			zlog_debug("Redist update filter prefix %s", -				   prefix2str(p, buf, sizeof(buf))); +			zlog_debug("Redist update filter prefix %pFX", p);  		return;  	} @@ -224,10 +220,9 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,  		if (zebra_redistribute_check(re, client, p, afi)) {  			if (IS_ZEBRA_DEBUG_RIB) {  				zlog_debug( -					"%s: client %s %s(%u:%u), type=%d, distance=%d, metric=%d", +					"%s: client %s %pFX(%u:%u), type=%d, distance=%d, metric=%d",  					__func__, -					zebra_route_string(client->proto), -					prefix2str(p, buf, sizeof(buf)), +					zebra_route_string(client->proto), p,  					re->vrf_id, re->table, re->type,  					re->distance, re->metric);  			} @@ -254,7 +249,6 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,  	struct listnode *node, *nnode;  	struct zserv *client;  	int afi; -	char buf[PREFIX_STRLEN];  	vrf_id_t vrfid;  	if (old_re) @@ -265,13 +259,11 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,  		return;  	if (IS_ZEBRA_DEBUG_RIB) { -		zlog_debug( -			"%u:%s: Redist del: re %p (%s), new re %p (%s)", -			vrfid, prefix2str(p, buf, sizeof(buf)), -			old_re, -			old_re ? zebra_route_string(old_re->type) : "None", -			new_re, -			new_re ? zebra_route_string(new_re->type) : "None"); +		zlog_debug("%u:%pFX: Redist del: re %p (%s), new re %p (%s)", +			   vrfid, p, old_re, +			   old_re ? zebra_route_string(old_re->type) : "None", +			   new_re, +			   new_re ? zebra_route_string(new_re->type) : "None");  	}  	/* Add DISTANCE_INFINITY check. */ @@ -293,8 +285,8 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,  	if (!zebra_check_addr(p)) {  		if (IS_ZEBRA_DEBUG_RIB) {  			zlog_debug( -				"%u:%s: Redist del old: skipping invalid prefix", -				vrfid, prefix2str(p, buf, sizeof(buf))); +				"%u:%pFX: Redist del old: skipping invalid prefix", +				vrfid, p);  		}  		return;  	} @@ -541,12 +533,10 @@ void zebra_interface_address_add_update(struct interface *ifp,  	struct prefix *p;  	if (IS_ZEBRA_DEBUG_EVENT) { -		char buf[PREFIX_STRLEN]; -  		p = ifc->address; -		zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s on %s(%u)", -			   prefix2str(p, buf, sizeof(buf)), ifp->name, -			   ifp->vrf_id); +		zlog_debug( +			"MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %pFX on %s(%u)", +			p, ifp->name, ifp->vrf_id);  	}  	if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) @@ -580,12 +570,10 @@ void zebra_interface_address_delete_update(struct interface *ifp,  	struct prefix *p;  	if (IS_ZEBRA_DEBUG_EVENT) { -		char buf[PREFIX_STRLEN]; -  		p = ifc->address; -		zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s on %s(%u)", -			   prefix2str(p, buf, sizeof(buf)), -			   ifp->name, ifp->vrf_id); +		zlog_debug( +			"MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %pFX on %s(%u)", +			p, ifp->name, ifp->vrf_id);  	}  	zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 0); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 1ce3c435fe..d0bf77f016 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -731,11 +731,10 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,  		p.prefixlen = rtm->rtm_dst_len;  		if (rtm->rtm_src_len != 0) { -			char buf[PREFIX_STRLEN];  			flog_warn(  				EC_ZEBRA_UNSUPPORTED_V4_SRCDEST, -				"unsupported IPv4 sourcedest route (dest %s vrf %u)", -				prefix2str(&p, buf, sizeof(buf)), vrf_id); +				"unsupported IPv4 sourcedest route (dest %pFX vrf %u)", +				&p, vrf_id);  			return 0;  		} @@ -786,12 +785,11 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,  	}  	if (IS_ZEBRA_DEBUG_KERNEL) { -		char buf[PREFIX_STRLEN];  		char buf2[PREFIX_STRLEN]; +  		zlog_debug( -			"%s %s%s%s vrf %s(%u) table_id: %u metric: %d Admin Distance: %d", -			nl_msg_type_to_str(h->nlmsg_type), -			prefix2str(&p, buf, sizeof(buf)), +			"%s %pFX%s%s vrf %s(%u) table_id: %u metric: %d Admin Distance: %d", +			nl_msg_type_to_str(h->nlmsg_type), &p,  			src_p.prefixlen ? " from " : "",  			src_p.prefixlen ? prefix2str(&src_p, buf2, sizeof(buf2))  					: "", diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index a2e15cbd2b..a0f401c334 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -80,19 +80,15 @@ static int kernel_rtm(int cmd, const struct prefix *p,  	bool gate = false;  	int error;  	char gate_buf[INET6_BUFSIZ]; -	char prefix_buf[PREFIX_STRLEN];  	enum blackhole_type bh_type = BLACKHOLE_UNSPEC; -	prefix2str(p, prefix_buf, sizeof(prefix_buf)); -  	/*  	 * We only have the ability to ADD or DELETE at this point  	 * in time.  	 */  	if (cmd != RTM_ADD && cmd != RTM_DELETE) {  		if (IS_ZEBRA_DEBUG_KERNEL) -			zlog_debug("%s: %s odd command %s", -				   __func__, prefix_buf, +			zlog_debug("%s: %pFX odd command %s", __func__, p,  				   lookup_msg(rtm_type_str, cmd, NULL));  		return 0;  	} @@ -237,8 +233,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,  		if (IS_ZEBRA_DEBUG_KERNEL) {  			if (!gate) {  				zlog_debug( -					"%s: %s: attention! gate not found for re", -					__func__, prefix_buf); +					"%s: %pFX: attention! gate not found for re", +					__func__, p);  			} else {  				switch (p->family) {  				case AF_INET: @@ -266,8 +262,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,  		case ZEBRA_ERR_NOERROR:  			nexthop_num++;  			if (IS_ZEBRA_DEBUG_KERNEL) -				zlog_debug("%s: %s: successfully did NH %s", -					   __func__, prefix_buf, gate_buf); +				zlog_debug("%s: %pFX: successfully did NH %s", +					   __func__, p, gate_buf);  			if (cmd == RTM_ADD)  				SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);  			break; @@ -289,8 +285,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,  		default:  			flog_err(  				EC_LIB_SYSTEM_CALL, -				"%s: %s: rtm_write() unexpectedly returned %d for command %s", -				__func__, prefix_buf, error, +				"%s: %pFX: rtm_write() unexpectedly returned %d for command %s", +				__func__, p, error,  				lookup_msg(rtm_type_str, cmd, NULL));  			break;  		} @@ -300,8 +296,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,  	if (nexthop_num == 0) {  		if (IS_ZEBRA_DEBUG_KERNEL)  			zlog_debug( -				"%s: No useful nexthops were found in RIB prefix %s", -				__func__, prefix_buf); +				"%s: No useful nexthops were found in RIB prefix %pFX", +				__func__, p);  		return 1;  	} diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 13b7c150a3..c3add16c56 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -2337,7 +2337,6 @@ static int rtadv_config_write(struct vty *vty, struct interface *ifp)  	struct rtadv_prefix *rprefix;  	struct rtadv_rdnss *rdnss;  	struct rtadv_dnssl *dnssl; -	char buf[PREFIX_STRLEN];  	int interval;  	zif = ifp->info; @@ -2408,8 +2407,7 @@ static int rtadv_config_write(struct vty *vty, struct interface *ifp)  	for (ALL_LIST_ELEMENTS_RO(zif->rtadv.AdvPrefixList, node, rprefix)) {  		if ((rprefix->AdvPrefixCreate == PREFIX_SRC_MANUAL)  		    || (rprefix->AdvPrefixCreate == PREFIX_SRC_BOTH)) { -			vty_out(vty, " ipv6 nd prefix %s", -				prefix2str(&rprefix->prefix, buf, sizeof(buf))); +			vty_out(vty, " ipv6 nd prefix %pFX", &rprefix->prefix);  			if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME)  			    || (rprefix->AdvPreferredLifetime  				!= RTADV_PREFERRED_LIFETIME)) { diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c index d6a34327a6..a63504992e 100644 --- a/zebra/rule_netlink.c +++ b/zebra/rule_netlink.c @@ -75,8 +75,6 @@ netlink_rule_msg_encode(int cmd, const struct zebra_dplane_ctx *ctx,  	} *req = buf;  	const char *ifname = dplane_ctx_rule_get_ifname(ctx); -	char buf1[PREFIX_STRLEN]; -	char buf2[PREFIX_STRLEN];  	if (buflen < sizeof(*req))  		return 0; @@ -141,11 +139,9 @@ netlink_rule_msg_encode(int cmd, const struct zebra_dplane_ctx *ctx,  	if (IS_ZEBRA_DEBUG_KERNEL)  		zlog_debug( -			"Tx %s family %s IF %s Pref %u Fwmark %u Src %s Dst %s Table %u", +			"Tx %s family %s IF %s Pref %u Fwmark %u Src %pFX Dst %pFX Table %u",  			nl_msg_type_to_str(cmd), nl_family_to_str(family), -			ifname, priority, fwmark, -			prefix2str(src_ip, buf1, sizeof(buf1)), -			prefix2str(dst_ip, buf2, sizeof(buf2)), table); +			ifname, priority, fwmark, src_ip, dst_ip, table);  	return NLMSG_ALIGN(req->n.nlmsg_len);  } @@ -231,8 +227,6 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)  	int len;  	char *ifname;  	struct zebra_pbr_rule rule = {}; -	char buf1[PREFIX_STRLEN]; -	char buf2[PREFIX_STRLEN];  	uint8_t proto = 0;  	/* Basic validation followed by extracting attributes. */ @@ -324,17 +318,14 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)  			ret = dplane_pbr_rule_delete(&rule);  			zlog_debug( -				"%s: %s leftover rule: family %s IF %s Pref %u Src %s Dst %s Table %u", +				"%s: %s leftover rule: family %s IF %s Pref %u Src %pFX Dst %pFX Table %u",  				__func__,  				((ret == ZEBRA_DPLANE_REQUEST_FAILURE)  					 ? "Failed to remove"  					 : "Removed"),  				nl_family_to_str(frh->family), rule.ifname, -				rule.rule.priority, -				prefix2str(&rule.rule.filter.src_ip, buf1, -					   sizeof(buf1)), -				prefix2str(&rule.rule.filter.dst_ip, buf2, -					   sizeof(buf2)), +				rule.rule.priority, &rule.rule.filter.src_ip, +				&rule.rule.filter.dst_ip,  				rule.rule.action.table);  		} @@ -350,15 +341,11 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)  	if (IS_ZEBRA_DEBUG_KERNEL)  		zlog_debug( -			"Rx %s family %s IF %s Pref %u Src %s Dst %s Table %u", +			"Rx %s family %s IF %s Pref %u Src %pFX Dst %pFX Table %u",  			nl_msg_type_to_str(h->nlmsg_type),  			nl_family_to_str(frh->family), rule.ifname, -			rule.rule.priority, -			prefix2str(&rule.rule.filter.src_ip, buf1, -				   sizeof(buf1)), -			prefix2str(&rule.rule.filter.dst_ip, buf2, -				   sizeof(buf2)), -			rule.rule.action.table); +			rule.rule.priority, &rule.rule.filter.src_ip, +			&rule.rule.filter.dst_ip, rule.rule.action.table);  	return kernel_pbr_rule_del(&rule);  } diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index c33bca3d86..18017c9700 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -644,17 +644,12 @@ int zsend_redistribute_route(int cmd, struct zserv *client,  		return -1;  	} -	if (IS_ZEBRA_DEBUG_SEND) { -		char buf_prefix[PREFIX_STRLEN]; - -		prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix)); - -		zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %s", +	if (IS_ZEBRA_DEBUG_SEND) +		zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %pFX",  			   __func__, zserv_command_string(cmd),  			   zebra_route_string(client->proto),  			   zebra_route_string(api.type), api.vrf_id, -			   buf_prefix); -	} +			   &api.prefix);  	return zserv_send_message(client, s);  } @@ -755,26 +750,18 @@ static int route_notify_internal(const struct prefix *p, int type,  	client = zserv_find_client(type, instance);  	if (!client || !client->notify_owner) { -		if (IS_ZEBRA_DEBUG_PACKET) { -			char buff[PREFIX_STRLEN]; - +		if (IS_ZEBRA_DEBUG_PACKET)  			zlog_debug( -				"Not Notifying Owner: %s about prefix %s(%u) %d vrf: %u", -				zebra_route_string(type), -				prefix2str(p, buff, sizeof(buff)), table_id, -				note, vrf_id); -		} +				"Not Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u", +				zebra_route_string(type), p, table_id, note, +				vrf_id);  		return 0;  	} -	if (IS_ZEBRA_DEBUG_PACKET) { -		char buff[PREFIX_STRLEN]; - -		zlog_debug("Notifying Owner: %s about prefix %s(%u) %d vrf: %u", -			   zebra_route_string(type), -			   prefix2str(p, buff, sizeof(buff)), table_id, note, -			   vrf_id); -	} +	if (IS_ZEBRA_DEBUG_PACKET) +		zlog_debug( +			"Notifying Owner: %s about prefix %pFX(%u) %d vrf: %u", +			zebra_route_string(type), p, table_id, note, vrf_id);  	s = stream_new(ZEBRA_MAX_PACKET_SIZ);  	stream_reset(s); @@ -1903,14 +1890,10 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)  	vrf_id = zvrf_id(zvrf); -	if (IS_ZEBRA_DEBUG_RECV) { -		char buf_prefix[PREFIX_STRLEN]; - -		prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix)); -		zlog_debug("%s: p=(%u:%u)%s, msg flags=0x%x, flags=0x%x", -			   __func__, vrf_id, api.tableid, buf_prefix, +	if (IS_ZEBRA_DEBUG_RECV) +		zlog_debug("%s: p=(%u:%u)%pFX, msg flags=0x%x, flags=0x%x", +			   __func__, vrf_id, api.tableid, &api.prefix,  			   (int)api.message, api.flags); -	}  	/* Allocate new route. */  	re = XCALLOC(MTYPE_RE, sizeof(struct route_entry)); @@ -2068,14 +2051,10 @@ static void zread_route_del(ZAPI_HANDLER_ARGS)  	else  		table_id = zvrf->table_id; -	if (IS_ZEBRA_DEBUG_RECV) { -		char buf_prefix[PREFIX_STRLEN]; - -		prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix)); -		zlog_debug("%s: p=(%u:%u)%s, msg flags=0x%x, flags=0x%x", -			   __func__, zvrf_id(zvrf), table_id, buf_prefix, +	if (IS_ZEBRA_DEBUG_RECV) +		zlog_debug("%s: p=(%u:%u)%pFX, msg flags=0x%x, flags=0x%x", +			   __func__, zvrf_id(zvrf), table_id, &api.prefix,  			   (int)api.message, api.flags); -	}  	rib_delete(afi, api.safi, zvrf_id(zvrf), api.type, api.instance,  		   api.flags, &api.prefix, src_p, NULL, 0, table_id, api.metric, diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 76d7d00e4a..24e8db6f33 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -2224,20 +2224,14 @@ static int dplane_ctx_rule_init(struct zebra_dplane_ctx *ctx,  				struct zebra_pbr_rule *new_rule,  				struct zebra_pbr_rule *old_rule)  { -	if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) { -		char buf1[PREFIX_STRLEN]; -		char buf2[PREFIX_STRLEN]; - +	if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)  		zlog_debug( -			"init dplane ctx %s: IF %s Prio %u Fwmark %u Src %s Dst %s Table %u", +			"init dplane ctx %s: IF %s Prio %u Fwmark %u Src %pFX Dst %pFX Table %u",  			dplane_op2str(op), new_rule->ifname,  			new_rule->rule.priority, new_rule->rule.filter.fwmark, -			prefix2str(&new_rule->rule.filter.src_ip, buf1, -				   sizeof(buf1)), -			prefix2str(&new_rule->rule.filter.dst_ip, buf2, -				   sizeof(buf2)), +			&new_rule->rule.filter.src_ip, +			&new_rule->rule.filter.dst_ip,  			new_rule->rule.action.table); -	}  	ctx->zd_op = op;  	ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS; @@ -2895,15 +2889,10 @@ static enum zebra_dplane_result intf_addr_update_internal(  	struct zebra_dplane_ctx *ctx = NULL;  	struct zebra_ns *zns; -	if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) { -		char addr_str[PREFIX_STRLEN]; - -		prefix2str(ifc->address, addr_str, sizeof(addr_str)); - -		zlog_debug("init intf ctx %s: idx %d, addr %u:%s", +	if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) +		zlog_debug("init intf ctx %s: idx %d, addr %u:%pFX",  			   dplane_op2str(op), ifp->ifindex, ifp->vrf_id, -			   addr_str); -	} +			   ifc->address);  	ctx = dplane_ctx_alloc(); @@ -3773,11 +3762,9 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx)  	case DPLANE_OP_ROUTE_INSTALL:  	case DPLANE_OP_ROUTE_UPDATE:  	case DPLANE_OP_ROUTE_DELETE: -		prefix2str(dplane_ctx_get_dest(ctx), buf, sizeof(buf)); - -		zlog_debug("%u:%s Dplane route update ctx %p op %s", -			   dplane_ctx_get_vrf(ctx), buf, ctx, -			   dplane_op2str(dplane_ctx_get_op(ctx))); +		zlog_debug("%u:%pFX Dplane route update ctx %p op %s", +			   dplane_ctx_get_vrf(ctx), dplane_ctx_get_dest(ctx), +			   ctx, dplane_op2str(dplane_ctx_get_op(ctx)));  		break;  	case DPLANE_OP_NH_INSTALL: @@ -3804,11 +3791,10 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx)  	case DPLANE_OP_ADDR_INSTALL:  	case DPLANE_OP_ADDR_UNINSTALL: -		prefix2str(dplane_ctx_get_intf_addr(ctx), buf, sizeof(buf)); - -		zlog_debug("Dplane intf %s, idx %u, addr %s", +		zlog_debug("Dplane intf %s, idx %u, addr %pFX",  			   dplane_op2str(dplane_ctx_get_op(ctx)), -			   dplane_ctx_get_ifindex(ctx), buf); +			   dplane_ctx_get_ifindex(ctx), +			   dplane_ctx_get_intf_addr(ctx));  		break;  	case DPLANE_OP_MAC_INSTALL: diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index 56699c4e83..e1dbd04def 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -349,7 +349,6 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p,  {  	struct zserv *client = NULL;  	struct stream *s = NULL; -	char buf[PREFIX_STRLEN];  	client = zserv_find_client(ZEBRA_ROUTE_BGP, 0);  	/* BGP may not be running. */ @@ -365,8 +364,7 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p,  	stream_putw_at(s, 0, stream_get_endp(s));  	if (IS_ZEBRA_DEBUG_VXLAN) -		zlog_debug("Send ip prefix %s %s on vrf %s", -			   prefix2str(p, buf, sizeof(buf)), +		zlog_debug("Send ip prefix %pFX %s on vrf %s", p,  			   (cmd == ZEBRA_IP_PREFIX_ROUTE_ADD) ? "ADD" : "DEL",  			   vrf_id_to_name(vrf_id)); diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index f84c8c1fcc..1c3193449b 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -1437,7 +1437,6 @@ static inline int zfpm_conn_is_up(void)  static int zfpm_trigger_update(struct route_node *rn, const char *reason)  {  	rib_dest_t *dest; -	char buf[PREFIX_STRLEN];  	/*  	 * Ignore if the connection is down. We will update the FPM about @@ -1454,8 +1453,8 @@ static int zfpm_trigger_update(struct route_node *rn, const char *reason)  	}  	if (reason) { -		zfpm_debug("%s triggering update to FPM - Reason: %s", -			   prefix2str(&rn->p, buf, sizeof(buf)), reason); +		zfpm_debug("%pFX triggering update to FPM - Reason: %s", &rn->p, +			   reason);  	}  	SET_FLAG(dest->flags, RIB_DEST_UPDATE_FPM); diff --git a/zebra/zebra_gr.c b/zebra/zebra_gr.c index a4f32dbf39..ca6a33cd52 100644 --- a/zebra/zebra_gr.c +++ b/zebra/zebra_gr.c @@ -490,19 +490,15 @@ static void zebra_gr_process_route_entry(struct zserv *client,  					 struct route_node *rn,  					 struct route_entry *re)  { -	char buf[PREFIX2STR_BUFFER]; -  	if ((client == NULL) || (rn == NULL) || (re == NULL))  		return;  	/* If the route is not refreshed after restart, delete the entry */  	if (re->uptime < client->restart_time) { -		if (IS_ZEBRA_DEBUG_RIB) { -			prefix2str(&rn->p, buf, sizeof(buf)); -			zlog_debug("%s: Client %s stale route %s is deleted", +		if (IS_ZEBRA_DEBUG_RIB) +			zlog_debug("%s: Client %s stale route %pFX is deleted",  				   __func__, zebra_route_string(client->proto), -				   buf); -		} +				   &rn->p);  		rib_delnode(rn, re);  	}  } diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index e0ad4f1cbe..c3982904e9 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -2362,10 +2362,9 @@ int zebra_mpls_fec_unregister(struct zebra_vrf *zvrf, struct prefix *p,  	fec = fec_find(table, p);  	if (!fec) { -		prefix2str(p, buf, BUFSIZ);  		flog_err(EC_ZEBRA_FEC_RM_FAILED, -			 "Failed to find FEC %s upon unregister, client %s", -			 buf, zebra_route_string(client->proto)); +			 "Failed to find FEC %pFX upon unregister, client %s", +			 p, zebra_route_string(client->proto));  		return -1;  	} @@ -2530,9 +2529,8 @@ int zebra_mpls_static_fec_add(struct zebra_vrf *zvrf, struct prefix *p,  		fec = fec_add(table, p, in_label, FEC_FLAG_CONFIGURED,  			      MPLS_INVALID_LABEL_INDEX);  		if (!fec) { -			prefix2str(p, buf, BUFSIZ);  			flog_err(EC_ZEBRA_FEC_ADD_FAILED, -				 "Failed to add FEC %s upon config", buf); +				 "Failed to add FEC %pFX upon config", p);  			return -1;  		} @@ -2585,8 +2583,7 @@ int zebra_mpls_static_fec_del(struct zebra_vrf *zvrf, struct prefix *p)  	}  	if (IS_ZEBRA_DEBUG_MPLS) { -		prefix2str(p, buf, BUFSIZ); -		zlog_debug("Delete fec %s label %u label index %u", buf, +		zlog_debug("Delete fec %pFX label %u label index %u", p,  			   fec->label, fec->label_index);  	} @@ -2620,7 +2617,6 @@ int zebra_mpls_write_fec_config(struct vty *vty, struct zebra_vrf *zvrf)  	struct route_node *rn;  	int af;  	zebra_fec_t *fec; -	char buf[BUFSIZ];  	int write = 0;  	for (af = AFI_IP; af < AFI_MAX; af++) { @@ -2639,8 +2635,7 @@ int zebra_mpls_write_fec_config(struct vty *vty, struct zebra_vrf *zvrf)  				continue;  			write = 1; -			prefix2str(&rn->p, buf, BUFSIZ); -			vty_out(vty, "mpls label bind %s %s\n", buf, +			vty_out(vty, "mpls label bind %pFX %s\n", &rn->p,  				label2str(fec->label, lstr, BUFSIZ));  		}  	} @@ -2846,7 +2841,7 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,  			     const struct zapi_labels *zl)  {  	int i, counter, ret = 0; -	char buf[NEXTHOP_STRLEN], prefix_buf[PREFIX_STRLEN]; +	char buf[NEXTHOP_STRLEN];  	const struct zapi_nexthop *znh;  	struct route_table *table;  	struct route_node *rn = NULL; @@ -2910,12 +2905,10 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,  			 * attempted to manage LSPs before trying to  			 * find a route/FEC, so we'll continue that way.  			 */ -			if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_MPLS) { -				prefix2str(prefix, prefix_buf, -					   sizeof(prefix_buf)); -				zlog_debug("%s: FTN update requested: no route for prefix %s", -					   __func__, prefix_buf); -			} +			if (IS_ZEBRA_DEBUG_RECV || IS_ZEBRA_DEBUG_MPLS) +				zlog_debug( +					"%s: FTN update requested: no route for prefix %pFX", +					__func__, prefix);  		}  	} @@ -2957,9 +2950,9 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,  			counter++;  		} else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) {  			zapi_nexthop2str(znh, buf, sizeof(buf)); -			prefix2str(prefix, prefix_buf, sizeof(prefix_buf)); -			zlog_debug("%s: Unable to update FEC: prefix %s, label %u, znh %s", -				   __func__, prefix_buf, zl->local_label, buf); +			zlog_debug( +				"%s: Unable to update FEC: prefix %pFX, label %u, znh %s", +				__func__, prefix, zl->local_label, buf);  		}  	} @@ -3007,9 +3000,9 @@ int mpls_zapi_labels_process(bool add_p, struct zebra_vrf *zvrf,  			counter++;  		} else if (IS_ZEBRA_DEBUG_RECV | IS_ZEBRA_DEBUG_MPLS) {  			zapi_nexthop2str(znh, buf, sizeof(buf)); -			prefix2str(prefix, prefix_buf, sizeof(prefix_buf)); -			zlog_debug("%s: Unable to update backup FEC: prefix %s, label %u, znh %s", -				   __func__, prefix_buf, zl->local_label, buf); +			zlog_debug( +				"%s: Unable to update backup FEC: prefix %pFX, label %u, znh %s", +				__func__, prefix, zl->local_label, buf);  		}  	} diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c index b4ed910b4d..f5a85519bb 100644 --- a/zebra/zebra_nb_config.c +++ b/zebra/zebra_nb_config.c @@ -21,6 +21,7 @@  #include "lib/log.h"  #include "lib/northbound.h" +#include "lib/printfrr.h"  #include "libfrr.h"  #include "lib/command.h"  #include "lib/routemap.h" @@ -839,7 +840,6 @@ int lib_interface_zebra_ip_addrs_create(struct nb_cb_create_args *args)  {  	struct interface *ifp;  	struct prefix prefix; -	char buf[PREFIX_STRLEN] = {0};  	ifp = nb_running_get_entry(args->dnode, NULL, true);  	// addr_family = yang_dnode_get_enum(dnode, "./address-family"); @@ -850,15 +850,13 @@ int lib_interface_zebra_ip_addrs_create(struct nb_cb_create_args *args)  	case NB_EV_VALIDATE:  		if (prefix.family == AF_INET  		    && ipv4_martian(&prefix.u.prefix4)) { -			snprintf(args->errmsg, args->errmsg_len, -				 "invalid address %s", -				 prefix2str(&prefix, buf, sizeof(buf))); +			snprintfrr(args->errmsg, args->errmsg_len, +				   "invalid address %pFX", &prefix);  			return NB_ERR_VALIDATION;  		} else if (prefix.family == AF_INET6  			   && ipv6_martian(&prefix.u.prefix6)) { -			snprintf(args->errmsg, args->errmsg_len, -				 "invalid address %s", -				 prefix2str(&prefix, buf, sizeof(buf))); +			snprintfrr(args->errmsg, args->errmsg_len, +				   "invalid address %pFX", &prefix);  			return NB_ERR_VALIDATION;  		}  		break; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 166d479d78..730042b72c 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -694,15 +694,13 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)  			if (IS_ZEBRA_DEBUG_NHT_DETAILED) {  				char buf1[PREFIX_STRLEN]; -				char buf2[PREFIX_STRLEN];  				zlog_debug( -					"%s(%u):%s has Nexthop(%s) Type: %s depending on it, evaluating %u:%u", +					"%s(%u):%s has Nexthop(%pFX) Type: %s depending on it, evaluating %u:%u",  					zvrf_name(zvrf), zvrf_id(zvrf),  					srcdest_rnode2str(rn, buf1,  							  sizeof(buf1)), -					prefix2str(p, buf2, sizeof(buf2)), -					rnh_type2str(rnh->type), seq, +					p, rnh_type2str(rnh->type), seq,  					rnh->seqno);  			} @@ -1924,11 +1922,9 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)  				zsend_route_notify_owner(re, dest_pfx,  							 ZAPI_ROUTE_FAIL_INSTALL); -			zlog_warn("%s(%u:%u):%s: Route install failed", +			zlog_warn("%s(%u:%u):%pFX: Route install failed",  				  VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx), -				  dplane_ctx_get_table(ctx), -				  prefix2str(dest_pfx, dest_str, -					     sizeof(dest_str))); +				  dplane_ctx_get_table(ctx), dest_pfx);  		}  		break;  	case DPLANE_OP_ROUTE_DELETE: @@ -1954,11 +1950,9 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)  			zsend_route_notify_owner_ctx(ctx,  						     ZAPI_ROUTE_REMOVE_FAIL); -			zlog_warn("%s(%u:%u):%s: Route Deletion failure", +			zlog_warn("%s(%u:%u):%pFX: Route Deletion failure",  				  VRF_LOGNAME(vrf), dplane_ctx_get_vrf(ctx), -				  dplane_ctx_get_table(ctx), -				  prefix2str(dest_pfx, dest_str, -					     sizeof(dest_str))); +				  dplane_ctx_get_table(ctx), dest_pfx);  		}  		/* @@ -2831,7 +2825,6 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)  	struct route_node *rn;  	struct route_entry *re;  	struct vrf *vrf; -	char prefix_buf[INET_ADDRSTRLEN];  	vrf = vrf_lookup_by_id(vrf_id); @@ -2849,10 +2842,8 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)  	/* No route for this prefix. */  	if (!rn) { -		zlog_debug("%s:%s(%u) lookup failed for %s", __func__, -			   VRF_LOGNAME(vrf), vrf_id, -			   prefix2str((struct prefix *)p, prefix_buf, -				      sizeof(prefix_buf))); +		zlog_debug("%s:%s(%u) lookup failed for %pFX", __func__, +			   VRF_LOGNAME(vrf), vrf_id, (struct prefix *)p);  		return;  	} @@ -2911,14 +2902,13 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)  	 */  	if (dest->selected_fib) {  		if (IS_ZEBRA_DEBUG_RIB) { -			char buf[PREFIX_STRLEN];  			struct vrf *vrf =  				vrf_lookup_by_id(dest->selected_fib->vrf_id);  			zlog_debug( -				"%s(%u):%s: freeing way for connected prefix", +				"%s(%u):%pFX: freeing way for connected prefix",  				VRF_LOGNAME(vrf), dest->selected_fib->vrf_id, -				prefix2str(&rn->p, buf, sizeof(buf))); +				&rn->p);  			route_entry_dump(&rn->p, NULL, dest->selected_fib);  		}  		rib_uninstall(rn, dest->selected_fib); @@ -2969,14 +2959,12 @@ int rib_add_multipath_nhe(afi_t afi, safi_t safi, struct prefix *p,  		/* Lookup nhe from route information */  		nhe = zebra_nhg_rib_find_nhe(re_nhe, afi);  		if (!nhe) { -			char buf[PREFIX_STRLEN] = "";  			char buf2[PREFIX_STRLEN] = "";  			flog_err(  				EC_ZEBRA_TABLE_LOOKUP_FAILED, -				"Zebra failed to find or create a nexthop hash entry for %s%s%s", -				prefix2str(p, buf, sizeof(buf)), -				src_p ? " from " : "", +				"Zebra failed to find or create a nexthop hash entry for %pFX%s%s", +				p, src_p ? " from " : "",  				src_p ? prefix2str(src_p, buf2, sizeof(buf2))  				      : ""); @@ -3116,9 +3104,8 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,  	/* Lookup route node. */  	rn = srcdest_rnode_lookup(table, p, src_p);  	if (!rn) { -		char dst_buf[PREFIX_STRLEN], src_buf[PREFIX_STRLEN]; +		char src_buf[PREFIX_STRLEN]; -		prefix2str(p, dst_buf, sizeof(dst_buf));  		if (src_p && src_p->prefixlen)  			prefix2str(src_p, src_buf, sizeof(src_buf));  		else @@ -3127,8 +3114,8 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,  		if (IS_ZEBRA_DEBUG_RIB) {  			struct vrf *vrf = vrf_lookup_by_id(vrf_id); -			zlog_debug("%s[%d]:%s%s%s doesn't exist in rib", -				   vrf->name, table_id, dst_buf, +			zlog_debug("%s[%d]:%pFX%s%s doesn't exist in rib", +				   vrf->name, table_id, p,  				   (src_buf[0] != '\0') ? " from " : "",  				   src_buf);  		} diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 9c6ed44585..8178629b00 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -480,7 +480,6 @@ static void zebra_rnh_eval_import_check_entry(struct zebra_vrf *zvrf, afi_t afi,  {  	int state_changed = 0;  	struct zserv *client; -	char bufn[INET6_ADDRSTRLEN];  	struct listnode *node;  	zebra_rnh_remove_from_routing_table(rnh); @@ -506,13 +505,11 @@ static void zebra_rnh_eval_import_check_entry(struct zebra_vrf *zvrf, afi_t afi,  	}  	if (state_changed || force) { -		if (IS_ZEBRA_DEBUG_NHT) { -			prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN); +		if (IS_ZEBRA_DEBUG_NHT)  			zlog_debug("%s(%u):%pRN: Route import check %s %s",  				   VRF_LOGNAME(zvrf->vrf), zvrf->vrf->vrf_id,  				   nrn, rnh->state ? "passed" : "failed",  				   state_changed ? "(state changed)" : ""); -		}  		/* state changed, notify clients */  		for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client)) {  			zebra_send_rnh_update(rnh, client, diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 82e871801a..f8b65bea15 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -310,8 +310,7 @@ static void zl3vni_print_nh(zebra_neigh_t *n, struct vty *vty,  			rb_host_count(&n->host_rb));  		vty_out(vty, "  Prefixes:\n");  		RB_FOREACH (hle, host_rb_tree_entry, &n->host_rb) -			vty_out(vty, "    %s\n", -				prefix2str(&hle->p, buf2, sizeof(buf2))); +			vty_out(vty, "    %pFX\n", &hle->p);  	} else {  		json_hosts = json_object_new_array();  		json_object_string_add( @@ -346,8 +345,7 @@ static void zl3vni_print_rmac(zebra_mac_t *zrmac, struct vty *vty,  		vty_out(vty, " Refcount: %d\n", rb_host_count(&zrmac->host_rb));  		vty_out(vty, "  Prefixes:\n");  		RB_FOREACH (hle, host_rb_tree_entry, &zrmac->host_rb) -			vty_out(vty, "    %s\n", -				prefix2str(&hle->p, buf2, sizeof(buf2))); +			vty_out(vty, "    %pFX\n", &hle->p);  	} else {  		json_hosts = json_object_new_array();  		json_object_string_add( @@ -1270,7 +1268,6 @@ static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni,  {  	char buf[ETHER_ADDR_STRLEN];  	char buf1[INET6_ADDRSTRLEN]; -	char buf2[PREFIX_STRLEN];  	zebra_mac_t *zrmac = NULL;  	zrmac = zl3vni_rmac_lookup(zl3vni, rmac); @@ -1280,11 +1277,11 @@ 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 %s", +				"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)), -				prefix2str(host_prefix, buf2, sizeof(buf2))); +				host_prefix);  			return -1;  		}  		memset(&zrmac->fwd_info, 0, sizeof(zrmac->fwd_info)); @@ -1300,12 +1297,12 @@ 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(%s -> %s) for RMAC %s, prefix %s", +				"L3VNI %u Remote VTEP change(%s -> %s) for RMAC %s, prefix %pFX",  				zl3vni->vni,  				inet_ntoa(zrmac->fwd_info.r_vtep_ip),  				ipaddr2str(vtep_ip, buf1, sizeof(buf1)),  				prefix_mac2str(rmac, buf, sizeof(buf)), -				prefix2str(host_prefix, buf2, sizeof(buf2))); +				host_prefix);  		zrmac->fwd_info.r_vtep_ip = vtep_ip->ipaddr_v4; @@ -1465,7 +1462,6 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,  	char buf[ETHER_ADDR_STRLEN];  	char buf1[ETHER_ADDR_STRLEN];  	char buf2[INET6_ADDRSTRLEN]; -	char buf3[PREFIX_STRLEN];  	zebra_neigh_t *nh = NULL;  	/* Create the next hop entry, or update its mac, if necessary. */ @@ -1474,11 +1470,10 @@ 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 %s)", +				"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, -				prefix2str(host_prefix, buf2, sizeof(buf2))); +				zl3vni->vni, host_prefix);  			return -1;  		} @@ -1486,12 +1481,13 @@ static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni,  		zl3vni_nh_install(zl3vni, nh);  	} 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 %s", -				   zl3vni->vni, -				   prefix_mac2str(&nh->emac, buf, sizeof(buf)), -				   prefix_mac2str(rmac, buf1, sizeof(buf1)), -				   ipaddr2str(vtep_ip, buf2, sizeof(buf2)), -				   prefix2str(host_prefix, buf3, sizeof(buf3))); +			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)), +				host_prefix);  		memcpy(&nh->emac, rmac, ETH_ALEN);  		/* install (update) the nh neigh in kernel */ diff --git a/zebra/zserv.c b/zebra/zserv.c index 44f4641fcf..4b5791530d 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1172,11 +1172,9 @@ static void zebra_show_stale_client_detail(struct vty *vty,  				}  			}  			vty_out(vty, "Current AFI : %d\n", info->current_afi); -			if (info->current_prefix) { -				prefix2str(info->current_prefix, buf, -					   sizeof(buf)); -				vty_out(vty, "Current prefix : %s\n", buf); -			} +			if (info->current_prefix) +				vty_out(vty, "Current prefix : %pFX\n", +					info->current_prefix);  		}  	}  	vty_out(vty, "\n");  | 
