Read the census socket's binding from the kernel in the beta check #159

Merged
aluminum-ice merged 1 commit from beta-check-socket-kernel into main 2026-11-02 06:56:57 +00:00
Owner

What this PR does

Fixes beta-check item 2.2 (the census socket is bound to the tether), which read a correctly bound socket as unbound. On the device, ss lists UDP sockets from /proc/net/udp (no udp_diag module), and that never shows the interface a socket is bound to. So every socket looked unbound there, and on a device where ss showed the census socket as plain 0.0.0.0, the kernel reported it bound to bnep0.

  • 2.2 now asks the kernel. For each of the daemon's sockets, the script takes a copy of the descriptor (pidfd_getfd, as root), asks a UDP one which interface it's bound to (SO_BINDTODEVICE), and closes the copy at once. It prints counts by interface name only, as before (bnep0=1). If the process can't be read, the result is INFO with the reason, not FAIL.
  • 16.19: when the loopback /status.json sign-in fails, the report now gives the HTTP status (HTTPError 401), so a mistyped password can be told from a busy sign-in helper.
  • README: the read-only rules now say how a running process's socket is inspected: through a copy of its descriptor, asked only what it's bound to, never sent, read or changed.

Checklist

  • Lint passes — make lint (ansible --syntax-check, yamllint, shellcheck --severity=error, and the real-data check). The Lint workflow runs this on the PR.
  • Tests pass — make test (the kestrel_pi pytest suite and the real-data check's tests). The Test workflow runs this on the PR.
  • Nothing real: no secrets, no personal information, no real data. It prints interface names and counts only.
  • Consent gates intact. Still read-only: no management-link tools, no service changes, no config.toml write.
  • Docs updated in the same PR: the beta-check README's rules.
  • Commit messages are short and imperative.

Release impact

  • App-layer-safe — tools/beta-check/ isn't shipped, so this doesn't affect the release kind.
  • Reflash-class

Notes for review

The socket reader was tested off the device against a stand-in process holding one socket bound to lo and one unbound (it reported any=1 lo=1), and against a process that doesn't exist (unknown(ProcessLookupError), so 2.2 reports INFO). On the device, the same reading run by hand showed the census socket bound to bnep0. Once merged, the zip on #158 is replaced.

🤖 Generated with Claude Code

## What this PR does Fixes beta-check item 2.2 (the census socket is bound to the tether), which read a correctly bound socket as unbound. On the device, `ss` lists UDP sockets from `/proc/net/udp` (no `udp_diag` module), and that never shows the interface a socket is bound to. So every socket looked unbound there, and on a device where `ss` showed the census socket as plain `0.0.0.0`, the kernel reported it bound to `bnep0`. - **2.2** now asks the kernel. For each of the daemon's sockets, the script takes a copy of the descriptor (`pidfd_getfd`, as root), asks a UDP one which interface it's bound to (`SO_BINDTODEVICE`), and closes the copy at once. It prints counts by interface name only, as before (`bnep0=1`). If the process can't be read, the result is `INFO` with the reason, not `FAIL`. - **16.19:** when the loopback `/status.json` sign-in fails, the report now gives the HTTP status (`HTTPError 401`), so a mistyped password can be told from a busy sign-in helper. - **README:** the read-only rules now say how a running process's socket is inspected: through a copy of its descriptor, asked only what it's bound to, never sent, read or changed. ## Checklist - [x] **Lint passes** — `make lint` (ansible `--syntax-check`, `yamllint`, `shellcheck --severity=error`, and the real-data check). The **Lint** workflow runs this on the PR. - [x] **Tests pass** — `make test` (the `kestrel_pi` pytest suite and the real-data check's tests). The **Test** workflow runs this on the PR. - [x] **Nothing real: no secrets, no personal information, no real data.** It prints interface names and counts only. - [x] **Consent gates intact.** Still read-only: no management-link tools, no service changes, no `config.toml` write. - [x] **Docs updated in the same PR**: the beta-check README's rules. - [x] Commit messages are short and imperative. ## Release impact - [x] **App-layer-safe** — `tools/beta-check/` isn't shipped, so this doesn't affect the release kind. - [ ] **Reflash-class** ## Notes for review The socket reader was tested off the device against a stand-in process holding one socket bound to `lo` and one unbound (it reported `any=1 lo=1`), and against a process that doesn't exist (`unknown(ProcessLookupError)`, so 2.2 reports `INFO`). On the device, the same reading run by hand showed the census socket bound to `bnep0`. Once merged, the zip on #158 is replaced. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Read the census socket's binding from the kernel in the beta check
All checks were successful
Test / test (pull_request) Successful in 33s
Lint / lint (pull_request) Successful in 34s
Lint / lint (push) Successful in 34s
Test / test (push) Successful in 34s
15dabe381c
ss on the device reads /proc/net/udp, which never shows the interface a
socket is bound to, so 2.2 read a bound socket as unbound. The check now
asks a copy of each of the daemon's UDP descriptors directly. A failed
dashboard sign-in also prints its HTTP status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aluminum-ice deleted branch beta-check-socket-kernel 2026-11-02 06:56:58 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aluminum-ice/kestrel!159
No description provided.