[PATCH v2 02/15] net: add function to pretty print IPv4

Stephen Hemminger stephen at networkplumber.org
Fri Jan 21 17:20:56 CET 2022


On Fri, 21 Jan 2022 10:31:09 +0000
Ronan Randles <ronan.randles at intel.com> wrote:

> +int32_t
> +rte_ip_print_addr(uint32_t ip_addr, char *buffer, uint32_t buffer_size)
> +{
> +	if (buffer == NULL)
> +		return -1;
> +
> +	snprintf(buffer, buffer_size, "%u.%u.%u.%u",
> +		(ip_addr >> 24),
> +		(ip_addr >> 16) & UINT8_MAX,
> +		(ip_addr >> 8) & UINT8_MAX,
> +		 ip_addr & UINT8_MAX);
> +
> +	return 0;

NAK
Broken on big endian machines.
Once again, why does DPDK need to reinvent everything?


More information about the dev mailing list