diff options
| author | Jim Mussared <jim.mussared@gmail.com> | 2023-09-29 22:49:49 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-10-04 12:39:23 +1100 |
| commit | b329fdcb7394f7a30cb81c48e04ba3d557d29396 (patch) | |
| tree | 87e1cfae4064af67a87a0f0f78c14c6adc8b8eb0 /extmod/modnetwork.h | |
| parent | d6c55a40fe611201ae5a56e1738da443862911db (diff) | |
extmod/modnetwork: Increase max hostname length to 32.
This changes from the previous limit of 15 characters. Although DHCP and
mDNS allow for up to 63, ESP32 and ESP8266 only allow 32, so this seems
like a reasonable limit to enforce across all ports (and avoids wasting the
additional memory).
Also clarifies that `MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN` does not include
the null terminator (which was unclear before).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'extmod/modnetwork.h')
| -rw-r--r-- | extmod/modnetwork.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/extmod/modnetwork.h b/extmod/modnetwork.h index e775612fe..e9769e309 100644 --- a/extmod/modnetwork.h +++ b/extmod/modnetwork.h @@ -56,10 +56,12 @@ extern char mod_network_country_code[2]; #ifndef MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN -#define MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN (16) +// Doesn't include the null terminator. +#define MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN (32) #endif -extern char mod_network_hostname[MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN]; +// This is a null-terminated string. +extern char mod_network_hostname[MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN + 1]; #if MICROPY_PY_LWIP struct netif; |
