Skip to content
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

Fix hostname management #8626

Merged
merged 7 commits into from
Jul 6, 2022
Merged

Fix hostname management #8626

merged 7 commits into from
Jul 6, 2022

Conversation

d-a-v
Copy link
Collaborator

@d-a-v d-a-v commented Jul 4, 2022

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

@mcspr
Copy link
Collaborator

mcspr commented Jul 5, 2022

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?

tests/host/common/MockEsp.cpp Outdated Show resolved Hide resolved
@d-a-v
Copy link
Collaborator Author

d-a-v commented Jul 5, 2022

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 ?

@mcspr
Copy link
Collaborator

mcspr commented Jul 6, 2022

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 :)

@d-a-v d-a-v merged commit a8e3786 into esp8266:master 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change hostname with ethernet W5500lwIP library
2 participants