Thanks to visit codestin.com
Credit goes to github.com

Skip to content

extmod/modnetwork.h: Increase hostname limit to 64 bytes #12403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/library/network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,20 @@ The following are functions available in the network module.
during connection. For this reason, you must set the hostname before
activating/connecting your network interfaces.

The length of the hostname is limited to 63 characters [#f1]_.
:term:`MicroPython ports <MicroPython port>` may choose to set a lower
limit for memory reasons. If the given name does not fit, a `ValueError`
is raised.

The default hostname is typically the name of the board.

.. [#f1] `DHCP <https://datatracker.ietf.org/doc/html/rfc2131#page-10>`_ has a
64-byte limit on the ``sname`` field which includes the terminating null
byte, while `mDNS
<https://datatracker.ietf.org/doc/html/rfc6762#appendix-C>`_ references
`DNS's <https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.4>`_
63-character limit

.. function:: phy_mode([mode])

Get or set the PHY mode.
Expand Down
2 changes: 1 addition & 1 deletion extmod/modnetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
extern char mod_network_country_code[2];

#ifndef MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN
#define MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN (16)
#define MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN (64)
#endif

extern char mod_network_hostname[MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN];
Expand Down