[PATCH] net: dns: Return error when nameserver not given
Sascha Hauer
s.hauer at pengutronix.de
Mon Jun 13 00:05:47 PDT 2022
When no nameserver is given then return an error instead of returning
successfully with 0.0.0.0 as return IP.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
net/dns.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dns.c b/net/dns.c
index 8b5e8d59e8..fdddb3f915 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -226,7 +226,7 @@ int resolv(const char *host, IPaddr_t *ip)
nameserver = net_get_nameserver();
if (!nameserver) {
pr_err("no nameserver specified in $global.net.nameserver\n");
- return 0;
+ return -ENOENT;
}
pr_debug("resolving host %s via nameserver %pI4\n", host, &nameserver);
--
2.30.2
More information about the barebox
mailing list