Repository navigation
Remove the "obtain NTP server from DHCP" option - #1335
Merged
Merged
Conversation
The option never worked on ESP32: the Arduino-ESP32 2.0.x framework is built without CONFIG_LWIP_DHCP_GET_NTP_SRV, so sntp_servermode_dhcp() is an empty macro and lwIP never requests DHCP option 42. On ESP8266 it only took effect at a lease renewal or WiFi reconnect. The device now always uses the configured NTP server, or pool.ntp.org when none is set. The ESP8266 core takes NTP servers from DHCP by default, so sntp_servermode_dhcp(0) is still called to keep a DHCP server from replacing the configured one at lease renewal. The checkbox, the "h" key in the configuration JSON and MQTT setconfig, and the ntpDhcp line in the config export are gone; old exports with that line still import. The byte in NtpConfig is kept as "unused" so the EEPROM layout does not change. Refs #1330 Co-Authored-By: Claude Opus 5.5 <[email protected]>
gskjold
force-pushed
the
fix/remove-ntp-dhcp-option
branch
from
December 4, 2026 09:20
b20120e to
be38ad0
Compare
🔧 PR Build ArtifactsVersion: All environments built successfully. Download the zip files:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
"Obtain NTP server from DHCP" never worked on ESP32 (#1330, thanks @LordMike for the analysis). Arduino-ESP32 2.0.x is built without
CONFIG_LWIP_DHCP_GET_NTP_SRV, sosntp_servermode_dhcp()is an empty macro and the precompiled lwIP never asks for DHCP option 42. On ESP8266 it only took effect at a lease renewal or WiFi reconnect.Making it work on ESP32 means either running our own DHCPINFORM next to lwIP's DHCP client (#1331, about 2 kB flash) or moving to Arduino-ESP32 3.x. Since the option has never worked on ESP32, we remove it instead. The device always uses the configured NTP server, or
pool.ntp.orgwhen none is set.Changes
tick_ntp_dhcpstring inlocalazy/source/en.json.setconfig(n.h), the web form (ntpd) and the config export (ntpDhcp) no longer carry the option. Importing an old export that still hasntpDhcpworks; the line is ignored.sntp_servermode_dhcp(0)is still called. The ESP8266 core turns SNTP-from-DHCP on by default, so without this call a DHCP-provided server would replace the configured one at lease renewal. On ESP32 the call compiles to nothing.NtpConfig.dhcpis renamed tounused. The byte stays, so the EEPROM layout is unchanged.Verification
pio run -e esp8266andpio run -e esp32s2build.pio test -e native_configpasses.ui/distis committed.Closes #1330
🤖 Generated with Claude Code