summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-08-20 11:25:34 +0200
committerDamien George <damien@micropython.org>2022-08-23 15:00:00 +1000
commit8308f9c977adf322b264e5fbec6dd84315231eb4 (patch)
treebc1ea5d8e1e9f94200f9fb0b48484bb055ac9988
parent71dcb21e24064d1150094e66a904877402cdd157 (diff)
extmod/network_wiznet5k: Use the configured DNS address if available.
Instead of the default 8.8.8.8. The change was suggested by @omogenot.
-rw-r--r--extmod/network_wiznet5k.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/extmod/network_wiznet5k.c b/extmod/network_wiznet5k.c
index 89c933c2d..95c852d7f 100644
--- a/extmod/network_wiznet5k.c
+++ b/extmod/network_wiznet5k.c
@@ -397,6 +397,9 @@ STATIC int wiznet5k_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len,
uint8_t dns_ip[MOD_NETWORK_IPADDR_BUF_SIZE] = {8, 8, 8, 8};
uint8_t *buf = m_new(uint8_t, MAX_DNS_BUF_SIZE);
DNS_init(2, buf);
+ if (wiznet5k_obj.netinfo.dns[0]) {
+ memcpy(dns_ip, wiznet5k_obj.netinfo.dns, MOD_NETWORK_IPADDR_BUF_SIZE);
+ }
mp_int_t ret = DNS_run(dns_ip, (uint8_t *)name, out_ip);
m_del(uint8_t, buf, MAX_DNS_BUF_SIZE);
if (ret == 1) {