cesanta / mongoose-os

Mongoose OS - an IoT Firmware Development Framework. Supported microcontrollers: ESP32, ESP8266, CC3220, CC3200, STM32F4, STM32L4, STM32F7. Amazon AWS IoT, Microsoft Azure, Google IoT Core integrated. Code in C or JavaScript.
https://mongoose-os.com
Other
2.48k stars 430 forks source link

Nameserver handling #518

Open DrBomb opened 4 years ago

DrBomb commented 4 years ago

Platform: ESP32 with multiple network interfaces. Wifi, Eth and PPPoS together.

MongooseOS handles nameservers on an odd way.

The NET event handler installed by mgos_net.c takes care of setting the system's nameserver on Line 103, while said nameserver is fetched from the function mgos_get_nameserver on the same file.

The problem is, the mgos_get_nameserver function defaults to getting the nameserver from the wifi.sta.nameserver entry (ignoring sta index), and if the string is empty it tries to get it from here (I don't know if other platforms have their own implementation), and ONLY IF the device has WIFI, because it is enclosed on an #ifdef block, otherwise returning NULL.

This brings a few issues:

I would suggest moving the nameserver config entry to a different path, like device.nameserver