From e763dc81bd8b803a6737bfac0cdd749200581a2c Mon Sep 17 00:00:00 2001 From: Ben Nicholson Date: Fri, 25 Sep 2026 08:22:58 +1000 Subject: [PATCH] Phase 2: NTP with hostnames (pool.ntp.org) or IPs Planned SNTP client: servers as names or IPs, several allowed, resolved via DNS. Seeds the PTP clock with real time before becoming GM (today it starts at 1970) and gives syslog timestamps. Added to the phase 2 list in CLAUDE.md and as a section in aes67-core-base.md. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 1 + docs/aes67-core-base.md | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 44e65f5..8a55137 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -55,3 +55,4 @@ Repo: https://gitea.apointless.space/bsncubed/aes67-ESP32-P4 ## Phase 2 (parked) - [ ] VLAN split: AES67 untagged + internet tagged (inet.vlan_id/pcp), per aes67-core-base.md "Network". Needs a tagged VLAN with DHCP on the switch port. Config group `inet` and the UI fields exist already; nothing is applied yet. +- [ ] NTP (SNTP): servers as hostnames or IPs (e.g. `pool.ntp.org`, several allowed; names resolved via DNS, re-resolved on failure). Uses: seed the PTP clock with real time before becoming GM (today it starts at 1970), syslog timestamps. Needs a `time` config group + UI fields (change doc and page together). diff --git a/docs/aes67-core-base.md b/docs/aes67-core-base.md index 6357450..c22a460 100644 --- a/docs/aes67-core-base.md +++ b/docs/aes67-core-base.md @@ -110,6 +110,12 @@ When this device is the GM, offset/frequency/delay show "–". - LLDP (IEEE 802.1AB), transmit only, own code (not in IDF/lwIP): every 30 s, TTL 120 s, plus immediately on a new IP or hostname. TLVs: chassis ID and port ID = MAC, port description "eth0", system name = net.hostname, system description = project + firmware version, capabilities station-only, management address = IPv4. With the VLAN split, send it on the AES67 (untagged) side; the 802.1 port VLAN ID TLV can be added then. - Switch port: AES67 as native/untagged VLAN, internet tagged, PoE on. IGMP snooping + querier on the AES67 VLAN. +## Time / NTP (phase 2, not implemented yet) +- SNTP client for wall-clock time. Servers configurable as hostnames or IPs (e.g. `pool.ntp.org`, `0.pool.ntp.org`, a local server); several allowed, tried in order; names resolved via DNS and re-resolved when a server stops answering. +- Uses: set the EMAC PTP clock to real time (TAI = UTC + 37 s) before this device becomes GM when it has not learned time from another GM (without NTP it starts at 1970); RFC 5424/3164 syslog timestamps. +- Never step the PTP clock from NTP while locked to a GM or while GM with receivers locked; only seed it before becoming GM. +- Planned config group: time: {ntp, servers[] or a comma-separated string, sync_interval_s}; the UI needs matching fields. + ## Syslog - esp_log vprintf hook (chains to UART) -> queue -> low-priority UDP task. Non-blocking, drop and count on overflow, no recursion. RFC 5424 or 3164, PRI = facility*8 + severity (E3 W4 I6 D7 V7). Strip ANSI colour codes. HOSTNAME = net.hostname, APP-NAME = log tag. - Buffer early boot logs in the queue until the netif has an IP. POST /api/log/test sends one info-level message.