[PATCH 1/6] net: lwip: dns: Fix print of resolved IP address

Jerome Forissier jerome.forissier at arm.com
Mon Jan 19 10:12:47 CET 2026


On 17/01/2026 01:24, Jonas Karlman wrote:
> The lwIP dns command only prints out cached resolved IP addresses.
> 
> When a hostname is first resolved and ERR_INPROGRESS is returned the
> dns command prints out 0.0.0.0 instead of the resolved IP address.
> 
> Fix this by printing out host_ipaddr instead of the temporary ipaddr
> that only is valid when ERR_OK is returned.
> 
> Fixes: 1361d9f4f00a ("lwip: dns: do not print IP address when a variable is specified")
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> ---
>  net/lwip/dns.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/lwip/dns.c b/net/lwip/dns.c
> index 9964003195f8..2b2a5947a2b8 100644
> --- a/net/lwip/dns.c
> +++ b/net/lwip/dns.c
> @@ -86,7 +86,7 @@ static int dns_loop(struct udevice *udev, const char *name, const char *var)
>  
>  	if (dns_cb_arg.done && dns_cb_arg.host_ipaddr.addr != 0) {
>  		if (!var)
> -			printf("%s\n", ipaddr_ntoa(&ipaddr));
> +			printf("%s\n", ipaddr_ntoa(&dns_cb_arg.host_ipaddr));
>  		return CMD_RET_SUCCESS;
>  	}

Reviewed-by: Jerome Forissier <jerome.forissier at arm.com>

Thanks,
-- 
Jerome


More information about the U-Boot mailing list