esp8266 / esp8266/Arduino

lwip netif->hostname and a global value

Open
#8,628 0 comments 0 reactions 0 assignees View on GitHub
component: core component: network type: enhancement
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

mentioned in #8626

While we have netif hostnames enabled in lwip
https://github.com/esp8266/Arduino/blob/65d30437f04678aaac7f9d1730dc5020e38c305b/tools/sdk/lwip2/include/lwipopts.h#L1605

Current approach to working with hostname is to have it set / get through `wifi_station_{set,get}_hostname()` funcs. Internally, this works with `char* wifi_station_hostname;`

Then we update every netif to reference it
https://github.com/esp8266/Arduino/blob/65d30437f04678aaac7f9d1730dc5020e38c305b/cores/esp8266/LwipIntf.cpp#L151-L152

Should we have `int gethostname(char*, size_t)` and `void sethostname(const char*, size_t)` calls?
Should the symbol be renamed to something more generic so we don't miss that it is actually something global?
Should the `wifi_station_...hostname` funcs be weakened / removed in favour of our own wrappers? Right now both depend on netif being up, possibly needless.
Should we go back on the global idea and actually implement per-netif hostname? (like [esp-idf netif api actually works](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_netif.html#_CPPv422esp_netif_set_hostnameP11esp_netif_tPKc), also [esp32-arduino wifi implementation](https://github.com/espressif/arduino-esp32/blob/2.0.4/libraries/WiFi/src/WiFiGeneric.cpp))

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.