Fix hostname management by d-a-v · Pull Request #8626 · esp8266/Arduino

@d-a-v

This proposal addresses two issues

  • Ethernet hostname change was not working as intended because hostname management relies on wifi_station_set_hostname() and STA can be down when ethernet is used,
  • Since WiFi is off at boot time, for the same reason, hostname can't be changed until STA is up.

For both issue, solution is to play with hostname location in ram, reserved by SDK, and filled with ESP-baffed when WiFi boots but which can be now overwritten back when user had already set it to something.

fixes #8143

@d-a-v

@d-a-v

@mcspr

Running the example from Matrix, everything works correctly.

Is the idea to allow to set netif->hostname later on, or it will stay global hostname setting?
And I guess, replacing SDK approach by removing wifi_station_... func from the SDK blobs, and using our own func setting netif->hostname?

@d-a-v

mcspr

@d-a-v

@d-a-v

@d-a-v

Is the idea to allow to set netif->hostname later on, or it will stay global hostname setting?

Both are possible, I think keeping a common global name is better.
Like when you log in a computer with several network cards (ethernet, wifi) or a router: It's much easier when a single name designates a single place.

And I guess, replacing SDK approach by removing wifi_station_... func from the SDK blobs, and using our own func setting netif->hostname?

This is an interesting idea. For now I believe a sketch using the arduino API won't link these functions in.
We can open a new issue for core v4 about that.

Running the example from Matrix, everything works correctly.

Which matrix is it ?

@d-a-v

@d-a-v

@mcspr

Which matrix is it ?

Capital M one! Where you said it would be enough to check ./libraries/ESP8266WiFi/examples/IPv6/IPv6.ino example 🤷

This is an interesting idea. For now I believe a sketch using the arduino API won't link these functions in.
We can open a new issue for core v4 about that.

True, but it's the same issue as with dhcps funcs - NONOS SDK api stops working / interferes with the existing code. SDK part could also be --weaken-symbol=symbolname'd with the objcopy script, and we could have {get,set}hostname() doing this global setting. I will stop theorizing now as well, until the ethernet part works as intended on all fronts :)

mcspr

@mcspr mcspr mentioned this pull request

Jul 6, 2022

@mcspr mcspr added this to the 3.1 milestone

Nov 2, 2022

hasenradball pushed a commit to hasenradball/Arduino that referenced this pull request

Nov 18, 2024
* manage hostname with sdk string