Public Access
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
62 lines
5.4 KiB
Markdown
62 lines
5.4 KiB
Markdown
# S1 — System basics
|
|
|
|
**Status:** in progress. The SD driver fix shipped in v0.6.1 (issue #21, ADR 0007), and fixed IPv4 settings in v0.7.0 (issue #7). The System Monitor (#11) hasn't started; issue #39 follows the SD driver upstream.
|
|
|
|
**Goal:** the device works on any network, the card can be trusted, and you can see what the system is doing. A side milestone, like G1.
|
|
|
|
## Fixed IPv4, DNS and NTP (issue #7)
|
|
|
|
Not every network has a DHCP server: a lab bench, a direct link to a router, a network where addresses are handed out by hand. Until now every Saved Network used DHCP, DNS always came from DHCP, and the NTP server was `pool.ntp.org`, hard-coded.
|
|
|
|
**IPv4 only.** IPv6 isn't part of this, now or as a planned follow-up.
|
|
|
|
### Decisions (design round 2026-10-05)
|
|
|
|
| # | Decision |
|
|
|---|---|
|
|
| Q105 | The IP setting is **per Saved Network**: *Automatic* (DHCP, as before) or *Fixed*, with its own address, prefix and gateway. New networks start Automatic. |
|
|
| Q106 | The subnet is entered as a **prefix length** (`24`), with the mask shown next to it. |
|
|
| Q107 | The **gateway is optional**: left empty, the device talks to its own subnet only. |
|
|
| Q108 | **DNS is global:** two servers in Settings, used on every Fixed network. On Automatic networks DHCP's DNS is used, unless **"Always use my DNS"** is on. |
|
|
| Q109 | DNS defaults: **9.9.9.9** (Quad9), then **1.1.1.1** (Cloudflare). |
|
|
| Q110 | **NTP is global:** two servers in Settings, names or addresses, defaulting to `pool.ntp.org` and `time.cloudflare.com`. NTP servers offered by DHCP are used first. GNSS still outranks NTP for the clock. |
|
|
| Q111 | What's typed is checked, host-tested in `lib/wifi`: an address is four numbers from 0 to 255; a prefix is 1 to 30; the address isn't the subnet's network or broadcast address; the gateway is inside the subnet and isn't the device's own address. Refusals say why. |
|
|
| Q112 | Addresses are typed in the line editor, limited to digits and dots. |
|
|
| Q113 | Enter on a Saved Network opens **its page** (IP, Address, Prefix, Gateway, Forget) instead of asking to forget it. Settings > Wi-Fi gains DNS servers, "Always use my DNS" and NTP servers. The Status row opens **connection details**: address, mask, gateway, DNS and NTP in use, and where each came from. |
|
|
| Q114 | A change applies **at once**: the network in use reconnects with the new settings. No automatic way back; the keyboard still works if Wi-Fi is cut. |
|
|
| Q115 | Console: `wifi status` shows address, gateway, DNS, NTP and their sources; `wifi ip <ssid> dhcp`, `wifi ip <ssid> <address>/<prefix> [gateway]`, `wifi dns <a> [b]`, `wifi ntp <a> [b]`. Debug Builds: `wifi ip … try 60` goes back to the previous setting after 60 s unless confirmed with `wifi ip keep`. |
|
|
| Q116 | Left out: checking whether the address is already taken, and per-network DNS. |
|
|
|
|
The SDK already allows 3 NTP servers and 3 DNS servers and can take NTP servers from DHCP (`CONFIG_LWIP_SNTP_MAX_SERVERS=3`, `CONFIG_LWIP_DHCP_GET_NTP_SRV=y`), so the framework isn't rebuilt for this.
|
|
|
|
### Done when
|
|
|
|
- A Saved Network set to Fixed joins with that address, mask and gateway, and the device reaches the internet (IRC, Gemini, NTP) through the DNS servers from Settings.
|
|
- Set back to Automatic, it gets its address from DHCP again.
|
|
- With "Always use my DNS" on, an Automatic network resolves through the servers from Settings.
|
|
- The NTP servers from Settings set the clock.
|
|
- Wrong entries are refused with a reason, in Settings and on the console.
|
|
- Connection details show what's in use and where it came from.
|
|
- Tested on `knbg-guests` with 10.39.39.12 (the device's DHCP lease) and 10.39.39.13 (free: the device is alone on that network).
|
|
|
|
### Measured (2026-10-05 and 06, on `knbg-guests`)
|
|
|
|
The network is 10.39.39.0/24, gateway 10.39.39.1; DHCP gives 10.39.39.1 as DNS and offers no NTP server.
|
|
|
|
- **Fixed 10.39.39.12/24** (the device's own lease) and **Fixed 10.39.39.13/24**, gateway 10.39.39.1: the device joins with that address, DNS is 9.9.9.9 and 1.1.1.1 from Settings, and a Gemini page loads (name resolution, routing, TLS). On .13, .12 no longer answers.
|
|
- **A wrong gateway** (10.39.39.254) on a 60 s trial: the device stops answering from another subnet, and comes back by itself with the previous setting.
|
|
- **Back to Automatic:** 10.39.39.12 by DHCP again, DNS 10.39.39.1 from DHCP.
|
|
- **"Always use my DNS"** on an Automatic network: DNS becomes 9.9.9.9 and 1.1.1.1; switched off, the device joins again and has DHCP's DNS back.
|
|
- **NTP:** `pool.ntp.org` answers; set to `time.cloudflare.com` alone, that one answers within 25 s.
|
|
- **Refusals**, on the console and in Settings: the network's own address, a gateway outside the subnet, a prefix of 31 or 99, 10.39.39.300, an unknown network, a DNS name where an address is needed, a host name with an underscore.
|
|
- **In Settings:** the network's page pre-fills Fixed with the address, prefix and gateway in use; leaving the page applies it; connection details show each value and where it came from.
|
|
- **Not tested:** NTP servers offered by DHCP (this network offers none), and a Fixed network with no gateway.
|
|
|
|
### Work breakdown
|
|
|
|
1. **IPv4 logic** (host-tested): parsing and formatting addresses, prefix and mask, the checks of Q111.
|
|
2. **Storage:** the IP setting in each Saved Network; DNS, "Always use my DNS" and NTP in Settings.
|
|
3. **Wi-Fi Service:** apply it when joining; DNS and NTP; `wifi status` and the console commands.
|
|
4. **Settings:** the network page, the DNS and NTP rows, connection details.
|
|
5. **Tests on the device**, recorded here.
|