From: Jerome Forissier Date: Wed, 25 Jun 2025 13:19:15 +0000 (+0200) Subject: lwip: dns: do not print IP address when a variable is specified X-Git-Tag: v2025.10-rc1~132^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1361d9f4f00ad0a6e481cc947b75e8788982878f;p=thirdparty%2Fu-boot.git lwip: dns: do not print IP address when a variable is specified When calling "dns ", do not print out the IP address of onto the console. Print it only when no variable is passed. The reason is to be able to call do_dns() from another command in need of the DNS services without polluting the output. Signed-off-by: Jerome Forissier --- diff --git a/cmd/lwip/dns.c b/cmd/lwip/dns.c index 92312eb5a9d..b5fccc7433e 100644 --- a/cmd/lwip/dns.c +++ b/cmd/lwip/dns.c @@ -43,8 +43,6 @@ static void dns_cb(const char *name, const ip_addr_t *ipaddr, void *arg) if (dns_cb_arg->var) env_set(dns_cb_arg->var, ipstr); - - printf("%s\n", ipstr); } static int dns_loop(struct udevice *udev, const char *name, const char *var) @@ -89,8 +87,11 @@ static int dns_loop(struct udevice *udev, const char *name, const char *var) net_lwip_remove_netif(netif); - if (dns_cb_arg.done && dns_cb_arg.host_ipaddr.addr != 0) + if (dns_cb_arg.done && dns_cb_arg.host_ipaddr.addr != 0) { + if (!var) + printf("%s\n", ipaddr_ntoa(&ipaddr)); return CMD_RET_SUCCESS; + } return CMD_RET_FAILURE; }