DHCP option 42 counts (NetOrk/netork#2380, decided 2026-11-11): a device that gets the site's time giver by DHCP is aligned, so the drivers stop switching DHCP-provided NTP off, and the reading tells configured and DHCP-provided servers apart.
TimeSyncDict.dhcp_ntp_servers: NotRequired[list[str] | None] -- the servers the device got by DHCP and uses, in its order; [] = none; absent/None = the driver cannot tell. ntp_servers stays "configured on the device" and no longer holds DHCP's.
PosixTimeSyncMixin reads them:
chrony: the files in the DHCP client's sourcedir (CHRONY_DHCP_DIRS, default /run/chrony-dhcp, /var/run/chrony-dhcp) in the order chronyd reads them -- the files, not chronyc -n sources, because chronyc cannot say which source came from which directory. A DHCP sourcedir that is commented out prints no files, so it reads [].
systemd-timesyncd: LinkNTPServers of timedatectl show-timesync (timesyncd_link_servers, public). timesyncd_servers now returns runtime + system servers only; the fallback only while there is no server at all, a link's included.
ntpd / OpenNTPD: None (their DHCP hooks keep a configuration of their own that is not read); no client: [].
Writing chrony: only server / pool / peer lines are commented out; no sourcedir line any more, and the DHCP client's files are left alone. systemd-timesyncd: a link's servers stay and no longer fail verify.
Repair of 4.35.0 writes: a #napalm-time-sync: sourcedir <dhcp dir> line in the main configuration is uncommented on the next write (restore_command, a sed on that line number), and chronyd restarts since its main configuration changed. A non-DHCP sourcedir 4.35.0 took out stays out -- its sources would be commented out now anyway.
time_sync.py drops from __future__ import annotations: TypedDict only recognises NotRequired from an evaluated annotation.
TDD: contract tests (__optional_keys__, verify ignores DHCP servers) and POSIX tests (real sh, sed, install over a directory tree) written first and seen red.
pytest -q --cov: 1608 passed, 2 skipped, total coverage 97%; _chrony.py, _time_sync_reading.py, time_sync.py, time_sync_posix.py at 100%.
ruff format --check, ruff check, mypy --strict: clean.
napalm-standard check: meets the standard; napalm-standard ratchet: within the baseline.
## Summary
DHCP option 42 counts (NetOrk/netork#2380, decided 2026-11-11): a device that gets the site's time giver by DHCP is aligned, so the drivers stop switching DHCP-provided NTP off, and the reading tells configured and DHCP-provided servers apart.
- `TimeSyncDict.dhcp_ntp_servers: NotRequired[list[str] | None]` -- the servers the device got by DHCP and uses, in its order; `[]` = none; absent/None = the driver cannot tell. `ntp_servers` stays "configured on the device" and no longer holds DHCP's.
- `PosixTimeSyncMixin` reads them:
- chrony: the files in the DHCP client's `sourcedir` (`CHRONY_DHCP_DIRS`, default `/run/chrony-dhcp`, `/var/run/chrony-dhcp`) in the order chronyd reads them -- the files, not `chronyc -n sources`, because chronyc cannot say which source came from which directory. A DHCP `sourcedir` that is commented out prints no files, so it reads `[]`.
- systemd-timesyncd: `LinkNTPServers` of `timedatectl show-timesync` (`timesyncd_link_servers`, public). `timesyncd_servers` now returns runtime + system servers only; the fallback only while there is no server at all, a link's included.
- ntpd / OpenNTPD: None (their DHCP hooks keep a configuration of their own that is not read); no client: `[]`.
- Writing chrony: only `server` / `pool` / `peer` lines are commented out; no `sourcedir` line any more, and the DHCP client's files are left alone. systemd-timesyncd: a link's servers stay and no longer fail `verify`.
- Repair of 4.35.0 writes: a `#napalm-time-sync: sourcedir <dhcp dir>` line in the main configuration is uncommented on the next write (`restore_command`, a `sed` on that line number), and chronyd restarts since its main configuration changed. A non-DHCP `sourcedir` 4.35.0 took out stays out -- its sources would be commented out now anyway.
- `time_sync.py` drops `from __future__ import annotations`: TypedDict only recognises `NotRequired` from an evaluated annotation.
- Version 4.36.0, CHANGELOG, README.
## Related Issue
Part of NetOrk/netork#2380 (epic NetOrk/netork#2360). napalm-openwrt's PR builds on this and needs the 4.36.0 release.
## Testing
TDD: contract tests (`__optional_keys__`, verify ignores DHCP servers) and POSIX tests (real `sh`, `sed`, `install` over a directory tree) written first and seen red.
- `pytest -q --cov`: 1608 passed, 2 skipped, total coverage 97%; `_chrony.py`, `_time_sync_reading.py`, `time_sync.py`, `time_sync_posix.py` at 100%.
- `ruff format --check`, `ruff check`, `mypy --strict`: clean.
- `napalm-standard check`: meets the standard; `napalm-standard ratchet`: within the baseline.
A device that gets the site's time giver through DHCP option 42 is
aligned (NetOrk/netork#2380): most clients already learn it that way.
4.35.0 switched that off on every write -- chrony's DHCP sourcedir was
commented out, and systemd-timesyncd's link servers failed the verify
step -- and folded DHCP's servers into ntp_servers, so an application
could not tell configured from DHCP-provided servers.
TimeSyncDict gains dhcp_ntp_servers (not required): the servers the
device got by DHCP and uses, in its order; [] for none, absent or None
where the driver cannot tell. ntp_servers keeps only the configured ones.
PosixTimeSyncMixin reads chrony's sources from the DHCP client's
sourcedir (CHRONY_DHCP_DIRS, /run/chrony-dhcp by default) as chronyd
reads them, and systemd-timesyncd's LinkNTPServers; ntpd and OpenNTPD
keep DHCP's servers in a configuration of their own, so there it is
unknown. A chrony write now comments out only server, pool and peer
lines and leaves every sourcedir and the DHCP client's files alone. A
DHCP sourcedir that 4.35.0 commented out behind the mark is given back
on the next write, with a restart, so hosts it aligned hear DHCP again.
Version 4.36.0.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
DHCP option 42 counts (NetOrk/netork#2380, decided 2026-11-11): a device that gets the site's time giver by DHCP is aligned, so the drivers stop switching DHCP-provided NTP off, and the reading tells configured and DHCP-provided servers apart.
TimeSyncDict.dhcp_ntp_servers: NotRequired[list[str] | None]-- the servers the device got by DHCP and uses, in its order;[]= none; absent/None = the driver cannot tell.ntp_serversstays "configured on the device" and no longer holds DHCP's.PosixTimeSyncMixinreads them:sourcedir(CHRONY_DHCP_DIRS, default/run/chrony-dhcp,/var/run/chrony-dhcp) in the order chronyd reads them -- the files, notchronyc -n sources, because chronyc cannot say which source came from which directory. A DHCPsourcedirthat is commented out prints no files, so it reads[].LinkNTPServersoftimedatectl show-timesync(timesyncd_link_servers, public).timesyncd_serversnow returns runtime + system servers only; the fallback only while there is no server at all, a link's included.[].server/pool/peerlines are commented out; nosourcedirline any more, and the DHCP client's files are left alone. systemd-timesyncd: a link's servers stay and no longer failverify.#napalm-time-sync: sourcedir <dhcp dir>line in the main configuration is uncommented on the next write (restore_command, asedon that line number), and chronyd restarts since its main configuration changed. A non-DHCPsourcedir4.35.0 took out stays out -- its sources would be commented out now anyway.time_sync.pydropsfrom __future__ import annotations: TypedDict only recognisesNotRequiredfrom an evaluated annotation.Related Issue
Part of NetOrk/netork#2380 (epic NetOrk/netork#2360). napalm-openwrt's PR builds on this and needs the 4.36.0 release.
Testing
TDD: contract tests (
__optional_keys__, verify ignores DHCP servers) and POSIX tests (realsh,sed,installover a directory tree) written first and seen red.pytest -q --cov: 1608 passed, 2 skipped, total coverage 97%;_chrony.py,_time_sync_reading.py,time_sync.py,time_sync_posix.pyat 100%.ruff format --check,ruff check,mypy --strict: clean.napalm-standard check: meets the standard;napalm-standard ratchet: within the baseline.