extmod/network_wiznet5k: Use the configured DNS address if available.

Instead of the default 8.8.8.8.  The change was suggested by @omogenot.
pull/9058/head
robert-hh 2022-08-20 11:25:34 +02:00 zatwierdzone przez Damien George
rodzic 71dcb21e24
commit 8308f9c977
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -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) {