v1.1.2 - dedupe race fix
Fixes duplicate FORWARD-hook accumulation that built up over reboots and link-UP events in v1.1.1.
Bug
post-fs-data retry, service.sh periodic sweep, and the ip-monitor event sweep all ran concurrently. Each did -C ... || -I without coordination. Racing -C checks could pass on the same missing rule, then both inserts would land. Net effect: duplicate -i <iface> -j lan_killswitch rules accumulated.
Fix
- mkdir-based atomic mutex at
/data/adb/lan-killswitch.lockwrapping every sweep. Stale-lock detection (mtime > 30s) prevents permanent deadlock if a holder dies. - ensure_hook() is now strictly idempotent: counts existing matches, deletes any extras, inserts exactly one if absent.
- Identical logic in post-fs-data so it never races with service.sh.
Hook count converges to exactly 1 per interface per family regardless of how many sweeps fire in parallel.