atomvm / AtomVM

Tiny Erlang VM
https://www.atomvm.net
Apache License 2.0
1.45k stars 98 forks source link

PicoW does not properly set hostname #1094

Open UncleGrumpy opened 6 months ago

UncleGrumpy commented 6 months ago

The pico hostname is not currently being set to atomvm-{MACADDRESS} as it should be. The hostname is always being set to PicoW. The same behavior is observed if a hostname is supplied in the wifi config. This is consistent when in STA and STA+AP mode.

This situation makes for routing problems if multiple picow are on the same network.

UncleGrumpy commented 6 months ago

After some investigating, I realize this feature has not yet been enabled on the picow. I saw the get_default_device_name function an assumed it was used later to set the hostname. In fact this is only used as the default ssid in AP mode if no ssid is supplied.

pguyot commented 6 months ago

I'm not sure what setting the hostname means. Do we run mDNS on the Picow?

UncleGrumpy commented 6 months ago

Sorry, I am referring to the DHCP client hostname, the name that resolves to the assigned IP address.

UncleGrumpy commented 6 months ago

When there are multiple pico connected to a wireless network, they all request the same hostname ("PicoW") from the DHCP server, so pinging a pico by name will not work, it will only work if you use the assigned IP.