Design: .omp/plans/zerotier-gateway-switching.md — LuCI app + rpcd/ucode backend + zt-gateway-switch shell script for force / graceful-drain gateway switching on OpenWRT.
luci-app-zt-gateway
A LuCI application for OpenWRT that lets users switch which remote ZeroTier node
acts as the internet exit gateway for WIBLAN clients (10.11.13.0/24).
Users select a region/gateway, choose a switch mode, and the app reconfigures kernel routing, conntrack, hotplug scripts, and UCI network routes with minimal disruption.
Switch modes
- Force — instant cutover (~1-2s disruption); existing connections break and clients auto-reconnect through the new gateway. Flushes conntrack for the WIBLAN subnet.
- Graceful drain — zero disruption; existing connections keep using the old gateway via fwmark + a drain routing table, while new connections go through the new gateway immediately. Auto-falls-back to a force switch after a configurable timeout if drain does not complete.
Status
Planning / pre-implementation.
The full design — file structure, UCI config schema, rpcd backend (ucode),
zt-gateway-switch shell script, LuCI frontend, switch logic for both modes,
persistence model, health checks, rollback/safety, Docker macvlan test harness,
and build/install instructions — is the source of truth in:
docs/.omp/plans/zerotier-gateway-switching.md
(also tracked at .omp/plans/zerotier-gateway-switching.md)
Implementation (Makefile, ucode backend, switch script, overview.js, UCI
config, ACL, menu entry) lands in subsequent commits against this repository.
License
Apache-2.0