When calling "dns <hostname> <varname>", do not print out the IP address
of <hostname> 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 <jerome.forissier@linaro.org>
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)
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;
}