Commit graph

4 commits

Author SHA1 Message Date
okhsunrog
dd2a8038e9 feat(storage): add native config activators 2026-06-28 17:47:45 +03:00
okhsunrog
22d9f62ce0 kpm: speak the control/stats protocol over ctl0
Dispatch the KernelPatch ctl0 supercall on the §4 header kind:
- config  -> vpnhide_parse_config: per-uid hookmask + debug (replaces the
  uid-only target set; each hook now gated by its bit, enabling per-hook
  control). The decimal load-args path stays for headless QEMU bring-up and
  enables the full kernel mask.
- status  -> vpnhide_format_status: backend id, kver, installed-hook mask,
  dominant error (ok / partial_hooks), via out_msg + clamp_to_line.
- stats   -> format wired; per-(uid,hook) counters are a follow-up (TODO).

Add backend ids (kmod/kpm/zygisk/lsposed, protocol §4.3) to the registry so
the status emitter and the app share one source — codegen now renders them
to C/Rust/Kotlin alongside the hook ids and error codes.
2026-06-28 11:53:30 +03:00
okhsunrog
8f5197d2e7 codegen: don't emit the hook registry into lsposed/native
lsposed/native is the uniffi diagnostic-probe library, not a protocol
participant — it consumes iface_lists (VPN-name matching) but never the
hook registry / config masks. Drop it from the hook-ids codegen targets;
the registry goes only to the actual protocol parsers: kmod/KPM (C),
Zygisk (Rust), and the app + system_server hook (Kotlin) per §1.4.
2026-06-28 03:37:16 +03:00
okhsunrog
e85f7cb401 codegen: hook-id registry (protocol §5 single source of truth)
data/hooks.toml is the global hook id space + status error codes shared by
the control/stats protocol: bit N of a config mask == hook id N == the id in
a stats line. scripts/codegen-hooks.py renders the matching id enums,
per-backend 'own' masks, and error codes for every language that touches the
protocol (kmod/KPM C, zygisk Rust, lsposed-native Rust, app Kotlin), so the
numbering can never diverge between backends. Wired into the CI drift-check
beside the iface-list codegen.

The script runs under uv (PEP 723, '#!/usr/bin/env -S uv run' so plain
./scripts/codegen-hooks.py works), matching the repo's other tooling; no
external deps. Generated outputs are rustfmt- and ktlint-clean by
construction. Registry is append-only: ids are permanent so old stats keep
meaning and old readers skip unknown ids.
2026-06-28 02:21:28 +03:00