summaryrefslogtreecommitdiff
path: root/shared/netutils
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2024-03-28 08:03:41 +0100
committerDamien George <damien@micropython.org>2024-06-04 12:45:01 +1000
commit7e7cc2b427f588559d50bae35d49c305201c2365 (patch)
tree9a7f64e98faa322768995e69c0888b12aa2891dd /shared/netutils
parent1f23ab1e3dabbbe1812f60dfeb5301d887954ac9 (diff)
extmod/network_ninaw10: Implement the ipconfig methods for ninaw10.
This implements network.ipconfig() and network.WLAN.ipconfig() when the ninaw10 driver is used for WLAN. Due to a omission in the ninaw10 driver stack, setting the DNS address has no effect. But the interface is kept here just in case it's fixed eventually. dhcp4 and has_dhcp4 are dummy arguments. Ninaw10 seems to always use DHCP. Signed-off-by: robert-hh <robert@hammelrath.com>
Diffstat (limited to 'shared/netutils')
-rw-r--r--shared/netutils/netutils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/shared/netutils/netutils.c b/shared/netutils/netutils.c
index 84b4405c4..cd1422f7c 100644
--- a/shared/netutils/netutils.c
+++ b/shared/netutils/netutils.c
@@ -63,7 +63,13 @@ void netutils_parse_ipv4_addr(mp_obj_t addr_in, uint8_t *out_ip, netutils_endian
return;
}
const char *s = addr_str;
- const char *s_top = addr_str + addr_len;
+ const char *s_top;
+ // Scan for the end of valid address characters
+ for (s_top = addr_str; s_top < addr_str + addr_len; s_top++) {
+ if (!(*s_top == '.' || (*s_top >= '0' && *s_top <= '9'))) {
+ break;
+ }
+ }
for (mp_uint_t i = 3; ; i--) {
mp_uint_t val = 0;
for (; s < s_top && *s != '.'; s++) {