]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: lwip: dns: Fix print of resolved IP address
authorJonas Karlman <jonas@kwiboo.se>
Sat, 17 Jan 2026 00:24:37 +0000 (00:24 +0000)
committerJerome Forissier <jerome.forissier@arm.com>
Wed, 4 Feb 2026 08:04:36 +0000 (09:04 +0100)
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@kwiboo.se>
Reviewed-by: Jerome Forissier <jerome.forissier@arm.com>
net/lwip/dns.c

index 9964003195f867b3a37933def0ee16449c630eea..2b2a5947a2b830343be5a1fba1ab70271431b6ee 100644 (file)
@@ -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;
        }