Open bablokb opened 11 hours ago
The reason wifi.radio.dns
is different is that it can support IPv6 addresses, and is even prepared to support multiple DNS servers when the underlying IP stack supports it as well. That said, it's clearly a bug when setting the property causes a crash.
It would be useful to know if setting the ipv4_dns
property, which does have to be an IPV4Address, is also crashing; and it might serve as a workaround for you in your code.
Looks like maybe a conversion to char *
is missing, and not caught by the compiler. If you're able to build circuitpython please try with:
diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c
index 3250ed4d7c..b34a7670b8 100644
--- a/ports/raspberrypi/common-hal/wifi/Radio.c
+++ b/ports/raspberrypi/common-hal/wifi/Radio.c
@@ -574,7 +574,7 @@ void common_hal_wifi_radio_set_dns(wifi_radio_obj_t *self, mp_obj_t dns_addrs_ob
addr.addr = IPADDR_NONE;
} else {
mp_obj_t dns_addr_obj = mp_obj_subscr(dns_addrs_obj, MP_OBJ_NEW_SMALL_INT(0), MP_OBJ_SENTINEL);
- socketpool_resolve_host_raise(dns_addr_obj, &addr);
+ socketpool_resolve_host_raise(mp_obj_str_get_str(dns_addr_obj), &addr);
}
dns_setserver(0, &addr);
}
You can also test with an artifact from the actions on #9727 if you have time
CircuitPython version
Code/REPL
Behavior
Description
When setting
wifi.radio.dns
the device goes into safe-mode.BTW: setting with
wifi.radio.dns = ["8.8.8.8"]
is even worse, the system does not even boot and reconnect again.As a side note: the documentation of
wifi.radio.dns
could be more explicit about the argument: it is currently documented asSequence[str]
, but in fact it must be currently a sequence of length zero or one. Also, think about the consistency of the API: all other methods ofwifi.radio
that take an IP as argument expect an instance ofipaddress.IPv4Address
.Additional information
No response